在 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 门户中,选择“创建资源”。In the Azure portal, select Create a resource.

    在 Azure 门户中创建资源。

  2. 选择“新建” > “Web 应用”或其他类型的应用服务应用。Select New > Web App or another kind of App service app.

    在 Azure 门户中创建应用。

  3. 在配置应用服务计划之前配置“实例详细信息”部分。Configure the Instance Details section before configuring the App Service plan. “发布”和“操作系统”之类的设置可以更改应用服务计划的可用定价层。 Settings such as Publish and Operating Systems can change the available pricing tiers for your App Service plan. “区域”决定了在何处创建应用服务计划。Region determines where your App Service plan is created.

  4. 在“应用服务计划”部分选择一个现有的计划,或者通过选择“新建”创建一个计划。In the App Service Plan section, select an existing plan, or create a plan by selecting Create new.

    创建应用服务计划。

  5. 创建计划时,可以选择新计划的定价层。When creating a plan, you can select the pricing tier of the new plan. 在“SKU 和大小”中选择“更改大小”,以便更改定价层。 In Sku and size, select Change size to change the pricing tier.

将应用移到另一个应用服务计划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.

备注

Azure 会将每个新的应用服务计划部署到部署单元(在内部称为 Web 空间)中。Azure deploys each new App Service plan into a deployment unit, internally called a webspace. 每个区域都可以有许多 Web 空间,但应用只能在相同 Web 空间中创建的计划之间移动。Each region can have many webspaces, but your app can only move between plans that are created in the same webspace. 应用服务环境是一个独立的 Web 空间,因此可以在相同应用服务环境中的计划之间移动应用,但无法在不同应用服务环境中的计划之间移动应用。An App Service Environment is an isolated webspace, so apps can be moved between plans in the same App Service Environment, but not between plans in different App Service Environments.

无法在创建计划时指定所需的 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, search for and select App services and select the app that you want to move.

  2. 从左菜单中选择“更改应用服务计划”。From the left menu, select Change App Service plan.

  3. 在“应用服务计划”下拉列表中,选择要将应用移到其中的现有计划。In the App Service plan dropdown, select an existing plan to move the app to. 下拉列表仅显示与当前应用服务计划位于同一资源组和地理区域的计划。The dropdown shows only plans that are in the same resource group and geographical region as the current App Service plan. 如果不存在此类计划,则默认情况下,你可以创建一个计划。If no such plan exists, it lets you create a plan by default. 也可选择“新建”,以手动方式创建新计划。You can also create a new plan manually by selecting Create new.

  4. 如果创建一项计划,则可选择新计划的定价层。If you create a plan, you can select the pricing tier of the new plan. 在“定价层”中选择现有层,对其进行更改。In Pricing Tier, select the existing tier to change it.

    重要

    若要将应用从高层计划移到低层计划(例如,从 D1 移到 F1),应用可能会在目标计划中丢失某些功能。If you're moving an app from a higher-tiered plan to a lower-tiered plan, such as from D1 to F1, the app may lose certain capabilities in the target plan. 例如,如果应用使用 TLS/SSL 证书,可能会出现以下错误消息:For example, if your app uses TLS/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'.

  5. 完成后,选择“确定”。When finished, select OK.

    应用服务计划选择器。

将应用移到不同的区域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.

重要

克隆具有一些限制。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.

重要

未与任何应用关联的应用服务计划仍会产生费用,因为它们继续保留配置的 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