MicrosoftDocs/azure-docs-cli

The CLI version for which the change in behaviour around default subscriptions is not clear

Closed this issue · 2 comments

Prerequisites

  • Write a descriptive title.
  • Search the existing issues.
  • I am reporting the documentation problem for the current version of Azure CLI.

Azure CLI version being used

2.38.0

Link to affected document

https://docs.microsoft.com/en-us/cli/azure/manage-azure-subscriptions-azure-cli#get-the-active-subscription

Description of the documentation error

The documentation mentions:

Most Azure CLI commands act within a subscription. For optimum security, Azure CLI commands no longer default the subscription ID to your current, active subscription. You must now specify the subscription to work in by using the --subscription or --scope parameter in your command.

But it does not state from which version of the CLI this change takes effect. Perhaps this change is not in a specific version of the CLI but one that was made on the backend.

Either way it would be good to clarify this because this seems like a big change that could break things for users that rely on setting the current active subscription

In case it helps here is the commit this wording was added in 3d14cae

Suggested fix

No response

jiasli commented

Thanks for bringing this to our attention. The document is not accurate.

This below statement only applies to az ad sp create-for-rbac (Azure/azure-cli#21323). It doesn't affect other commands such as az group list.

For optimum security, Azure CLI commands no longer default the subscription ID to your current, active subscription. You must now specify the subscription to work in by using the --subscription or --scope parameter in your command.

The original statement still holds for most commands:

Many Azure CLI commands act within a subscription. You can always specify which subscription to work in by using the --subscription parameter in your command. That parameter is optional. If you don't specify a subscription, the command uses your current, active subscription.

@vijaytdh, thank you for helping to improve Azure CLI docs. The issue you kindly brought to our attention has been corrected in PR 3649.