37NPN
37NPN

Reputation: 35

Problem in Powershell with the --runtime command setting up Jenkins pipeline

I am trying to configure a Pipeline with Jenkins and deploying it to Azure. I am at the last step of a tutorial:

https://learn.microsoft.com/en-us/azure/jenkins/tutorial-jenkins-deploy-web-app-azure-app-service

This last step is as follows, i have to enter this in the Azure CLI:

az group create --name yourWebAppAzureResourceGroupName --location region
az appservice plan create --name appServicePlanName --resource-group rgname --is-linux
az webapp create --name webAppName --resource-group rgName --plan appServicePlanName --runtime "java|1.8|Tomcat|8.5"

The last command gives me the error:

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

So I thought maybe Tomcat is not installed on my Azure VM, which is a Linux machine. So I used the next tutorial to install Tomcat:

https://www.howtoforge.com/tutorial/how-to-install-apache-tomcat-8-5-on-ubuntu-16-04/

After this I tried to do the --runtime command again, but I still get the same error. I have no idea how to fix this. I hope someone can help me with this problem.

I tried to check the webapp list-runtimes and I get this list:

enter image description here

"java|1.8|Tomcat|8.5" is in here. I've tried all of the versions, but it did not work.

EDIT: It works in the Azure Cloud Shell, but then there is another error:

Linux Runtime 'java|1.8|Tomcat|8.5' is not supported.Please invoke 'list-runtimes' to cross check

I have tried all the runtime versions, but still this error. I have also tried it with double quotes

Upvotes: 1

Views: 900

Answers (2)

kim
kim

Reputation: 3421

I bet you solved your problem already, but in case others find this and are using PowerShell to run Azure CLI commands. This is what worked for me.

The problem is in how PowerShell interprets the pipe, '|', character inside the --runtime parameter, when evaluating the whole line.

Add the --% to be beginning of the command to turn off PowerShell evaluation of expressions, as suggested in the code block here.

Note: this will also stop PowerShell from evaluating any variables inside the command. What you can do is move the --runtime to the end of the line to get around this problem, e.g. like this

az webapp create -g $rg -p $appPlanName -n $appName --deployment-local-git --% --runtime "DOTNETCORE|3.0"

Upvotes: 5

4c74356b41
4c74356b41

Reputation: 72176

ok, i got it, that list is for windows webapp, not linux. for linux use:

az webapp list-runtimes --linux

so working solution:

az webapp create --name yourWebAppName --resource-group yourWebAppAzureResourceGroupName --plan yourLinuxAppServicePlanName --runtime "TOMCAT|8.5-jre8" 

Upvotes: 1

Related Questions