Azure-cli: Webapp create doesn't recognize --runtime value

Created on 18 Nov 2018  路  13Comments  路  Source: Azure/azure-cli

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.

Most helpful comment

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"'

All 13 comments

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.

The issue appears to be in bash as well

i'm facing the same issue in powershell
az webapp create --name --resource-group $resourceGroup --plan $servicePlan --runtime "DOTNETCORE|2.2"
output : '2.2' is not recognized as an internal or external command
i've tried with "DOTNETCORE`|2.2" but nothing...
can you show us how to do it properly ?
Thanks

The problem is that PowerShell tries to interpret this as PowerShell specific & I means something else in PowerShell. Try escaping the command using % at the start like below

% webapp create --resource-group RGName--plan PlanName --name AppName --runtime "python|3.4"

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 result

i 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 ?

@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

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....

In that case try to escape just the pipe character using ^ - did you already try this?

az webapp create --name $appName --resource-group $resourceGroup --plan $servicePlan --runtime "DOTNETCORE^|2.2"

yep i've tried
az webapp create --name $appName --resource-group $resourceGroup --plan $servicePlan --runtime "DOTNETCORE^|2.2"
but it still results in a

az : '2.2' is not recognized as an internal or external command

how do ppl make scripts with this thing :(

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"

That is really nasty, can you please change that pipe into something more valid such as an underscore or space. These values are most likely fixed (enum) values on your side anyways, so what is the point of using a special character like a pipe, it is really bad practice.

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"

doesn't work for me :(

az webapp create --name $webApp --resource-group $resourceGroup --plan $appServicePlan --deployment-local-git --% --runtime "aspnet|V4.7"

leads to the following error:

The command failed with an unexpected error. Here is the traceback:

update_site_config() takes 2 positional arguments but 3 were given
Traceback (most recent call last):
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-3pnsb50r\knack\knack\cli.py", line 206, in invoke
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-3pnsb50r\azure-cli-core\azure\cli\core\commands\__init__.py", line 608, in execute
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-3pnsb50r\azure-cli-core\azure\cli\core\commands\__init__.py", line 666, in _run_jobs_serially
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-3pnsb50r\azure-cli-core\azure\cli\core\commands\__init__.py", line 657, in _run_job
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-3pnsb50r\azure-cli\azure\cli\command_modules\appservice\commands.py", line 55, in _polish_bad_errors
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-3pnsb50r\azure-cli-core\azure\cli\core\commands\__init__.py", line 636, in _run_job
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-3pnsb50r\azure-cli-core\azure\cli\core\commands\__init__.py", line 306, in __call__
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-3pnsb50r\azure-cli-core\azure\cli\core\__init__.py", line 493, in default_command_handler
  File "C:\Users\VSSADM~1\AppData\Local\Temp\pip-install-3pnsb50r\azure-cli\azure\cli\command_modules\appservice\custom.py", line 135, in create_webapp
TypeError: update_site_config() takes 2 positional arguments but 3 were given

PowerShell version: 5.1.17134.858

Give us a workaround please... How ppl use azure cli in scripts?!

Update: I realized that this issue is connected with Powershell only, but anyway, still need a solution :)

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"'

Was this page helpful?
0 / 5 - 0 ratings