powershell - 新-AzureRmResourceGroup : 'this.Client.SubscriptionId' cannot be null

标签 powershell azure azure-web-app-service azure-powershell alm

我尝试通过 powershell 在 Azure 中创建新的 Web 应用服务,但遇到以下错误:

New-AzureRmResourceGroup:“this.Client.SubscriptionId”不能为空。

$webAppName = "powershelldemowebapp"
$ResourceGroupName = "PowerShellResourceGroup"          
$Location = "East Asia"

Login-AzureRmAccount -ServicePrincipal -Tenant 000000-0000-0000-0000-00000 -Credential $psCred
Get-AzureSubscription
Select-AzureSubscription  -SubscriptionId 00000-0000-0000-000-0000
New-AzureRmWebApp -Name $webAppName  -ResourceGroupName $ResourceGroupName  -Location $Location 

最佳答案

Get-AzureSubscriptionSelect-AzureSubscription 是 ASM cmdlet。我注意到您想要创建一个 ARM Web 应用程序。如果您有多个 ARM 订阅,则使用 Select-AzureSubscription 无法更改默认订阅。该 cmdlet 仅更改经典订阅。

您需要使用 ARM cmdlet。

获取 AzureRmSubscription 选择-AzureRmSubscription -SubscriptionId 00000-0000-0000-000-0000

关于powershell - 新-AzureRmResourceGroup : 'this.Client.SubscriptionId' cannot be null,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41693243/

相关文章:

git - 如何让 visual studio 使用与 Github for windows 相同的 powershell

powershell - 通过 Powershell 登录脚本显示弹出框

azure - 如何使用 Azure API 管理策略来平衡对后端服务的调用的负载?

c# - 当托管在 Azure 应用服务中时,如何控制添加到 ASP.NET Core Web 应用程序的 HTTP 响应 header ?

azure - 在进行 Azure 应用程序注册时,Terraform 出现循环错误

azure - 是否可以通过用户租户上的 ARM 模板在 Azure 上自动注册应用程序?

powershell - 如何搭配三个或更多元素

Azure 机器学习 REST API : why is the prediction included in the Sample Request?

javascript - 调试 Node.js Azure 函数

spring-boot - 如何配置 Tomcat 以在 Azure 应用服务上使用 HTTP2?