azure-devops-cli-extension: az artifacts universal download not working behind proxy

This is autogenerated. Please review and update as needed.

Describe the bug

I am working behind a corporate proxy. I am using below enviroment variables. http_proxy: username:passoword@proxy.com:1234 https_proxy: username:passoword@proxy.com:1234 az login works fine. But the below command fails

Command Name az artifacts universal download Extension Name: azure-devops. Version: 0.15.0.

Errors:

HTTPSConnectionPool(host='08wvsblobprodsu6weus73.vsblob.vsassets.io', port=443): Max retries exceeded with url: /artifacttool/artifacttool-win10-x64-Release_0.2.128.zip?sv=2017-04-17&sr=b&sig=ROwJZvi91FUWlgxNKLvGhncGvNt4pMAscin24AU8TpA%3D&spr=https&se=2019-11-19T12%3A28%3A02Z&sp=r&P1=1574166182&P2=11&P3=2&P4=nVC9zR0DzXvi2mMg1dV0dLTFHj9003iy92tc2KVTAk0%3d (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required',)))
Traceback (most recent call last):
pip-install-hb486cm7\urllib3\urllib3\connectionpool.py, ln 594, in urlopen
pip-install-hb486cm7\urllib3\urllib3\connectionpool.py, ln 805, in _prepare_proxy
pip-install-hb486cm7\urllib3\urllib3\connection.py, ln 308, in connect
...

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here…
  • az artifacts universal download --organization {} --feed {} --name {} --version {} --path {}

Expected Behavior

Environment Summary

Windows-10-10.0.18362-SP0
Python 3.6.6
Shell: powershell.exe

azure-cli 2.0.76

Extensions:
azure-devops 0.15.0

Additional Context

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15

Most upvoted comments

As a note to any trying to solve a similar problem to the one above. We ran into the above issue, and isolated it to an SSL Inspection function in our network security application (ZScaler). Bypassing SSL Inspection for the URL solved the issue.

The second workaround worked for me, once you redirect the CLI to the download location you can get your packages.

The help for the tool does not show anything when you poke it, it always returns the same message, is there any special argument that I need to send?, I had to decompile the artifacttool.dll to find the class CommandBase and see what the arguments were:

artifacttool.exe universal download --service “https://dev.azure.com/<Your DevOps Org>/” --patvar ArtifactToolPat --feed “<Your feed>” --package-name “<Your Package Name>” --package-version “<Your Package Version>” --path “<Path to save files>”

This is what you get when you call --help, it seems that the commands are not wired up correctly to show up in the help for some reason. C:_b\d>artifacttool.exe command --help Usage: artifacttool [arguments] [options]

Arguments: category The category to which the following command belongs. command The command under the given category to be invoked.

Options: -?|-h|–help Show help information

I could never get the first workaround to work I always got the following issue even though I was setting up the environment variable as expected: { "@t":"2019-12-11T15:24:35.8644432Z", "@m":"[GetDedupManifestArtifactClientAsync] Try 1/5, non-retryable exception caught. Throwing. Details:\r\nNo LastRequestResponse on exception VssUnauthorizedException: TF400813: Resource not available for anonymous access. Client authentication required.", "@i":"503505fd", "@l":"Warning", "@x":"Microsoft.VisualStudio.Services.Common.VssUnauthorizedException: TF400813: Resource not available for anonymous access. Client authentication required.\r\n at Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.Common.VssHttpRetryMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)\r\n at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.Location.Client.LocationHttpClient.GetConnectionDataAsync(ConnectOptions connectOptions, Int64 lastChangeId, CancellationToken cancellationToken, Object userState)\r\n at Microsoft.VisualStudio.Services.WebApi.Location.VssServerDataProvider.GetConnectionDataAsync(ConnectOptions connectOptions, Int32 lastChangeId, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.WebApi.Location.VssServerDataProvider.ConnectAsync(ConnectOptions connectOptions, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.WebApi.Location.LocationService.CreateDataProviderAsync(String location, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.WebApi.Location.LocationService.ResolveLocationDataAsync(Guid locationAreaIdentifier, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.WebApi.Location.LocationService.GetLocationDataAsync(Guid locationAreaIdentifier, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.WebApi.VssConnection.GetClientInstanceAsync(Type managedType, Guid serviceIdentifier, CancellationToken cancellationToken, VssHttpRequestSettings settings, DelegatingHandler[] handlers)\r\n at Microsoft.VisualStudio.Services.WebApi.VssConnection.GetClientServiceImplAsync(Type requestedType, Guid serviceIdentifier, Func4 getInstanceAsync, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.WebApi.VssConnection.GetClientAsync[T](CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.Content.Common.AsyncHttpRetryHelper1.InvokeAsync(CancellationToken cancellationToken)", “SourceContext”:“ArtifactTool.Commands.UPackDownloadCommand”, “UtcTimestamp”:“2019-12-11 15:24:35.864Z” }Then this one after:{ “@t”:“2019-12-11T15:24:35.9204996Z”, “@m”:“Encountered an unexpected error.”, “@i”:“b8be900d”, “@l”:“Error”, “@x”:"Microsoft.VisualStudio.Services.Common.VssUnauthorizedException: TF400813: Resource not available for anonymous access. Client authentication required.\r\n at Microsoft.VisualStudio.Services.Common.VssHttpMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.Common.VssHttpRetryMessageHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\r\n at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)\r\n at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync(HttpRequestMessage message, HttpCompletionOption completionOption, Object userState, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.WebApi.VssHttpClientBase.SendAsync[T](HttpRequestMessage message, Object userState, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.Location.Client.LocationHttpClient.GetConnectionDataAsync(ConnectOptions connectOptions, Int64 lastChangeId, CancellationToken cancellationToken, Object userState)\r\n at Microsoft.VisualStudio.Services.WebApi.Location.VssServerDataProvider.GetConnectionDataAsync(ConnectOptions connectOptions, Int32 lastChangeId, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.WebApi.Location.VssServerDataProvider.ConnectAsync(ConnectOptions connectOptions, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.WebApi.Location.LocationService.CreateDataProviderAsync(String location, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.WebApi.Location.LocationService.ResolveLocationDataAsync(Guid locationAreaIdentifier, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.WebApi.Location.LocationService.GetLocationDataAsync(Guid locationAreaIdentifier, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.WebApi.VssConnection.GetClientInstanceAsync(Type managedType, Guid serviceIdentifier, CancellationToken cancellationToken, VssHttpRequestSettings settings, DelegatingHandler[] handlers)\r\n at Microsoft.VisualStudio.Services.WebApi.VssConnection.GetClientServiceImplAsync(Type requestedType, Guid serviceIdentifier, Func4 getInstanceAsync, CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.WebApi.VssConnection.GetClientAsync[T](CancellationToken cancellationToken)\r\n at Microsoft.VisualStudio.Services.Content.Common.AsyncHttpRetryHelper1.InvokeAsync(CancellationToken cancellationToken)\r\n at ArtifactTool.DedupManifestArtifactClientProvider.GetDedupManifestArtifactClientAsync(String serviceUrl, String patVar, ILogger commandBaseLogger, IAppTraceSource tracer, CancellationToken cancellationToken) in d:\\a\\1\\s\\src\\ArtifactTool\\Providers\\DedupManifestArtifactClient\\DedupManifestArtifactClientProvider.cs:line 42\r\n at ArtifactTool.Commands.UPackDownloadCommand.ExecuteAsync() in d:\\a\\1\\s\\src\\ArtifactTool\\Commands\\UPack\\UPackDownloadCommand.cs:line 52\r\n at ArtifactTool.Commands.CommandBase.OnExecuteAsync() in d:\\a\\1\\s\\src\\ArtifactTool\\Commands\\CommandBase.cs:line 100\r\n at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.InvokeAsync(MethodInfo method, Object instance, Object[] arguments) in C:\\projects\\commandlineutils\\src\\CommandLineUtils\\Conventions\\ExecuteMethodConvention.cs:line 77\r\n at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.OnExecute(ConventionContext context) in C:\\projects\\commandlineutils\\src\\CommandLineUtils\\Conventions\\ExecuteMethodConvention.cs:line 62\r\n at McMaster.Extensions.CommandLineUtils.Conventions.ExecuteMethodConvention.<>c__DisplayClass0_0.<<Apply>b__0>d.MoveNext() in C:\\projects\\commandlineutils\\src\\CommandLineUtils\\Conventions\\ExecuteMethodConvention.cs:line 25\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass126_0.<OnExecute>b__0() in C:\\projects\\commandlineutils\\src\\CommandLineUtils\\CommandLineApplication.cs:line 505\r\n at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args) in C:\\projects\\commandlineutils\\src\\CommandLineUtils\\CommandLineApplication.cs:line 611\r\n at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute[TApp](CommandLineContext context) in C:\\projects\\commandlineutils\\src\\CommandLineUtils\\CommandLineApplication.Execute.cs:line 57\r\n at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync[TApp](CommandLineContext context) in C:\\projects\\commandlineutils\\src\\CommandLineUtils\\CommandLineApplication.Execute.cs:line 145\r\n at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync[TApp](IConsole console, String[] args) in C:\\projects\\commandlineutils\\src\\CommandLineUtils\\CommandLineApplication.Execute.cs:line 130\r\n at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync[TApp](String[] args) in C:\\projects\\commandlineutils\\src\\CommandLineUtils\\CommandLineApplication.Execute.cs:line 112", "SourceContext":"ArtifactTool.Program", "UtcTimestamp":"2019-12-11 15:24:35.920Z" }

Hi @muru03

A variety of things can be happening during this call so I would like to ask you to go through several steps to help us determine the root of the problem.

1) Use ArtifactTool directly Please follow the following link after filling out the org name and the os-name (os name should be windows or linux): https://vsblob.dev.azure.com/<organization-name>_apis/clienttools/artifacttool/release?osName=<OS-name>&arch=x86_64 . From this request, you will receive a Json structure resembling this:

