How do I scale an Azure App Service instance size up or down on a schedule?

With automatic scaling of the Azure App Service, I can only find below.

Scale a web application in Azure App Service

This allows you to scale more or less instances. This does not allow you to scale larger and smaller instances.

I want to plan the size of the application instance from small, medium and large according to schedule. Is there an API that will allow me to do this?

Thank you very much.

+5
source share
6 answers

Unfortunately, there is currently no way to scale the size of an Azure App Service instance (i.e. the pricing levels of an application service plan ) in a schedule.

Currently, Azure App Service only supports horizontal scaling (i.e., scaling the instance counter) on a schedule, but not for scaling up (i.e. scaling the instance size).

Hope this helps!

+4
source

In fact, you can automatically scale (vertically, i.e. change the service plan), as well as outside (instance account).

The scaling option exists forever and allows you to configure rules (for example, the CPU exceeds%, the memory exceeds the threshold value, etc.)

The scaling option requires the use of Azure Automation. It is fully documented here.

Hope this helps!

+4
source

There is no easy way to do this.

However, if you want to write some code, you can use the PowerShell api with Azure Automation to create this function for yourself.

You must use apis to check metrics (e.g. CPU) every X minutes, and if the CPU is higher than Y, it scales to the next larger instance. If it is below your threshold, then zoom out.

+1
source

Using powershell, you can switch the application maintenance plan for the web application as follows

PS C:\> $Resource = Get-AzureRmResource -ResourceType "microsoft.web/sites" -ResourceGroupName "ResourceGroup11" -ResourceName "ContosoSite" PS C:\> $Resource.Properties.ServerFarmId = "/subscriptions/{subscr_id}/resourceGroups/FriendsRGrp/provider s/Microsoft.Web/serverfarms/FriendsPlan" PS C:\> $Resource | Set-AzureRmResource -Force 

Here, the server farm identifier is nothing more than the identifier of the service plan resource, which you can get from the new portal by viewing the properties of the plan.

You can have two service plans, one with a basic one and the other with a standard one. Then you can switch to standard on weekdays and switch to basic on weekends using Azure Automation.

I understand that you need to change the existing plan itself, and not switch between plans. I think it should be possible, although I have not tried it myself. But if you look at the properties returned in the Resource.Properties of the returned Azure web application resource, as described above, you can figure it out.

+1
source

I think you're looking for AutoScale Azure WebApp on a schedule or metrices type CPU

1.Use your Standard hosting plan, you cannot configure automatic scaling below the standard level.

2. Open the Azure preview portal on portal.azure.com.

3. Portal preview: the correct setting for this will be to use the "percentage of processor"

4.Azure Portal you set the Scale by metrics from None to CPU

5.Set Instance is counted from 1 to 4 or 8, you can change it later, you can go to 10.

For more information, you can refer to this article http://blogs.msdn.com/b/devschool/archive/2015/05/24/azure-webjobs.aspx This article does not discuss scheduled scaling, which I think , you can find out as soon as you get there. Make sure you use portal.azure.com

0
source

Due to the lack of a simple solution, I created a one-click deployment to accomplish what you ask.

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

overview

My approach uses Azure automation modules. With the one-click deployment method, you can fully get started in minutes. Two complementary launch books (ScaleAppServicePlansUp and ScaleAppServicePlansDown) work together to store, read and modify any service plans for the applications you choose. The primary goal for these Runbooks is non-production environments.

Unfortunately, the code is too long to be included in this answer (so yes, it will be basically a link-only answer).

Pseudo code

Reduce

 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. 

Zoom in

 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. 

Additional Resources

0
source

Source: https://habr.com/ru/post/1237378/


All Articles