How to change Azure Subscription in PowerShell?



Select-AZSubscription PowerShell command can be used to change the Azure subscription. You can use the Tenant ID, Subscription Name, or Subscription ID when executing this command.


Example:


With Subscription Name,

Select-AzSubscription -SubscriptionName 'MS-Visual Studio'

With TenantID,

Select-AzSubscription -Tenant 'XXXX-XXXXX-XXXXXXX-XXXX'

With Subscription ID,

Select-AzSubscription -SubscriptionId 'XXXX-XXXXX-XXXXXXX-XXXX'
 

On occasion, console notifications indicating the existence of one or more active subscription.

Using the Set-Azcontext command with either the subscription ID or name, you can then switch to other subscription.

Example

Set-AzContext -SubscriptionId "xxxx-xxxx-xxxx-xxxx"

Or

Set-AzContext -SubscriptionName "MS-Visual Studio"

 

Post a Comment

1 Comments

  1. This is useful, Thanks a lot, Now i can switch my subscription whenever i want..

    ReplyDelete