如何按计划扩展或缩小Azure App Service实例大小?

Jac*_*sch 6 azure autoscaling azure-web-sites azure-app-service-plans

在自动扩展Azure App Service时,我只能找到以下内容.

在Azure App Service中扩展Web应用程序

这仅允许扩展到更多或更少的实例.它不允许扩展到越来越大的实例.

我想按计划安排小型,中型和大型之间的应用服务实例大小.是否有API可以让我这样做?

非常感谢你.

jra*_*rap 5

由于缺乏简单的解决方案,我创建了一个一键部署来执行您所要求的操作。

https://github.com/jraps20/jrap-AzureVerticalScaling

概述

我的方法使用 Azure 自动化 Runbook。通过一键部署方法,您可以在几分钟内完全启动并运行。两个互补的 Runbook(ScaleAppServicePlansUp 和 ScaleAppServicePlansDown)协同工作来存储、读取和修改您选择的任何应用服务计划。这些 Runbook 的主要目标是非生产环境。

不幸的是,代码太长,无法包含在这个答案中(所以是的,这主要是一个仅链接的答案)。

伪代码

缩小

Iterate across all Resource Groups (or pass in specific one)
Iterate across all App Service Plans (or pass in specific one)
Iterate across all App Services (identify Tier-specific settings)

During iteration, the current App Service Plan Service Tier is stored in Azure Automation Variables (3 distinct variables for each App Service Plan)

Within each App Service Plan, each App Service is iterated to identify tier-specific settings. Some of these settings include: AlwaysOn, Use32BitWorkerProcess, and ClientCertEnabled. All current settings are stored in Azure Automation Variables.

All App Service Plans are then scaled down to the FREE tier.
Run Code Online (Sandbox Code Playgroud)

放大

Iterate across all Resource Groups (or pass in specific one)
Iterate across all App Service Plans (or pass in specific one)
Iterate across all App Services (identify Tier-specific settings)

During iteration, the original App Service Plan Service Tier is retrieved from Azure Automation Variables (3 distinct variables for each App Service Plan)

Within each App Service Plan, each App Service is iterated and any previously stored tier-specific settings are retrieved.

All App Service Plans are then scaled up to their original tier.
All App Services with tier-specific settings are reapplied to their original values.
Run Code Online (Sandbox Code Playgroud)

其他资源

免责声明

完成我的工作后,我开始意识到Sam Spoerles 的技术。 与他的方法相比,我的方法的优点如下: