Azure / Azure/azure-cli

Unable to perform pipe within Azure CLI task in Azure Devops

Open
#19,665 3 comments 0 reactions 1 assignee Claimed by @zhoxing-ms View on GitHub
act-identity-squad ARM customer-reported feature-request
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

I am running the following command from Azure CLI in Azure portal, and it works.

`az resource list -g RG_SE_Polisen_Dev --query "[?type=='Microsoft.Storage/storageAccounts'].name" --output tsv | xargs -n 1 -t -I "{}" az lock delete -n "DevTestLabs Lock" -g RG_SE_Polisen_Dev --resource "{}" --resource-type "Microsoft.Storage/storageAccounts"
`

Running the same command via Azure CLI task in Azure Devops pipelines for automation, getting the following error:

`E:\agent_1\_work\r30\a>az resource list -g RG_SE_Polisen_Dev --query "[?type=='Microsoft.KeyVault/vaults'].name" --output tsv | xargs -n 1 -t -I '{}' az lock delete -n "DevTestLabs Lock" -g RG_SE_Polisen_Dev --resource '{}' --resource-type "Microsoft.KeyVault/vaults"
2021-09-23T07:31:36.4258125Z az lock delete -n DevTestLabs Lock -g RG_SE_Polisen_Dev --resource SEDEVDTL9342
2021-09-23T07:31:36.4258390Z --resource-type Microsoft.KeyVault/vaults
2021-09-23T07:31:37.8440554Z ERROR: Operation returned an invalid status 'Bad Request'
2021-09-23T07:31:37.9668128Z ##[error]Script failed with error: Error: E:\agent_1\_work\_temp\azureclitaskscript1632382287742.bat failed with return code: 123`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.