question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
tejasd1990commented, Jan 21, 2020

The only way I am able to repro the error you are getting is if the standard error stream is redirected to the standard output stream, i.e. with the command (az sql container list --account-name “<ACCOUNT NAME>” --database-name “<DATABASE NAME>” --resource-group “<RESOURCEGROUP NAME>”) 2>&1 Can you let me know whether your scenario is like this? If this is your scenario, then this is an issue we had investigated earlier. The problem is with the powershell version on hosted windows 2019 agent. Once it is upgraded to a sufficient version, this issue will be resolved. Meanwhile, the workaround would be either to use hosted windows 2017 agent, or uncheck the ‘Fail on Standard Error’ option and rely on exit codes instead.

0reactions
gsscodercommented, May 12, 2020

It happens the same with webapp config access-restriction.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release notes & updates – Azure CLI - Microsoft Learn
Learn about the latest Azure Command-Line Interface (CLI) release notes and updates for both the current and beta versions of the CLI.
Read more >
Azure CLI execution: Script failed with error
I'm trying to create an Azure CosmosDB using Azure CLI. In the pipeline, a task for Azure CLI has been created. When the...
Read more >
Azure CLI 1.0 Vs 2.0 Compared, Installation And Usage
The Azure CLI is the cross-platform, command-line tool for managing ... Azure CLI 2.0 and the commands start with az instead of azure...
Read more >
azure-cli 2.20.0 - PyPI
Microsoft Azure Command-Line Tools. ... az login : Launch browser in WSL 2 (#16556) ... az cosmosdb create/update : Improve error message from...
Read more >
Taking Azure Container Apps for a spin - baeke.info
Trying the curl command will result in an error because Dapr wants to use strong consistency with Cosmos DB and we configured it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found