Use multiple Azure subscriptions

Most Azure users will only ever have a single subscription. However, if you are part of more than one organization or your organization has divided up access to certain resources across groupings, you may have multiple subscriptions within Azure. The CLI supports selecting a subscription both globally and per command.

For detailed information on subscriptions, billing, and cost management, see the billing and cost management documentation.

Tenants, users, and subscriptions

You might have some confusion over the difference between tenants, users, and subscriptions within Azure. A tenant is the Azure Active Directory entity that encompasses a whole organization. This tenant has at least one subscription and user. A user is an individual and is associated with only one tenant, the organization that they belong to. Users are those accounts that sign in to Azure to create, manage, and use resources. A user may have access to multiple subscriptions, which are the agreements with Microsoft to use cloud services, including Azure. Every resource is associated with a subscription.

To learn more about the differences between tenants, users, and subscriptions, see the Azure cloud terminology dictionary. To learn how to add a new subscription to your Azure Active Directory tenant, see Associate or add an Azure subscription to your Azure Active Directory tenant. To learn how to sign in to a specific tenant, see Sign in with Azure CLI.

Change the active subscription

To access the resources for a subscription, switch your active subscription or use the --subscription argument. Switching your subscription for all commands is done with az account set.

To switch your active subscription:

  1. Get a list of your subscriptions with the az account list command:

    az account list --output table
  2. Use az account set with the subscription ID or name you want to switch to.

    az account set --subscription "My Demos"

To run only a single command with a different subscription, use the --subscription argument. This argument takes either a subscription ID or subscription name:

az vm create --subscription "My Demos" --resource-group MyGroup --name NewVM --image Ubuntu