Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
A Microsoft account is a username (associated with an email and its credentials) that is used to sign in to Microsoft services - such as Azure. A Microsoft account can be associated with one or more Azure subscriptions, with one of those subscriptions being the default.
In this article, you learn how to:
- Sign in to Azure interactively using a Microsoft account
- List the account's associated Azure subscriptions (including the default)
- Set the current subscription
Steps to authenticate with Microsoft account
- Open a command line that has access to the Azure CLI. 
- Run az login without any parameters and follow the instructions to sign in to Azure. - az login- Key points: - Upon successful sign in, az logindisplays a list of the Azure subscriptions associated with the logged-in Microsoft account, including the default subscription.
 
- Upon successful sign in, 
- To confirm the current Azure subscription, run az account show. - az account show
- To view all the Azure subscription names and IDs for a specific Microsoft account, run az account list. - az account list --query "[?user.name=='<microsoft_account_email>'].{Name:name, ID:id, Default:isDefault}" --output Table- Key points: - Replace the <microsoft_account_email>placeholder with the Microsoft account email address whose Azure subscriptions you want to list.
- With a Live account - such as a Hotmail or Outlook - you might need to specify the fully qualified email address. For example, if your email address is admin@hotmail.com, you might need to replace the placeholder withlive.com#admin@hotmail.com.
 
- Replace the 
- To use a specific Azure subscription, run az account set. - az account set --subscription "<subscription_id_or_subscription_name>"- Key points: - Replace the <subscription_id_or_subscription_name>placeholder with the ID or name of the subscription you want to use.
- Calling az account setdoesn't display the results of switching to the specified Azure subscription. However, you can useaz account showto confirm that the current Azure subscription has changed.
- If you run the az account listcommand from the previous step, you see that the default Azure subscription has changed to the subscription you specified withaz account set.
 
- Replace the