【Azure 環境】連接到微軟雲Azure中國區 By VS 2019, VS Code, Powershell


問題情形

 最近,在使用最新的VS Code插件連接到中國區的Azure時候,出現了依舊是global版的登錄連接。這個問題是當前Azure Account插件最新版的問題,可以使用V0.8.11版本登錄到中國區。發現有這個問題的時間點為2020-08-25,如過1~2后,問題應已經被修復。

連接中國區Azure的方法:

1) 使用VS Code, 在安裝好Azure Account插件后,進入Setting -> 輸入“Azure Configuration”過濾,在Extensions中選擇Azure Configuration,在Azure Cloud一欄中選擇“AzureChina”。即可。

2) 使用VS 2019登錄中國區Azure, 前提條件需要先安裝好Azure開發的組件后。可以打開Tools中的Options窗口,在Environment的Accounts中,添加Azure In China的注冊項。

當需要發布應用到Azure上時候,這可以在Publish窗口中選擇登錄賬號,然后發布。

3) 使用Powershell登錄,這里目前推薦使用CLI命令登錄,需要您先安裝az模塊。你可以使用以下的命令安裝和登錄中國區Azure。

安裝az模塊:

Install-Module -Name Az -AllowClobber -Scope CurrentUser

登錄命令

az cloud set --name AzureChinaCloud

az login -u xxxx@xxxx.partner.onmschina.cn -p xxxxxxxx

或者是

Connect-AzAccount -Environment AzureChinaCloud

 參考資料:

VS Code登錄中國區Azure: https://docs.azure.cn/zh-cn/articles/azure-operations-guide/others/aog-others-howto-login-china-azure-by-vscode

Powershell: https://docs.azure.cn/zh-cn/role-based-access-control/role-assignments-powershell 

Powershell登陸中國區的命令: https://docs.microsoft.com/zh-cn/powershell/azure/authenticate-azureps?view=azps-4.4.0#sign-in-to-another-cloud

Powershell設置訂閱: https://docs.microsoft.com/zh-cn/powershell/azure/manage-subscriptions-azureps?view=azps-4.4.0#change-the-active-subscription

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM