【Azure 环境】连接到微软云Azure中国区 By VS 2019, VS Code, Powershell

简介: 【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


登录命令

InInstall-Module -Name Az -AllowClobber -Scope CurrentUser
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

相关文章
|
24天前
【Azure 应用服务】Azure Powershell Function 出错 The term 'Connect-AzAccount' is not recognized
【Azure 应用服务】Azure Powershell Function 出错 The term 'Connect-AzAccount' is not recognized
|
20天前
|
JavaScript 前端开发 编译器
TypeScript教程(一)在vscode中的配置TypeScript环境
本文是一篇TypeScript入门教程,介绍了在VS Code中配置TypeScript环境的步骤,包括安装Node.js、使用npm安装TypeScript、配置npm镜像源、安装VS Code的TypeScript扩展,以及创建和运行一个简单的TypeScript "Hello World"程序。
TypeScript教程(一)在vscode中的配置TypeScript环境
|
21天前
|
C++ Python
VS Code 搭建 Python 环境 Conda管理
VS Code 搭建 Python 环境 Conda管理
31 2
|
24天前
【Azure Durable Function】PowerShell Activity 函数遇见 Newtonsoft.Json.JsonReaderException: The reader's MaxDepth of 64 has been exceeded.
【Azure Durable Function】PowerShell Activity 函数遇见 Newtonsoft.Json.JsonReaderException: The reader's MaxDepth of 64 has been exceeded.
|
24天前
【Azure Web Job】Azure Web Job执行Powershell脚本报错 The term 'Select-AzContext' is not recognized as the name
【Azure Web Job】Azure Web Job执行Powershell脚本报错 The term 'Select-AzContext' is not recognized as the name
|
24天前
|
C++
【Azure Developer】VS Code无法连接到中国区Azure解决之法
【Azure Developer】VS Code无法连接到中国区Azure解决之法
|
24天前
|
存储 C# Python
【Azure Storage Account】Azure 存储服务计算Blob的数量和大小的PowerShell代码
【Azure Storage Account】Azure 存储服务计算Blob的数量和大小的PowerShell代码
|
24天前
|
C# C++
【Azure Function】在VS Code中创建Function项目遇见 No .NET worker runtimes found
【Azure Function】在VS Code中创建Function项目遇见 No .NET worker runtimes found
|
24天前
|
C++
【Azure Function App】在VS Code中,创建好Function App后部署到Azure中,无法选择Subscriptions
【Azure Function App】在VS Code中,创建好Function App后部署到Azure中,无法选择Subscriptions
|
24天前
|
Ubuntu Linux 测试技术
【Azure Function App】Python Function调用Powershell脚本在Azure上执行失败的案例
【Azure Function App】Python Function调用Powershell脚本在Azure上执行失败的案例