{ “name”: “artifacttool”, “rid”: “win10-x64”, “version”: “0.2.104”, “uri”: “https://03nvsblobprodwcus014.vsblob.vsassets.io/artifacttool/…” }

Please download ArtifactTool from the returned URI and extract the tool from the zip onto your machine. ArtifactTool currently only supports PAT authentication. Documentation for how to generate a PAT can be find here: https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=preview-page . The PAT scope should contain Packaging permissions (read permissions needed for download, read&write needed for download and publish). The PAT will need to be passed as an environment variable. You will need to pass the environment variable name to a --patvar parameter. The rest of the parameters should be familiar and can be found in the Connect to Feed dialogue.

Ex: $env:ArtifactToolPat=“<pat-goes-here>” .\artifacttool.exe universal download --service <service url> --patvar ArtifactToolPat --feed <feedName> --package-name <packageName> --package-version <version> --path <path to download to> .\artifacttool.exe universal publish --service <service url> --patvar ArtifactToolPat --feed <feedName> --package-name <packageName> --package-version <version> --path <path to file to publish>

If this works, this means that you can access and use ArtifactTool correctly and it isn’t a permissions/local configurations issue. This can be used as a workaround if the following steps don’t work while we continue to investigate.

2) Use the CLI but have the CLI run a local version of the ArtifactTool You will need to set an environment variable leading to the folder containing the ArtifactTool you downloaded in the previous step. The path should be to the folder containing the executable.

Ex. $env:AZURE_DEVOPS_EXT_ARTIFACTTOOL_OVERRIDE_PATH= “<path>\artifacttool\ArtifactTool_win10-x64_0.2.128”

You should be able to use the CLI normally now, the only difference is that it will not attempt to auto update to a newer version of ArtifactTool. Please make sure to have --debug enabled.

3) Use the CLI with automatic download

Remove the environment variable from the previous step and use normal CLI command.

Please let me know which step starts causing errors; any logs you get would be appreciated.