Skip to content

Azure CLI task (v1 and v2) fails due to Az CLI cosmos db commands #12173

@tarikguney

Description

@tarikguney

Required Information

Entering this information will route you directly to the right team and expedite traction.

Question, Bug, or Feature?
Type: Bug

Enter Task Name:
Azure CLI

The following is some of the task information I copied from the version 2.x

2020-01-18T09:58:50.8550617Z ==============================================================================
2020-01-18T09:58:50.8550721Z Task         : Azure CLI
2020-01-18T09:58:50.8550831Z Description  : Run Azure CLI commands against an Azure subscription in a PowerShell Core/Shell script when running on Linux agent or PowerShell/Powershell Core/Batch script when running on Windows agent.
2020-01-18T09:58:50.8550956Z Version      : 2.0.4
2020-01-18T09:58:50.8551014Z Author       : Microsoft Corporation
2020-01-18T09:58:50.8551106Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli

Environment

Azure DevOps

Issue Description

image

When running our release pipeline tasks, Azure CLI -- both v1 and v2 -- fails due to issues like the one in the screenshot above.

The weird thing is that previously I was using az cosmosdb collection list -- command, and it failed because it was deprecated, and the error message said me to use az cosmosdb sql container list -- and it now fails because this command is in preview mode? What type of sorcery is that?

I guess the more appropriate place to post this question would be Azure CLI repo but I am fine with a workaround too. If there is a way to stop such messages to fail my Azure DevOps pipelines, I would take it and leave for a while.

Error Logs

I have copied the lines from the log starting from the line the error first appeared.

2020-01-18T09:59:35.1095251Z az : Command group 'cosmosdb sql' is in preview. It may be changed/removed in a future release.
2020-01-18T09:59:35.1095947Z At D:\a\r1\a\_Repo\cosmos\CreateCosmosResources.ps1:61 char:5
2020-01-18T09:59:35.1096394Z +     az cosmosdb sql container list --database-name $dbName --resource ...
2020-01-18T09:59:35.1097022Z +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-01-18T09:59:35.1097328Z     + CategoryInfo          : NotSpecified: (Command group '...future release.:String) [], RemoteException
2020-01-18T09:59:35.1097635Z     + FullyQualifiedErrorId : NativeCommandError
2020-01-18T09:59:35.1097911Z  
2020-01-18T09:59:35.1530064Z ##[debug]Exit code 1 received from tool 'C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe'
2020-01-18T09:59:35.1537475Z ##[debug]STDIO streams have closed for tool 'C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe'
2020-01-18T09:59:35.1574278Z ##[debug]task result: Failed
2020-01-18T09:59:35.1628106Z ##[error]Script failed with error: Error: The process 'C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit code 1
2020-01-18T09:59:35.1638525Z ##[debug]Processed: ##vso[task.issue type=error;]Script failed with error: Error: The process 'C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit code 1
2020-01-18T09:59:35.1654137Z ##[debug]Processed: ##vso[task.complete result=Failed;]Script failed with error: Error: The process 'C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit code 1
2020-01-18T09:59:35.1655534Z ##[debug]which 'az'
2020-01-18T09:59:35.1692767Z ##[debug]found: 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd'
2020-01-18T09:59:35.1693188Z ##[debug]which 'az'
2020-01-18T09:59:35.1803310Z ##[debug]found: 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd'
2020-01-18T09:59:35.1803736Z ##[debug]C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd arg:  account clear
2020-01-18T09:59:35.1814650Z ##[debug]C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd arg:  account clear
2020-01-18T09:59:35.1817968Z ##[debug]exec tool: C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd
2020-01-18T09:59:35.1818855Z ##[debug]exec tool: C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin\az.cmd

Some other pieces from the log

I found this interesting so decided to copy these lines here too. They simply show a warning as well as the current Azure CLI and some other binary versions:

2020-01-18T09:59:09.4959225Z WARNING: You have 2 updates available. Consider updating your CLI installation. Instructions can be found at https://docs.microsoft.com/en-us/cli/azure/install-azure-cli
2020-01-18T09:59:09.4960353Z azure-cli                         2.0.78 *
2020-01-18T09:59:09.4967175Z 
2020-01-18T09:59:09.4967572Z command-modules-nspkg              2.0.3
2020-01-18T09:59:09.4967775Z core                              2.0.78 *
2020-01-18T09:59:09.4967980Z nspkg                              3.0.4
2020-01-18T09:59:09.4968182Z telemetry                          1.0.4
2020-01-18T09:59:09.4968327Z 
2020-01-18T09:59:09.4968485Z Extensions:
2020-01-18T09:59:09.4968676Z azure-devops                      0.16.0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions