0

I'm trying to create some resources using the AzureCLI@2 pipeline task. I'm creating a resource group, followed by a linux app service plan then trying to create a webapp that uses the app service plan. This is my task...

  - task: AzureCLI@2
    displayName: Create resources
    inputs:
      azureSubscription: ${{parameters.serviceConnectionName}}
      scriptType: ps
      scriptLocation: inlineScript
      inlineScript: | #I cannot get a linux webapp to work! ARGHHHH!
        az group create --location ${{parameters.location}} --name $(resourceGroup)
        az configure --defaults group=$(resourceGroup) location=${{parameters.location}}

        az appservice plan create -n $(appServicePlan) --sku ${{parameters.appPlanSku}} --is-linux

        az webapp create --name $(AppServiceName) --plan $(appServicePlan) --runtime --% "DOTNETCORE|5.0"

This is the error I receive:

ERROR: Linux Runtime 'DOTNETCORE|5.0' is not supported. Please invoke 'az webapp list-runtimes --linux' to cross check

running az webapp list-runtimes --linux gives me

az webapp list-runtimes --linux
[
  "RUBY|2.5.5",
  "RUBY|2.6.2",
  "NODE|14-lts",
  "NODE|12-lts",
  "NODE|10-lts",
  "NODE|10.1",
  "NODE|10.10",
  "NODE|10.12",
  "NODE|10.14",
  "NODE|12.9",
  "PHP|7.2",
  "PHP|7.3",
  "PHP|7.4",
  "DOTNETCORE|2.1",
  "DOTNETCORE|3.1",
  "DOTNETCORE|5.0",
  "TOMCAT|8.5-jre8",
  "TOMCAT|9.0-jre8",
  "JAVA|8-jre8",
  "WILDFLY|14-jre8",
  "JBOSSEAP|7-java8",
  "TOMCAT|8.5-java11",
  "TOMCAT|9.0-java11",
  "JAVA|11-java11",
  "JBOSSEAP|7-java11",
  "PYTHON|3.8",
  "PYTHON|3.7",
  "PYTHON|3.6",
  "STATICSITE|1.0"
]

Whats more frustrating is that this works if I use the Azure CLI locally.

The build agent is a self host windows agent running the latest version of the Azure CLI (upgraded to make sure that wasn't the issue).

Will switch to a windows app service plan for now as I've wasted so much time on this already. Has anybody got any suggestions?

0

1 Answer 1

1

I tested and found it was the Azure CLI version that caused above issue.

I tested with the latest Azure cli version 2.21.0 and 2.20.0. They both failed with above error Linux Runtime 'DOTNETCORE|5.0' is not supported.

However, i can run above commands successfully with Azure CLI 2.8.0

You can try downgrading the azure cli version to 2.8.0 in your self host windows agent.

If you want to use cloud hosted agents. You can run below commands to downgrade the azure cli version on the cloud agent using a powershell task.

steps:
- powershell: |
   choco uninstall azure-cli --version=2.20.0  --force
   choco install azure-cli --version=2.8.0 --force

- task: AzureCLI@2

You can aslo using azure powershell commands to create webapp. See this example.

Sign up to request clarification or add additional context in comments.

2 Comments

ah, its working locally because I'm still using version 2.2.0! I'll not upgrade locally until this is fixed. Do I need to log a bug on github for this issue?
@Phil You can log a bug on github. Hopefully the development team can fix it soon.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.