How to get the virtual Machine that are in planned maintenance for azure will impact virtual machine from activity logs or long anlaytics workspace

Rajesh S 26 Reputation points

How to get the virtual Machine that are in planned maintenance for azure will impact virtual machine from activity logs or long anlaytics workspace. inadditiona if we can provide the any azure resource graph that would be very help to us Thanks, Rajesh sura

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,254 questions
{count} votes

2 answers

Sort by: Most helpful
  1. RevelinoB 2,775 Reputation points

    You can use Azure Monitor to retrieve activity logs and monitor the status of your virtual machines during planned maintenance events. To view activity logs for virtual machines that are undergoing planned maintenance, follow these steps: 1)Go to the Azure portal and select the virtual machine that you want to monitor. 2)Click on "Activity log" in the left-hand menu. 3)Apply a filter to the activity log to only show events related to maintenance activities. 4)You can also use the Azure Resource Graph to query for virtual machines that are in planned maintenance I wrote below a query that may be helpful. Resources | where type =~ 'Microsoft.Compute/virtualMachines' | where properties.extended.instanceView.statuses[0].code == 'PowerState/running' | where properties.extended.instanceView.statuses[1].code == 'ProvisioningState/succeeded' | where properties.extended.instanceView.statuses[2].code == 'VmAgentStatus/running' | where properties.extended.instanceView.statuses[3].code == 'GuestAgentStatus/running' | where properties.extended.instanceView.statuses[4].code == 'Maintenance/Planned' | project name, location, resourceGroup, subscriptionId

    0 comments No comments

  2. Alistair Ross 7,101 Reputation points Microsoft Employee


    Planned maintenance that requires a reboot is scheduled in waves. Each wave has different scope (regions).

    • A wave starts with a notification to customers. By default, the notification is sent to the subscription admin and co-admins. You can add more recipients and messaging options like email, SMS, and webhooks, using Activity Log Alerts.
    • Once a notification goes out, a self-service window is made available. During this window, you can query which of your virtual machines are affected and start maintenance based on your own scheduling needs. The self-service window is typically about 35 days.
    • After the self-service window, a scheduled maintenance window begins. At some point during this window, Azure schedules and applies the required maintenance to your virtual machine. The goal in having two windows is to give you enough time to start maintenance and reboot your virtual machine while knowing when Azure will automatically start maintenance.

    In addition to this, you can send the Activity logs into Log Analytics and query the workspace for alerts using KQL, or create workbooks for visualisations.

    I hope this clarifies things