Thursday 18 June 2020

Azure Web App Creation with Azure CLI --runtime Specification Issues in PowerShell Scripts

PowerShell scripts and Azure CLI is a good combination to use for creating infrastructure as code targeting Azure platform. When creating an Azure app service app on Linux, you need to provide the --runtime argument specifying the web app runtime or the platform of the source code getting deployed. In a PowerShell window the command with --runtime argument fails, since a piping symbol is used in runtime arguments.
Have a look at example below.
az webapp create -n app-chd5-test  -g rg-dotnet5-test -p asp-dotnet5-test --runtime "aspnet|V4.7"

'V4.7' is not recognized as an internal or external command, operable program or batch file.
Issue is caused by the | symbol used in the runtime value as it is special character in PowerShell allowing the piping of values. To prevent the issue, you can use below syntax by enclosing the runtime value with single quotes.

az webapp create -n app-chd5-test  -g rg-dotnet5-test -p asp-dotnet5-test --runtime '"aspnet|V4.7"'

List of runtimes available for windows App Service Apps can be found by executing
az webapp list-runtimes

For Linux with
az webapp list-runtimes --linux

No comments:

Popular Posts