az login on specific subscription

Viewed 6152

If you want to connect to a specific subscription with Az.Accounts, you do something like:

Connect-AzAccount -SubscriptionId <guid> etc...

I see that there is no possibility of specifying the SubscriptionId with az login.

If my account for example manages multiple subscriptions, what would happen when listing all resource groups?

How can I login on only one subscription?

1 Answers

Use az account set to set the subscription after az login, as in:

az account set --subscription <subscription name or id>
Related