How To Switch Subscription In Azure PowerShell

We can easily switch the subscription in Azure using the Set-AzContext and Select-AzSubscription PowerShell commands. In this article, let me walk you through the quick steps.

How To Switch Subscription In Azure PowerShell

To switch subscription in Azure PowerShell, follow the below steps.

1. Open Windows PowerShell ISE with Run as administrator mode.

You can use the Get-AzSubscription command to see the Azure subscriptions list.

2. Now, we can execute the below PowerShell command to switch subscriptions.

Set-AzContext -SubscriptionId "1cdf4300-dee5-4518-9c9c-feaa72a5cbd1"

After executing the above PowerShell command, I got the expected output, as shown below.

How To Switch Subscription In Azure PowerShell

We can also use the subscription name instead of the subscription ID, as shown in the screenshot below. We got the expected output.

Set-AzContext -SubscriptionName "Visual Studio Enterprise"
switch subscription azure powershell

We can also use the Select-AzSubscription like the one below.

Select-AzSubscription -SubscriptionId "1cdf4300-dee5-4518-9c9c-feaa72a5cbd1"
switch subscription in azure powershell

We can also use the subscription name instead of the subscription ID along with the Select-AzSubscription command, as mentioned below.

Select-AzSubscription -SubscriptionName "Visual Studio Enterprise"
how to change subscription in azure

FAQs

Which PowerShell cmdlet can be used to switch to a specific Azure subscription?

Set-AzContext, Select-AzSubscription

Conclusion

To switch subscription in Azure PowerShell, we can use Set-AzContext and Select-AzSubscription PowerShell commands as mentioned in this article.

You may also like following the articles below.

Azure Virtual Machine

DOWNLOAD FREE AZURE VIRTUAL MACHINE PDF

Download our free 25+ page Azure Virtual Machine guide and master cloud deployment today!