Set Azure Subscription Using PowerShell

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

Subscriptions

If you have been using Azure for some time, you probably know that switching between subscriptions is 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 up your Azure subscription in PowerShell is to first list all the subscriptions 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 subscription name. You can also use the -subscriptionid and the ID of the subscription.

set-AzContext -SubscriptionName subname

Posted

in

by