Skip to content

[Enhancement Proposal] Share login context between Azure CLI and Azure PowerShell #16460

@jiasli

Description

@jiasli

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

Sharing login context between Azure CLI and Azure PowerShell is not supported by now.

Describe the solution you'd like

Azure CLI and Azure PowerShell can share their login context so that users can choose to use either command:

Azure CLI Azure PowerShell
login az login Connect-AzAccount
change context az account set Set-AzContext

Additional context

To share login context, Azure CLI and Azure PowerShell must share 2 things:

Azure CLI Azure PowerShell
context azureProfile.json AzureRmContext.json
token cache accessTokens.json TokenCache.dat

For token cache, once both migrate to MSAL, TokenCache.dat and accessTokens.json will be merged into

C:\Users\<username>\AppData\Local\.IdentityService\msal.cache 

so we get shared msal.cache out of the box.

But for AzureRmContext.json and azureProfile.json, it is very hard for Azure CLI to use AzureRmContext.json from Azure PowerShell given the internal implementation logic is such different.

Also, Azure CLI faces another issue for tenant/user isolation which should also be addressed first before sharing login context with Azure PowerShell: #15005.

If this is really something we need to achieve, drastic overhaul of Azure CLI and Azure PowerShell is necessary.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions