How to Manage Subscription with Azure PowerShell

In this blog post, we will go over the basics of managing subscriptions with Azure PowerShell.

Managing subscriptions in Azure can be a daunting task, especially if you have multiple subscriptions. Luckily, Azure PowerShell makes it easy to manage subscriptions from the comfort of your terminal.

Before we begin, make sure you have Azure PowerShell installed on your machine. You can download and install it from the PowerShell Gallery using the following command:

Install-Module -Name Az -AllowClobber

Once you have Azure PowerShell installed, you can start managing your subscriptions with the following cmdlets:


The Get-AzSubscription cmdlet retrieves a list of all the subscriptions associated with your account.


This command will return a list of subscriptions with their corresponding names and IDs. If you have multiple subscriptions, you can filter the results by name or ID using the -SubscriptionName or -SubscriptionId parameters, respectively.


The Set-AzContext cmdlet sets the current subscription context for Azure PowerShell. This is important because many Azure PowerShell cmdlets operate on the current subscription context.

Set-AzContext -SubscriptionName "SubscriptionName"

This command sets the current subscription context to the subscription with the specified name. You can also set the subscription context by ID using the -SubscriptionId parameter.


The Select-AzSubscription cmdlet sets the current subscription context interactively. This is useful if you have multiple subscriptions and you want to switch between them quickly.


This command will display a list of all the subscriptions associated with your account. You can select the subscription you want to use by entering its number.


The Remove-AzSubscription cmdlet removes a subscription from your account.

Remove-AzSubscription -SubscriptionId "SubscriptionId"

This command removes the subscription with the specified ID from your account. Be careful when using this cmdlet because it permanently removes the subscription from your account.


The New-AzSubscription cmdlet creates a new subscription.

New-AzSubscription -SubscriptionName "SubscriptionName" -OfferType "MS-AZR-0121P"

This command creates a new subscription with the specified name and offer type. You can find a list of offer types using the Get-AzOffer cmdlet.

Leave a Comment

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