Azure-cli: `az extension add` should give an option to install extension for all users (i.e. at a machine level)

Created on 1 Jul 2019  路  8Comments  路  Source: Azure/azure-cli

az extension add should give an option to install extension for all users (i.e. at a machine level)

Currently it is possible that azure cli is installed for all users in the machine but extension installation is bound only to a particular user..

it will be great if there can be an option to install extension at machine level instead of just user level

Extensions

All 8 comments

Before we get more user up-votes to make it mainline, the work around is to leverage the Azure_Extension_dir to set to any folders which can be accessed by any users

Before we get more user up-votes to make it mainline, the work around is to leverage the Azure_Extension_dir to set to any folders which can be accessed by any users

Hi @yugangw-msft

How do you leverage the Azure_Extension_dir exactly?

Please disregard my attempt at the bottom of this post.
I managed to pre-install extensions using the ENV variable, thanks to https://github.com/Azure/azure-cli/issues/9831#issuecomment-507441403
Docs: https://docs.microsoft.com/en-us/cli/azure/azure-cli-extensions-overview?view=azure-cli-latest#install-extensions

Sample extension-install for all-users from my dockerfile for other who seek the same problem:
ENV **AZURE_EXTENSION_DIR**=/opt/azcliextensions WORKDIR /opt RUN mkdir azcliextensions RUN az extension add --name azure-devops \ && az extension add --name dev-spaces \ && az extension add --name resource-graph \ && az extension add --name managementpartner

Old deprecated problem - Please IGNORE:
I'd like to upvote as well.
Unfortunately it prevents me from pre-installing the extension for my vscode docker containers remote dev box.
My own attempt both using user and none-user fails with "INFO: Suppress exception There are no active accounts."

Sample build:
Step 11/13 : USER vscode Step 12/13 : RUN az extension add --name azure-devops --verbose && az extension add --name dev-spaces && az extension add --name resource-graph && az extension add --name managementpartner ---> Running in 7b55fbc711f9 INFO: Suppress exception There are no active accounts. INFO: Suppress exception Please run 'az login' to setup account. INFO: command ran in 8.572 seconds.
It appears az-cli requires interactive usage before we can actually use the 'extension add' command.

add to S164.

Hi All,
I see S164 is closed on Feb 4, 2020.
I have azure-cli v.2.2.0 and I install devops extension (v.0.17.0), but still the extension is not available for other users. Is there any workaround to make extensions visible to other users? The one mentioned above did not work for me.
Thanks.

@nsavelyeva By The one mentioned above did not work for me, do you mean the environment variable AZURE_EXTENSION_DIR does not change the extension install location successfully for you, or it does not suit your need? Can you explain?

Another way to customize extension install location is to add dir value under extension section in your config file (By default ~/.azure/config, configurable by environment variable AZURE_CONFIG_DIR). An example is:

[extension]
dir = C:\Users\fenzhou\Develop\env3\Lib\site-packages\azure-cli-extensions

@fengzhou-msft
Thank you for your reply.
I double-checked the 1st way (with environment variable) and also the alternative one (with the configuration file) - I confirm both are working and perfectly meet my need.
In my case I made a mistake in the very beginning when setting the environment variable. Sorry about that.

Was this page helpful?
0 / 5 - 0 ratings