Enterprise Azure Terraform Lab Phase 1 Part 5 : Scaling, Deployment Slots, Diagnostics, and Budget Alerts

๐Ÿ“… Created: 2026-05-02 | โฑ๏ธ Read Time: 3 mins

๐Ÿ“ GitHub Repository: lwc-wk/enterprise-azure-lab1

Enterprise Azure Terraform Lab Phase 1 Part 5 : Scaling, Deployment Slots, Diagnostics, and Budget Alerts

๐Ÿงฉ Background

After the App Service was running, I documented the operational side of the lab.

This part focuses on:

  • App Service Plan scaling
  • Deployment slot strategy
  • Diagnostic settings
  • Log forwarding into Log Analytics
  • Resource Group budget alerts

The important point is cost control.

Some Azure features are useful to understand but too expensive to leave running in a small lab. So I validated and documented the workflow, then scaled down or kept optional templates disabled.


๐Ÿ“ˆ App Service Plan Scaling

There are three different scaling concepts.

Scale Up / Scale Down

This changes the pricing tier.

Example:

F1 โ†’ B1 โ†’ F1

This is useful for demonstrating cost-aware scaling.

Screenshot

Screenshot

Screenshot

Scale Out / Scale In

This changes instance count.

Example:

1 instance โ†’ 2 instances โ†’ 1 instance

Autoscale

Autoscale changes instance count automatically based on metrics.

The lab includes an optional disabled template:

infra/autoscale.tf.disabled

It is disabled by default to avoid unnecessary cost.

Screenshot

Screenshot


๐Ÿ” Deployment Slot Strategy

Deployment slots allow safer releases:

Deploy to staging โ†’ validate โ†’ swap to production

But deployment slots usually require Standard tier or higher.

The lab includes an optional disabled template:

infra/app-service-slot.tf.disabled

Why disabled?

Because the default lab runs on a low-cost tier. Deployment slots are documented as a future enhancement or temporary paid-tier validation.

Screenshot

Screenshot

Screenshot


๐Ÿ“ก Diagnostic Settings

Diagnostic settings connect Azure resources to Log Analytics.

Configured pipelines:

App Service โ†’ Log Analytics Workspace
Storage Blob service โ†’ Log Analytics Workspace

App Service Logs

Enabled categories:

  • AppServiceHTTPLogs
  • AppServiceConsoleLogs
  • AppServiceAppLogs
  • AppServiceAuditLogs
  • AllMetrics

Screenshot

Storage Blob Logs

Enabled categories:

  • StorageRead
  • StorageWrite
  • StorageDelete
  • Transaction metrics

The target is the Blob service:

/storageAccounts/<name>/blobServices/default

not just the Storage Account root.

Screenshot

๐Ÿ’ฐ Resource Group Budget Alert

A Resource Group scoped budget is configured with Terraform.

Budget scope:

rg-infra-dev-azlab2

Budget name:

budget-infra-dev-azlab2

Alert thresholds:

  • 50%
  • 80%
  • 100%

The budget email is stored in:

env/local.secrets.tfvars

This file is not committed.

Example:

budget_alert_emails = ["[email protected]"]

Important:

Budget alerts are not kill switches. They provide cost visibility and warnings.

Screenshot

Screenshot

๐Ÿ“Œ Interview explanation:

I configured a Resource Group scoped budget with Terraform. It supports the destroy-after-validation model and acts as a secondary guardrail against unexpected spending.


๐Ÿงพ Summary

This part adds the operational evidence:

  • App Service scale up and scale down
  • Deployment slot strategy
  • App Service diagnostic settings
  • Storage Blob diagnostic settings
  • Resource Group budget alerts

This is the part that shows I am not just deploying resources. I am thinking about release safety, monitoring, and cost control. Cloud providers love invisible charges; this lab does not love them back.