1

All I am trying to do is to run the following command in PS

az webapp config set -g 'appXXX-dfpg-dev4-web-eastus2' -n 'appXXX-dfpg-dev4-web-eastus2-backoffice-apsvc'  --linux-fx-version 'DOCKER|appXXXdeploycr.azurecr.io/dfpg/backoffice:1.0.20184.1'

I am getting back

'appXXXdeploycr.azurecr.io' is not recognized as an internal or external command,
operable program or batch file.

Initialy I though that PS misinterprets | as a pipeline concatination so I escaped it with ` but it didn't help

Alexey Auslender
  • 402
  • 5
  • 18

2 Answers2

1

I know that this answer is late, but for future references I will provide my input. What you are experiencing is pipe (|) being interpreted by PowerShell while parsing the arguments AZ cli. You can force PowerShell to do minimal parsing using the Stop-Parsing symbol --% (see https://learn.microsoft.com/en-us/cli/azure/use-cli-effectively#pass-arguments)

az --% webapp config set -g 'appXXX-dfpg-dev4-web-eastus2' -n 'appXXX-dfpg-dev4-web-eastus2-backoffice-apsvc'  --linux-fx-version 'DOCKER|appXXXdeploycr.azurecr.io/dfpg/backoffice:1.0.20184.1'

This will stop you from using variables in your statement. So another solution is to use escaped quotes around the value you are providing to AZ (see Azure CLI: Unable to escape pipe character (|) in Windows PowerShell)

az webapp config set -g 'appXXX-dfpg-dev4-web-eastus2' -n 'appXXX-dfpg-dev4-web-eastus2-backoffice-apsvc'  --linux-fx-version '"DOCKER|appXXXdeploycr.azurecr.io/dfpg/backoffice:1.0.20184.1"'

And you can even use variables inside your version

$inc = "1"
$version="`"DOCKER|appXXXdeploycr.azurecr.io/dfpg/backoffice:1.0.20184.$inc`""
az webapp config set -g 'appXXX-dfpg-dev4-web-eastus2' -n 'appXXX-dfpg-dev4-web-eastus2-backoffice-apsvc'  --linux-fx-version $version
PhillipK
  • 71
  • 2
0

Az commands are intended for cloud shell usage. Can you try running this command in Azure cloud shell. You can also use "shell.azure.com" to open azure shell in new tab.

  • Thank you for your answer, I am able to run the command from az shell, the problem is that the code that I am showing in my question is a part of automated process that needs to be run using powershell on the build agent as a part of Azure DevOps server release. – Alexey Auslender Jul 07 '20 at 14:33