The az account set is an excellent cmdlet that can help you change your active subscription quickly. When you have multiple active Azure subscriptions, this command can help you fulfill this requirement if you wish to set one as an active subscription.
Table of Contents
Syntax of AZ account set subscription
The syntax for the az account set command is as follows.
az account set --subscription 'Your subscription name'az account set --subscription Your subscription idAz account set subscription
If you have multiple Azure subscriptions and wish to set a default Azure subscription, you can use the az account set command in Azure CLI. Now let’s discuss an AZ account set example.
Example 1: Set your Default Subscription using the Subscription name.
Here, the name of my Azure subscription is ‘Visual Studio Enterprise’. I wanted to make it the default subscription. So, I ran the below command in Azure CLI.
az account set --subscription 'Visual Studio Enterprise'After executing the above command, I got the below-expected output. Check out the below screenshot for your reference.

Example 2: Set your Default Subscription using the Subscription ID.
You can also use your subscription ID instead of your Subscription Name like below. In this example, my subscription ID is ‘1cdf4300-xxxxx-4518-fffff-feaa72a5cbd1’. I wanted to make it the default subscription. So, I ran the command below
az account set --subscription 1cdf4300-xxxxx-4518-fffff-feaa72a5cbd1After executing the above command, I got the expected output as below. See the below screenshot.

You may also like following the below articles
Conclusion
In this article, we discussed the syntax and usage of the Az account set command, which can be used to set your default Azure subscription.

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
