azure-xplat-cli icon indicating copy to clipboard operation
azure-xplat-cli copied to clipboard

Feature Request - "--profile" to allow multiple separate login sessions

Open nneul opened this issue 9 years ago • 4 comments

I would really like to see the ability to have multiple independent logins and default contexts simultaneously.

Something I've grown used to with Amazon's 'aws' tool is the ability to specify multiple different login credentials in configuration, and quickly switch between them:

aws --profile client1 do stuff here to first client aws --profile client2 do other stuff here to second client

It seems like this is something that is missing in the azure CLI that would be a really useful addition.

This could probably be implemented with something by doing something as simple as allowing a CLI option to specify a suffix for the .azure directory. i.e.

azure login ==> $HOME/.azure azure --profile fred login ==> $HOME/.azure-fred

azure network nic list ==> $HOME/.azure azure --profile fred azure network nic list ==> $HOME/.azure-fred

Note that this isn't always just for logins - it can be useful for having different defaults/current subscription/etc.

nneul avatar Oct 22 '16 02:10 nneul

Looks like this can be accomplished by setting AZURE_CONFIG_DIR though that's not particularly friendly.

nneul avatar Oct 22 '16 02:10 nneul

By setting AZURE_CONFIG_DIR, you will be making that as the default directory for that session (commandprompt/ terminal). That should work well.

amarzavery avatar Oct 22 '16 03:10 amarzavery

We should add a better documentation/sample for this.

eduardkoller avatar Oct 24 '16 18:10 eduardkoller

Setting a simple alias worked reasonably for this:

alias azure-widgetco='env AZURE_CONFIG_DIR=/users/nneul/.azure-widgetco azure'

nneul avatar Oct 28 '16 17:10 nneul