Module 12: Maintaining Azure Resources

Module 12Level 4Azure Operations Administrator

Maintaining Azure Resources

Patching, updates and automation·45 minutes

Azure Update ManagerMaintenance configurationsAzure AutomationRunbooksAzure Cost Management+4 more
The situation

Three months in — keeping things running

Three months after the first deployment, Snips has a growing number of Azure resources. The Finance team has noticed the Azure bill is higher than expected. Several VMs have not been patched in six weeks. And the team is spending too much time on repetitive manual tasks.

This module covers the operational discipline of running an Azure environment: patching, automation, cost management and using Azure Advisor to continuously improve.

What you will learn

Azure Update Manager
Maintenance configurations
Azure Automation
Runbooks
Azure Cost Management
Budgets and alerts
Cost analysis
Azure Advisor
Resource health

Azure Update Manager

Azure Update Manager provides a unified view of update compliance across all VMs in your subscription and can automatically install updates on a schedule you define.

Assessment

Scans VMs for missing updates and reports compliance status. Can be triggered on demand or run on a schedule.

Maintenance configuration

Defines when updates are installed: the schedule, patch classifications (critical, security, definition updates) and reboot policy.

Patch classifications

Critical, Security, UpdateRollup, FeaturePack, ServicePack, Definition, Tools, Updates. Most environments patch Critical and Security automatically.

Reboot policy

Controls whether VMs reboot automatically after patching. Options: Always reboot, Never reboot, Reboot if required.

Configure a maintenance window during off-peak hours (e.g. Sunday 02:00–04:00) for automatic patching. Use separate maintenance configurations for different tiers — patch dev/test first, then production a week later, so you catch any issues before they affect production.

Azure Automation

Azure Automation runs PowerShell and Python scripts (runbooks) on a schedule or in response to events. Common use cases include starting and stopping VMs outside business hours, cleaning up old resources and rotating credentials.

Runbook

A script (PowerShell, Python or graphical) that automates a task. Can be triggered manually, on a schedule or by a webhook.

Schedule

Defines when a runbook runs — once, hourly, daily, weekly or monthly. Multiple schedules can be linked to the same runbook.

Hybrid Runbook Worker

Runs runbooks on on-premises machines or VMs, not just in the Azure cloud. Useful for tasks that need to interact with on-premises systems.

Use managed identities for Automation Account authentication — not Run As accounts (which are being retired). Assign the managed identity only the RBAC roles it needs to perform its tasks, following least-privilege principles.

Azure Cost Management

Azure Cost Management provides tools to understand, monitor and optimise your Azure spend. It is available to all Azure customers at no additional cost.

Cost analysis

Interactive charts showing spend by resource, resource group, service, location or tag. Filter by date range and export to CSV.

Budgets

Set a spending limit and configure alerts at percentage thresholds (e.g. 80%, 100%). Budgets alert but do not stop spending.

Cost alerts

Notifications when actual or forecast spend crosses a budget threshold. Sent by email to configured recipients.

Recommendations

Cost optimisation suggestions from Azure Advisor, including right-sizing underutilised VMs and purchasing reservations.

Tag every resource with at minimum CostCentre, Project and Environment tags. This allows you to filter Cost Analysis by these dimensions and allocate costs accurately to business units. Enforce tagging with Azure Policy (Module 4).

Azure Advisor

Azure Advisor analyses your Azure usage and configuration and provides personalised recommendations across five categories:

Cost

Right-size or shut down underutilised VMs, purchase reservations for predictable workloads, delete unused resources.

Security

Recommendations from Defender for Cloud — enable MFA, apply missing patches, restrict network access.

Reliability

Improve availability — enable backups, use availability zones, configure health probes on load balancers.

Operational excellence

Improve operations — enable monitoring, use infrastructure as code, follow naming conventions.

Cost management and automation CLI

bash
# Check update compliance for a VM
az maintenance update list \
  --resource-group rg-compute-prod-uks-001 \
  --resource-name vm-contractordocportal-prod-uks-001 \
  --resource-type virtualMachines \
  --provider-name Microsoft.Compute

# Create a budget with alert at 80%
az consumption budget create \
  --budget-name budget-snips-monthly \
  --amount 10000 \
  --time-grain Monthly \
  --start-date 2026-11-01 \
  --end-date 2027-12-31 \
  --category Cost \
  --notifications "[{"enabled":true,"operator":"GreaterThan","threshold":80,"contactEmails":["azure-admin@snipshousing.co.uk"]}]"

# Create an Automation Account
az automation account create \
  --name aa-snips-prod-uks-001 \
  --resource-group rg-automation-prod-uks-001 \
  --location uksouth \
  --sku Basic
Hands-on lab: Operational maintenance
  1. 1.Run an on-demand update assessment on the Contractor Document Portal VM.
  2. 2.Create a maintenance configuration to install critical and security patches every Sunday at 02:00.
  3. 3.Create a monthly budget of £10,000 with alerts at 80% and 100%.
  4. 4.Review Cost Analysis and identify the top 3 most expensive resources.
  5. 5.Review Azure Advisor recommendations and implement at least one cost recommendation.
  6. 6.Create an Automation Account and write a runbook that lists all VMs in the subscription.

1.Snips wants to ensure all VMs receive OS security patches within 48 hours of release, without manual intervention. Which service manages this?

2.The Snips Azure spend has increased unexpectedly. Which tool shows a breakdown of costs by resource, resource group and service over the past 30 days?

3.You want to receive an email alert when the Snips Azure spend exceeds £8,000 in a month. What do you create?

4.Azure Advisor has flagged that the Contractor Document Portal VM is underutilised (average CPU below 5% for 14 days). What does Advisor recommend?

5.What is the purpose of an Azure Automation runbook?

Module summary

The Snips environment is now properly maintained. Patching is automated, costs are monitored with budget alerts, and Azure Advisor is providing continuous improvement recommendations. The team spends less time on manual tasks and more time on value-adding work.

Ready to mark this module complete?

Mark complete when you have read all sections, attempted the lab and completed the knowledge check.

AZ-104 objectives covered
  • Monitor and maintain Azure resources