How do I find the current Azure subscription using Azure CLI.
az account list only gives me the list of subscriptions.
First, in the console (https://portal.azure.com/), in the search bar, search for "subscriptions", and choose the first entry, with the yellow key. This will take you to a screen that lists all the subscriptions that you have access to. In this screen, you will see your subscription, along with the Subscription ID.
When you use the az account list Azure CLI command, the terminal response will be JSON that contains this information about all the Azure Subscriptions your current login has access to. To view a list of all the Azure Subscriptions you have access to, run the following command: az account list.
Change the active subscription. You can change your active subscription by using the az account set command. Get a list of your subscriptions with the az account list command: Azure CLI. az account list --output table. This command lists all the subscriptions you can access.
When the az account show command is executed, you’ll see a JSON response written to the terminal with information about the specific Azure Subscription the Azure CLI is currently set to work with: You first need to know some details about your Azure Subscriptions in order to update the Azure Subscription the Azure CLI’s context is set to.
The Azure CLI helps you manage your Azure subscription, create management groups, and lock subscriptions. You might have multiple subscriptions within Azure. You can be part of more than one organization or your organization might divide access to certain resources across groupings.
You could use az account show
to do it, if you do not specify the property, it gets the the details of the current subscription.
For more details, refer to this link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With