Azure / azure-cli

Azure Command-Line Interface
MIT License
4.01k stars 2.98k forks source link

Configuration for separate contexts #22122

Open TheOnlyWei opened 2 years ago

TheOnlyWei commented 2 years ago

Is your feature request related to a problem? Please describe.

The Azure CLI shared context across multiple applications and sessions is a shared resource that will cause a race condition if a customer uses multiple environments simultaneously. E.g., an Azure Stack user who also accesses the Azure Cloud.

Describe the solution you'd like

A configuration that can modularize contexts by session so that it is no longer a shared resource. This feature would be similar to the -scope parameter for Azure PowerShell below, which saves a log-in context to the current PowerShell session: https://docs.microsoft.com/en-us/powershell/azure/context-persistence?view=azps-7.4.0&viewFallbackFrom=azps-7.1.0#save-azure-contexts-across-powershell-sessions

Describe alternatives you've considered

The only alternative is to run any interaction with Azure and Azure Stack sequentially, which is not always feasible, e.g., if a customer has a pipeline with integration tests that runs code in parallel accessing Azure or Azure Stack simultaneously on the same VM. Furthermore, SDKs and tools may consume Azure CLI, which does not inherently support multiple simultaneous contexts, therefore propagating the race condition issue to other tools.

Additional context

Related issue: https://github.com/Azure/login/issues/202

yonzhan commented 2 years ago

@jiasli for awareness