简体   繁体   中英

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

Are the Azure subscriptions tied to ARM model or ASM model?

I got different results when I run Get-AzureRmSubscription (ARM based) and Get-AzureSubscription (ASM based). I thought I should get similar result.

I have AzureRM (6.4.0) and Azure (5.3.1). I already run 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.

Note: Azure RM PowerShell models are tied to ARM models.

The Azure classic deployment model is not supported by this version of Azure PowerShell. For support for classic deployments, follow the instructions in Install the Azure PowerShell Service Management module .

You may use the following steps to select the right subscription.

For ASM model:

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. This example sets the default subscription to My Azure Subscription. Replace the example subscription name with your own.

Select-AzureSubscription –SubscriptionName "My Azure Subscription"

For ARM model:

Sign in to your account for the ARM model.

 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. You can also use the 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.

This would ensure that all Resources are created with the new resource manager api only. The ARM powershell is just for ARM models, and the ASM powershell is just for ASM models.

For more details about ARM and ASM , you could refer to the articles, 1 and 2 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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