为什么New-AzureReservedIP返回ResourceNotFound:未找到任何部署?

Bry*_*yan 5 virtual-machine azure azure-cloud-services

我有一个云服务,里面有两个虚拟机.我正在尝试按照本文中列出的步骤来保留我的云服务的IP地址.

Login-AzureRmAccount -TenantId <my tenant id>
Set-AzureRmContext -SubscriptionId <my subscription id>
New-AzureReservedIP -ReservedIPName myname -Location "Central US" -ServiceName mycloudservicename
Run Code Online (Sandbox Code Playgroud)

我总是得到这个错误:

New-AzureReservedIP:ResourceNotFound:未找到任何部署.

VM是在新门户中创建的,但是是经典模式.我不确定这是不是我的问题.我尝试过其他cmdlet组合来添加帐户或设置订阅但没有任何帮助.

有任何想法吗?

小智 8

我用这个打了30分钟.我不太清楚为什么会这样,但我认为选择订阅时出错了.上次它的工作方式如下:

  • 关闭Azure Power Shell并再次打开它.
  • 列出我的订阅:"Get-AzureSubscription" (确保您已登录).
  • 现在我可以看到确切的订阅ID并使用"Select-AzureSubscription -SubscriptionId XXXXXXXX"
  • 之后,命令工作.
  • New-AzureReservedIP -ReservedIPName"myname" - 位置"South Central US" - ServiceName"myservice"

希望能帮助到你.