It is important to ensure you are are logged in with the correct security principal and that you are in the correct subscription.
This is called context for short.
Get the context of your current session:
az account show --output jsoncCheck:
- User principal name and type
- tenantId
- id (which is the subscriptionId)
An AAD security principal is either a standard user principal, or a service principal. Managed identity is a variant of a service principal.
- Use
az loginto login as a different security principal. - Use the
--tenantswitch to login as a guest user into another tenant. - Use the
--service-principalor--identityswitches if logging in as a service principal or a managed identity.
Use az login --help to view usage and examples.
az account list --output tableaz account set --subscription <subscriptionId>You can also use the name of the subscription as a string.
Note that this will become your new default when you log in as the current user.
If you are constantly switching between subscriptions then consider adding an alias to your .bashrc file.
For example:
alias vs='az account set --subscription 2d31be49-d959-4415-bb65-8aec2c90ba62; az account show --output yamlc'