在 Azure 中管理应用服务计划Manage an App Service plan in Azure

Azure 应用服务计划提供应用服务应用需要运行的资源。An Azure App Service plan provides the resources that an App Service app needs to run. 本指南介绍如何管理应用服务计划。This guide shows how to manage an App Service plan.

创建应用服务计划Create an App Service plan

在创建应用时可以创建一个空的应用服务计划,也可以创建一个计划。You can create an empty App Service plan, or you can create a plan as part of app creation.

  1. Azure 门户中,选择“新建” > “Web + 移动”,然后选择“Web 应用”或其他应用服务应用类型。In the Azure portal, select New > Web + mobile, and then select Web App or another kind of App Service app.

  2. 选择现有的应用服务计划,或者为新应用创建计划。Select an existing App Service plan or create a plan for the new app.

    在 Azure 门户中创建应用。

    若要创建计划,请执行以下操作:To create a plan:

    a.a. 选择“[+] 新建”。Select [+] Create New.

    创建应用服务计划。

    b.b. 对于“应用服务计划”,输入计划的名称。For App Service plan, enter the name of the plan.

    c.c. 对于“位置”,选择适当的位置。For Location, select an appropriate location.

    d.d. 对于“定价层”,选择适当的服务定价层。For Pricing tier, select an appropriate pricing tier for the service. 选择“全部查看”以查看其他定价选项,例如“免费”和“共享”。Select View all to view more pricing options, such as Free and Shared. 选择定价层后,单击“选择”按钮。After you have selected the pricing tier, click the Select button.

将应用移到另一个应用服务计划Move an app to another App Service plan

只要源计划和目标计划在_同一个资源组和地理区域_中,就可将应用移到另一个应用服务计划。You can move an app to another App Service plan, as long as the source plan and the target plan are in the same resource group and geographical region.

无法在创建计划时指定所需的 Web 空间,但这可确保计划创建于与现有计划相同的 Web 空间中。You can't specify the webspace you want when creating a plan, but it's possible to ensure that a plan is created in the same webspace as an existing plan. 简而言之,使用同一资源组和区域组合创建的所有计划都部署到同一 Web 空间中。In brief, all plans created with the same resource group and region combination are deployed into the same webspace. 例如,如果你在资源组 A 和区域 B 中创建了一个计划,那么你随后在资源组 A 和区域 B 中创建的任何计划都将部署到同一 Web 空间中。For example, if you created a plan in resource group A and region B, then any plan you subsequently create in resource group A and region B is deployed into the same webspace. 请注意,计划创建之后便不能移动 Web 空间,所以无法通过将计划移至另一个资源组来将其移到与另一个计划“相同的 Web 空间”中。Note that plans can't move webspaces after they're created, so you can't move a plan into "the same webspace" as another plan by moving it to another resource group.

  1. Azure 门户中,浏览到要移动的应用。In the Azure portal, browse to the app that you want to move.

  2. 在菜单上,查找“应用服务计划”部分。On the menu, look for the App Service Plan section.

  3. 选择“更改应用服务计划”以打开“应用服务计划”选择器。Select Change App Service plan to open the App Service plan selector.

    应用服务计划选择器。

  4. 在“应用服务计划”选择器中,选择要将此应用移到的现有计划。In the App Service plan selector, select an existing plan to move this app into.

“选择应用服务计划”页仅显示与当前应用的应用服务计划位于同一资源组和地理区域的计划。The Select App Service plan page shows only plans that are in the same resource group and geographical region as the current app's App Service plan.

每个计划都有自己的定价层。Each plan has its own pricing tier. 例如,将站点从“免费”层移到“标准”层时,分配给站点的所有应用都可使用“标准”层的功能和资源。For example, moving a site from a Free tier to a Standard tier enables all apps assigned to it to use the features and resources of the Standard tier. 但是,将应用从更高的分层计划移到更低的分层计划意味着不再有权访问某些功能。However, moving an app from a higher-tiered plan to a lower-tiered plan means that you no longer have access to certain features. 如果应用使用的功能在目标计划中不可用,则会出现错误,指出哪个正在使用的功能不可用。If your app uses a feature that is not available in the target plan, you get an error that shows which feature is in use that is not available.

例如,如果其中一个应用使用 SSL 证书,你可能会看到此错误消息:For example, if one of your apps uses SSL certificates, you might see this error message:

Cannot update the site with hostname '<app_name>' because its current SSL configuration 'SNI based SSL enabled' is not allowed in the target compute mode. Allowed SSL configuration is 'Disabled'.

在这种情况下,在将应用移到目标计划之前,需要执行以下任一操作:In this case, before you can move the app to the target plan, you need to either:

  • 将目标计划的定价层向上扩展到基本或更高层。Scale up the pricing tier of the target plan to Basic or higher.
  • 删除应用的所有 SSL 连接。Remove all SSL connections to your app.

将应用移到不同的区域Move an app to a different region

运行应用的区域是该应用的应用服务计划所在的区域。The region in which your app runs is the region of the App Service plan it's in. 但是,无法更改应用服务计划的区域。However, you cannot change an App Service plan's region. 如果想要在不同的区域中运行应用,替代方法是使用应用克隆。If you want to run your app in a different region, one alternative is app cloning. 克隆可以复制任何区域的新的或现有的应用服务计划中的应用。Cloning makes a copy of your app in a new or existing App Service plan in any region.

可以在菜单的“开发工具”部分找到“克隆应用”。You can find Clone App in the Development Tools section of the menu.

Important

克隆具有一些限制。Cloning has some limitations. 可以在 Azure 应用服务应用克隆中查看相关信息。You can read about them in Azure App Service App cloning.

缩放应用服务计划Scale an App Service plan

若要提高应用服务计划的定价层,请参阅在 Azure 中纵向扩展应用To scale up an App Service plan's pricing tier, see Scale up an app in Azure.

若要增加应用的实例计数,请参阅手动或自动缩放实例计数To scale out an app's instance count, see Scale instance count manually or automatically.

删除应用服务计划Delete an App Service plan

为了避免产生意外的费用,删除应用服务计划中的最后一个应用时,应用服务默认也会删除该计划。To avoid unexpected charges, when you delete the last app in an App Service plan, App Service also deletes the plan by default. 如果改为选择保留该计划,应将该计划更改为“免费”层,以免产生费用。If you choose to keep the plan instead, you should change the plan to Free tier so you're not charged.

Important

未与任何应用关联的应用服务计划仍会产生费用,因为它们继续保留配置的 VM 实例。App Service plans that have no apps associated with them still incur charges because they continue to reserve the configured VM instances.

后续步骤Next steps