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

Question: Installing extensions in offline environments

Open NenoLoje opened this issue 3 years ago • 11 comments

(Note: This is a cross-post from https://github.com/Azure/azure-devops-cli-extension/issues/1055)

How to set up an Azure CLI extension in an offline environment?

I see that the Azure CLI supports installing from a local source like this: az extension add –source …

… but this doesn't seem to be enough. (I'm trying to install the Azure DevOps extension and it fails when it runs "pip", which tries to connect to public sources…).

Any tips on how an offline / or x-copy-like deployment looks like?

NenoLoje avatar Oct 05 '20 09:10 NenoLoje

hi @fengzhou-msft could you pls help on this?

yungezz avatar Oct 05 '20 13:10 yungezz

I'm having same problem due to trying to go through corporate proxy and I just keep hitting more and more stuff that wants whitelisted. I'd really love to be able to just download the extensions and required packages offline and distribute them internally as I won't get this past security in current state. Azure Devops cli extension seems to be only way for universal package uploads for instance ?

gabrielmccoll avatar Oct 07 '20 11:10 gabrielmccoll

@gabrielmccoll Specifically for the case you mentioned regarding uploading/downloading universal packages, the workaround I used is to:

  • install an 🚀 Azure Pipelines agent on that machine (the corporate firewall in my case had the neccessary execptions it already configured)
  • and use the Universal Package task (which supports up- and downloading). No need to install Azure CLI or the Azure DevOps extension at all.

Hope it helps!

NenoLoje avatar Oct 13 '20 12:10 NenoLoje

@gabrielmccoll Specifically for the case you mentioned regarding uploading/downloading universal packages, the workaround I used is to:

  • install an 🚀 Azure Pipelines agent on that machine (the corporate firewall in my case had the neccessary execptions it already configured)

  • and use the Universal Package task (which supports up- and downloading). No need to install Azure CLI or the Azure DevOps extension at all.

Hope it helps!

That is a nice wee work around thank you

gabrielmccoll avatar Oct 16 '20 07:10 gabrielmccoll

Also I'm trying to install Azure DevOps extension into a separate development machine, but corporate proxy prevents the pip to fetch the required modules from pypi.org. I've installed those modules manually, but DevOps extension does not check the currently installed modules and tries to fetch those from pypi.org every time. Any possibilities to make DevOps installation to just use already installed modules?

JariSal avatar Oct 28 '20 14:10 JariSal

@JariSal the extension is not installed in standard python package location, you can check with az --version. By default it's ~/.azure/cliextensions. Please install its dependency packages under ~/.azure/cliextensions/azure-devops/

fengzhou-msft avatar Nov 27 '20 02:11 fengzhou-msft

azure-devops currently specifies 3 dependencies, only distro is not in azure-cli (the version requirement for python-dateutil is different, not sure if it will cause problems). @NenoLoje you need to install azure-devops with --no-deps and then install the distro package with --target ~/.azure/cliextensions/azure-devops

https://github.com/Azure/azure-cli-extensions/blob/3e711c42dbe336230ba3274fe3cf77a43b25c48b/src/index.json#L3066-L3068

fengzhou-msft avatar Nov 27 '20 02:11 fengzhou-msft

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @narula0781, @ashishonce, @romil07.

Issue Details

(Note: This is a cross-post from https://github.com/Azure/azure-devops-cli-extension/issues/1055)

How to set up an Azure CLI extension in an offline environment?

I see that the Azure CLI supports installing from a local source like this: az extension add –source …

… but this doesn't seem to be enough. (I'm trying to install the Azure DevOps extension and it fails when it runs "pip", which tries to connect to public sources…).

Any tips on how an offline / or x-copy-like deployment looks like?

Author: NenoLoje
Assignees: fengzhou-msft
Labels:

DevOps, Packaging, Service Attention, question

Milestone: -

ghost avatar Nov 27 '20 02:11 ghost

Route to service team to see if they can remove the msrest and python-dateutil dependencies which are already installed with the azure-cli package. distro is a very simple package, you may also considering vendoring its source code.

fengzhou-msft avatar Nov 27 '20 02:11 fengzhou-msft

Hope it helps command from https://docs.microsoft.com/en-us/cli/azure/extension?view=azure-cli-latest az extension add --source ~/anextension-0.0.1-py2.py3-none-any.whl --pip-proxy https://user:[email protected]:8080

as for me this works first dowload what you need from https://azcliextensionsync.blob.core.windows.net/index1/index.json

to install devops extension python.exe -m pip install --target "~\.azure\cliextensions\azure-devops" azure_devops-0.12.0-py2.py3-none-any.whl --proxy "http://proxy_to_pip_repo/" -vv --disable-pip-version-check --no-cache-dir --trusted-host pypi.org --trusted-host files.pythonhosted.org

to install devops login dependency python.exe -m pip install --target "~\.azure\cliextensions\azure-devops" keyring~=17.1.1 --proxy "http://proxy_to_pip_repo/" -vv --disable-pip-version-check --no-cache-dir --trusted-host pypi.org --trusted-host files.pythonhosted.org

dimalyshev avatar Mar 29 '21 20:03 dimalyshev

Hi @fengzhou-msft, are there any updates for this? We need to install Azure CLI extensions on disconnected environments. Would be good if there is a work-around or script to set up an environment so that customers can run Azure CLI extension commands in an offline environment without differences in user-experience.

TheOnlyWei avatar May 08 '24 23:05 TheOnlyWei