Set Azure Subscription Using PowerShell

In this blog post, I will show you how I set my Azure subscription using PowerShell and work with resources that are in the subscription.

Subscriptions

If you have been using Azure for some time you probably know that switching between subscriptions in something that is very common. If you have multiple subscriptions attached to your account you must specify which subscription you would work.

Get Subscription

The first step in setting you Azure subscription in PowerShell is to first list all the subscription you have using the following command. The output will display the names and IDs.

get-azsubscription

Set Subscription

To set the subscription run the following command with the name of the subscription. You can also use the -subscriptionid and the ID of the subscription.

set-AzContext -SubscriptionName subname

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.