skip to Main Content

I’m trying to create a webapp as suggested here. The group is created. Then, I omit the step of creating a plan, since I already have a subscription allowing me to do that (which I can confirm by creating the app from the GUI and picking which plan/subscription I want to use).

When I execute

az webapp create --resource-group my-group `
                 --name app-lication `
                 --plan "Enterprise MSDN Dev Test"

it fails, since the plan isn’t recognized. I tried with different names and GUIDS (those I see when I az login, for instance etc.) but nothing seems to work out. How do I obtain the correct referece to my plans/subscriptions so I can pass it as the last parameter in the command above?

2

Answers


  1. It’s going to be more reliable to pass the Plan ResourceId than the name, this specifically caters for scenarios when the plan exists in a different resource group.

    The naming convention of your plan in the question is typical of an Azure Subscription. Ensure you do have a properly created App Service Plan to use.

    AppServicePlanID=$(az appservice plan show -n SharedAppServicePlan -g MyASPRG --query "id" --out tsv) 
    az webapp create -g MyResourceGroup -p "$AppServicePlanID" -n MyUniqueAppName
    

    https://learn.microsoft.com/en-us/cli/azure/webapp?view=azure-cli-latest#az-webapp-create-examples

    Login or Signup to reply.
  2. As mentioned in comments, an App Service Plan is different from a Subscription.

    An App Service Plan is a kind of resource which will host your web apps. Think of it as a VM where you can host multiple web apps.

    What you have to do is first create a new App Service Plan using az appservice plan create and use its name/id when creating web app.

    You can learn more about it here: https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search