0
votes

I have installed the latest version of Azure CLI on my windows 2019 self hosted agent. Output when checking for version.

PS C:\Users\blahblah> az --version
azure-cli                          2.3.1

command-modules-nspkg              2.0.3
core                               2.3.1
nspkg                              3.0.4
telemetry                          1.0.4

Extensions:
azure-devops                      0.18.0

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\builduser\.azure\cliextensions'

Python (Windows) 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 02:47:15) [MSC v.1900 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal



Your CLI is up-to-date.

Then when running the same script in devops azure pipeline release :

2020-04-18T03:50:14.3974844Z ##[debug]which 'az'
2020-04-18T03:50:14.3981389Z ##[debug]found: 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd'
2020-04-18T03:50:14.3981785Z ##[debug]which 'az'
2020-04-18T03:50:14.3985125Z ##[debug]found: 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd'
2020-04-18T03:50:14.3988433Z ##[debug]C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd arg: --version
2020-04-18T03:50:14.3989115Z ##[debug]C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd arg: --version
2020-04-18T03:50:14.3998697Z ##[debug]exec tool: C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd
2020-04-18T03:50:14.3998969Z ##[debug]exec tool: C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd
2020-04-18T03:50:14.3999139Z ##[debug]arguments:
2020-04-18T03:50:14.3999314Z ##[debug]arguments:
2020-04-18T03:50:14.4000072Z ##[debug]   --version
2020-04-18T03:50:14.4000425Z ##[debug]   --version
2020-04-18T03:50:14.4017396Z [command]C:\windows\system32\cmd.exe /D /S /C ""C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" --version"
2020-04-18T03:50:17.1212688Z azure-cli                          2.3.1
2020-04-18T03:50:17.1213010Z 
2020-04-18T03:50:17.1213120Z command-modules-nspkg              2.0.3
2020-04-18T03:50:17.1213248Z core                               2.3.1
2020-04-18T03:50:17.1213345Z nspkg                              3.0.4
2020-04-18T03:50:17.1213451Z telemetry                          1.0.4
2020-04-18T03:50:17.1213507Z 
2020-04-18T03:50:17.1213631Z Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
2020-04-18T03:50:17.1214799Z Extensions directory 'C:\windows\ServiceProfiles\NetworkService\.azure\cliextensions'
2020-04-18T03:50:17.1214873Z 
2020-04-18T03:50:17.1215003Z Python (Windows) 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 02:47:15) [MSC v.1900 32 bit (Intel)]
2020-04-18T03:50:17.1215081Z 
2020-04-18T03:50:17.1215191Z Legal docs and information: aka.ms/AzureCliLegal
2020-04-18T03:50:17.1215271Z 
2020-04-18T03:50:17.1215320Z 
2020-04-18T03:50:17.1215369Z 
2020-04-18T03:50:17.1215468Z Your CLI is up-to-date.
2020-04-18T03:50:17.1215525Z 
2020-04-18T03:50:17.1215623Z Please let us know how we are doing: https://aka.ms/clihats

Notice how the release pipeline does not show that I have the azure-devops extension installed. I need this extension to remotely trigger a pipeline release creation. I've tripled and quadrupled check that I am comparing the same server.

My next step would be to add a step to install the Azure CLI extension before calling the az pipelines. However I would rather try to figure out why this is not working. I have make this same call locally and it works fine. However I log in as myself instead of using a service principal/service subscription when testing same call locally.

Has anyone run into this issue and know whats going on here? Any suggestion would be greatly appreciated.

1

1 Answers

1
votes

I found that the Extensions directory is inconsistent in your local and release pipeline.

In local:

Extensions directory 'C:\Users\builduser\.azure\cliextensions'

In release pipeline log :

Extensions directory 'C:\windows\ServiceProfiles\NetworkService\.azure\cliextensions'

If you are using a private agent, the Extensions directory should be consistent:

enter image description here

enter image description here

So you need to check the following points:

1.The machine where you installed az cli is the same machine as the agent you use to run the pipeline.

2.According to the directory path, check the installation of azure cli.