简体   繁体   English

为什么ASM powershell模块无法访问某些订阅?

[英]Why can't the ASM powershell module access some subscriptions?

Are the Azure subscriptions tied to ARM model or ASM model? Azure订阅是否绑定到ARM模型或ASM模型?

I got different results when I run Get-AzureRmSubscription (ARM based) and Get-AzureSubscription (ASM based). 运行Get-AzureRmSubscription (基于ARM)和Get-AzureSubscription (基于ASM)时,得到了不同的结果。 I thought I should get similar result. 我以为我应该得到类似的结果。

I have AzureRM (6.4.0) and Azure (5.3.1). 我有AzureRM(6.4.0)和Azure(5.3.1)。 I already run Add-AzureAccount (ASM), Add-AzureRmAccount (ARM), Connect-AzureRmAccount (ARM). 我已经运行了Add-AzureAccount (ASM), Add-AzureRmAccount (ARM), Connect-AzureRmAccount (ARM)。

I am not able to find any documentation. 我找不到任何文档。 I found this thread https://social.msdn.microsoft.com/Forums/en-US/a5a9d94e-882d-4443-bd18-fa55d95aed41/getazuresubscription-vs-getazurermsubscription?forum=azurescripting but it said a subscription is not inherently ASM or ARM. 我发现此线程https://social.msdn.microsoft.com/Forums/en-US/a5a9d94e-882d-4443-bd18-fa55d95aed41/getazuresubscription-vs-getazurermsubscription?forum=azurescripting,但它表示订阅并不是ASM固有的或ARM。

Note: Azure RM PowerShell models are tied to ARM models. 注意: Azure RM PowerShell模型与ARM模型绑定在一起。

The Azure classic deployment model is not supported by this version of Azure PowerShell. 此版本的Azure PowerShell不支持Azure经典部署模型。 For support for classic deployments, follow the instructions in Install the Azure PowerShell Service Management module . 为了支持经典部署,请按照安装Azure PowerShell服务管理模块中的说明进行操作

You may use the following steps to select the right subscription. 您可以使用以下步骤选择正确的订阅。

For ASM model: 对于ASM模型:

Sign in to your account for the classic model. 登录到您的经典模型帐户。

Add-AzureAccount

Get the available subscriptions by using the following command: 使用以下命令获取可用的订阅:

Get-AzureSubscription | Sort SubscriptionName | Select SubscriptionName

Set your Azure subscription for the current session. 设置当前会话的Azure订阅。 This example sets the default subscription to My Azure Subscription. 本示例将默认订阅设置为“我的Azure订阅”。 Replace the example subscription name with your own. 用您自己的示例名称替换订阅名称。

Select-AzureSubscription –SubscriptionName "My Azure Subscription"

For ARM model: 对于ARM模型:

Sign in to your account for the ARM model. 登录到您的ARM模型帐户。

 Add-AzureRmAccount

To change the current subscription, use the following steps: 要更改当前订阅,请使用以下步骤:

Get-AzureRmSubscription

It will List all your subscriptions. 它将列出您的所有订阅。

Select-AzureRmSubscription -SubscriptionId xxxxx-xxx-xxx-xxxx

The SubscriptionID can be found in the output of the Get-AzureRmSubscription. 可以在Get-AzureRmSubscription的输出中找到SubscriptionID。 You can also use the SubscriptionName. 您也可以使用SubscriptionName。

(Get-AzureRmContext).Subscription

Confirm that you have selected the right subscription. 确认您选择了正确的订阅。

AFAIK, if the subscription was created after a certain time, it is quite possible that the Get-AzureSubscription ie service manager api is not available to that subscription. AFAIK,如果订阅是在一定时间之后创建的,则很有可能Get-AzureSubscription即服务管理器api无法用于该订阅。

This would ensure that all Resources are created with the new resource manager api only. 这样可以确保仅使用新的资源管理器api创建所有资源 The ARM powershell is just for ARM models, and the ASM powershell is just for ASM models. ARM powershell仅适用于ARM模型,而ASM powershell仅适用于ASM模型。

For more details about ARM and ASM , you could refer to the articles, 1 and 2 . 有关ARM和ASM的更多详细信息,请参阅文章12

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM