英文:
How to find out my plan to create a web app in Azure
问题
我正在尝试创建一个Web应用,如此处建议的链接。已创建该组。然后,我省略了创建计划的步骤,因为我已经有一个允许我这样做的订阅(我可以通过从GUI创建应用程序并选择要使用的计划/订阅来确认)。
当我执行以下命令时:
az webapp create --resource-group my-group `
--name app-lication `
--plan "Enterprise MSDN Dev Test"
它失败了,因为计划未被识别。我尝试了不同的名称和GUID(当我执行az login
时看到的那些等等),但似乎什么都不起作用。我应该如何获取正确的计划/订阅引用,以便将其作为上述命令的最后一个参数传递?
英文:
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?
答案1
得分: 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.
你最好传递计划的资源标识(ResourceId)而不是名称,这特别适用于计划存在于不同资源组的情况。
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.
问题中提到的计划的命名约定典型于 Azure 订阅。确保您已经正确创建了一个可供使用的应用服务计划。
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
英文:
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
答案2
得分: 1
如评论中所提到的,应用服务计划(App Service Plan)与订阅(Subscription)是不同的。
应用服务计划是一种资源,用于托管您的 Web 应用程序。将其视为一个虚拟机,您可以在其中托管多个 Web 应用程序。
您需要首先使用 az appservice plan create
创建一个新的应用服务计划,并在创建 Web 应用程序时使用其名称/ID。
您可以在此处了解更多信息:https://learn.microsoft.com/en-us/azure/app-service/overview-hosting-plans。
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论