azure-cli: Webapp create doesn't recognize --runtime value
Describe the bug
The webapp create command does not seem to be parsing the value of the --runtime
argument correctly, because it fails even on a known good value.
If you do az webapp create -h
one of the example commands is az webapp create -g MyResourceGroup -p MyPlan -n MyUniqueAppName --runtime "node|6.2" --deployment-local-git
. I am issuing an almost identical command and it’s failing to parse the “6.2” with error “‘10.6’ is not recognized as an internal or external command”
To Reproduce
Issue the command az webapp create -g pluralsight -p appsvcplan1 -n webapp-1fa8c --runtime "node|10.6" --deployment-local-git
Expected behavior Expected webapp-1fa8c to be created. Instead I get the error “‘10.6’ is not recognized as an internal or external command, operable program or batch file.”
Environment summary Install Method: MSI / CLI version: 2.0.47 / OS version: Windows 10 1809/ Shell Type: PowerShell (with Cygwin commands in path)
Additional context Add any other context about the problem here.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 19 (4 by maintainers)
I had the same problem i found a solution here: https://octopus.com/blog/powershell-pipe-escaping
For me it worked to encapsulating the runtime in ‘“”’ like this: az webapp create -g testgroup -p testplan -n testapp --runtime ‘“node|10.6”’
Putting the escape character in front of that section worked for me:
az webapp create --name $appName --resource-group $resourceGroup --plan $servicePlan --% --runtime "DOTNETCORE|2.2"
The
|
character is being interpreted by your shell. You will need to escape it properly for Powershell since that is processed before the CLI ever sees the input.This was causing me the same problem and I couldn’t find a workable solution until I came accross this: https://stackoverflow.com/questions/66674862/azure-cli-unable-to-escape-pipe-character-in-windows-powershell/66677070#66677070
Replacing the | pipe with the : colon character worked for me using BASH
az webapp create -g resourcegroup
-p plan
-n name
–runtime “NODE:10.14”
Thanks @panchagnula but doing that i can no longer use powershell variables inside the script -.-
az % webapp create --name $appName --resource-group $resourceGroup --plan $servicePlan --runtime "DOTNETCORE|2.2" --debug
this are the parameter passed :
az : DEBUG: Command arguments: [‘webapp’, ‘create’, ‘–name’, ‘amadori-consegne-macellato’, ‘–resource-group’, ‘$resourceGroup’, ‘–plan’, ‘$servicePlan’, ‘–runtime’, ‘DOTNETCORE|2.2’, ‘–debug’]
It’s no longer resolving the variables…
@valeriob apologize I missed a part of the command earlier when trying to copy paste try this
az --% webapp create --resource-group <> --plan <> --name <> --runtime “python|3.4” This is how is used in the cloudShell powershelgl & it seemed to work
Hi @panchagnula, thanks for trying to help, i’ve tried that with no luck…
az % webapp create --name $appName --resource-group $resourceGroup --plan $servicePlan --runtime "DOTNETCORE|2.2"
same resulti tried with [RegEx]::Escape(“DOTNETCORE|2.2”) => and no luck eather i tried “DOTNETCORE|2.2” => not working
does someone have tested this in powershell ?