Cost Optimization on Azure App Service Plan

Santanu Dutta
Dev Genius
Published in
3 min readMay 28, 2020

--

Most of the companies in the world are doing cost cutting after the COVID-19 pandemic. So at this point of time if we can reduce company’s Azure expenditure, it would be great value add. I tried the below listed methods and that reduce our non-production environment azure cost by 40% per month, that also with minimum impact . It will not required to do any changes in the pipelines and implementation of these methods will it be pretty fast .

Optimize Azure Cost

Handling Unused and Unnecessary Resources Impacting Azure Costs.

As we keep on creating new apps , our environment grows, and we do replace one azure resource with another. It is pretty common we do not delete the old one as we might need to revert our changes. We Identified those resources in our subscription which we were unsure of their use. There are resources which are consistently used, sometimes used and never used. We identified those which can be deleted without impacting business, development and testing activity. This includes deleting Windows App Service Environments, App Service Plan, Application Insights, Deployment Slots which are not in use across environments. Before deletion we have multiple reviews by team members to make sure it does not cause any issue.

2. Vertical Scaling of App Service Plans.

The vertical scaling of App Service Plans are number of few manual steps that would require to scale a resource up or down. During the scaling down process, all resources have their current Tier and Size saved to Azure Storage table. This allows the scaling up script to know what to set the resources back to once executed. This scaling operation implemented on only App Service Plans for Non-Prod environments. It is not recommended to install this in a production environment. If you have your Dev or QA environment similar to production , you will be paying a premium price for an environment that does not have the same 100% up-time requirement. So you can scale down your apps in Basic or Shared plan in off work hours and scale up again during work hours. App Service Plans can also be added as exception if there is any active development/testing activity going on. It can also be scheduled in Azure automation account as a run book so that it will be running twice every day.

3. Horizontal Scaling of App Service Plans:

All non-prod app service plans are scaled in to one instance according to the application type. Those can be easily scale out to any number if required. A PowerShell job running at the end of the day to update the count to 1 even if there is any deployment happened during work hours.

4. App Consolidation :

Multiple app services are getting consolidated in single app service plan if possible. In that case the app service needs to have multiple instances or higher SKU. For the time being we implemented this using power shell without impacting any of the pipelines.

5. Reducing Data Ingestion in Application Insights :

There are few Azure Log Analytics that have a huge data ingestion due to load balancer monitoring. It includes Exception Logging, remote dependency, message logging, event logging, request logging and metric.

6. Reducing Data Sampling in Application Insights.

Default ingestion data sampling is set to retain all data received, but you may change data sampling at any time.

--

--