Most Azure users only 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.
You might have some confusion over the difference between tenants, users, and subscriptions within
Azure. A tenant is the Microsoft Entra 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.
In Azure PowerShell, accessing the resources for a subscription requires changing the subscription
associated with your current Azure session. This is done by modifying the active session context,
the information about which tenant, subscription, and user cmdlets should be run against. In order
to change subscriptions, you use the Set-AzContext
cmdlet to change the current context.
The following example shows how to change the context in your current Azure session:
Azure PowerShell
Set-AzContext -Subscription <subscription name or id>
You can use the Get-AzSubscription cmdlet to
retrieve a list of your Azure subscriptions.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Azure PowerShell feedback
Azure PowerShell is an open source project. Select a link to provide feedback: