Welcome to Microsoft Q&A!
Thank you for providing the detailed information and context regarding your environment.
While Availability Sets are designed to reduce the risk of simultaneous maintenance across multiple instances, individual VMs can still be affected by platform maintenance activities such as host reboots, redeployments, or live migrations. To help applications prepare for these events and minimize service impact, this is a recommendation using Azure Scheduled Events, which are exposed through the Azure Instance Metadata Service (IMDS).
Scheduled Events provide advance notifications for upcoming maintenance actions, including:
- Reboot
- Redeploy
- Freeze
- Live Migration
These notifications can be used to trigger proactive actions such as:
- Gracefully failing over to a secondary node
- Draining active connections
- Temporarily removing the VM from a load balancer pool
- Saving application state or checkpoints
- Sending operational alerts to support teams
For VMs that are part of an Availability Set, Scheduled Events are delivered to all VMs within the set. You can identify the affected VM by reviewing the Resources field included in the event payload.
A common implementation approach is:
- Poll the IMDS Scheduled Events endpoint from within the VM.
- Detect events with a status of Scheduled.
- Trigger automation such as Azure Automation runbooks, Logic Apps, scripts, or cluster failover processes.
- Forward event data to Azure Monitor or Log Analytics for centralized monitoring.
- Configure Azure Monitor alerts and Action Groups to send notifications through email, SMS, webhooks, Microsoft Teams, or other supported channels.
In addition to monitoring Scheduled Events from within the VM, it is also recommended to configure Azure Service Health Planned Maintenance alerts. Service Health provides advance notification of planned maintenance at the subscription level and can notify administrators before the maintenance window begins.
Please note that not all platform maintenance operations require a VM reboot. Some activities are performed through live migration and may have minimal impact. However, Scheduled Events remain the recommended mechanism for receiving VM-level maintenance notifications and initiating automated mitigation actions before maintenance occurs.
References: Maintenance and updates - Azure Virtual Machines | Microsoft Learn
Scheduled Events for Windows VMs in Azure - Azure Virtual Machines | Microsoft Learn
Planned maintenance overview - Azure Service Health | Microsoft Learn
Use the portal for maintenance notifications - Azure Virtual Machines | Microsoft Learn
I hope this helps clarify how to proactively monitor and respond to Azure platform maintenance events.
If you find it useful, please click Accept Answer.
Thank you for choosing Microsoft Q&A.