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 31 Reputation points
2023-04-24T13:43:56.4933333+00:00

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,586 questions
{count} votes

2 answers

Sort by: Most helpful
  1. RevelinoB 2,780 Reputation points
    2023-04-24T13:55:41.4133333+00:00

    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,106 Reputation points Microsoft Employee
    2023-04-24T14:00:49.78+00:00

    Hello

    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. https://learn.microsoft.com/en-us/azure/virtual-machines/maintenance-notifications

    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

    Alistair