如何查找我在Azure中创建Web应用程序的计划

huangapple go评论66阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年5月14日 19:39:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/76247273.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定