Yes, you can receive notifications before shutting down a virtual machine (VM) in Azure. Here are a few ways to achieve this:
1. Auto-Shutdown Notifications: Azure provides an auto-shutdown feature for VMs, which allows you to schedule a shutdown time and receive notifications before the shutdown. You can enable notifications by selecting "Yes" in the "Send notification before shutdown" option and specifying an email address or webhook URL. Users will receive a notification 30 minutes before the scheduled shutdown, giving them options to postpone the shutdown for 60 minutes, 120 minutes, or skip it for the day[2][5][9].
2. Azure Alerts: While Azure Alerts can notify you when a VM is stopped, they do not inherently provide notifications before a shutdown. However, you can use Azure Logic Apps or similar tools to create custom workflows that send notifications based on specific conditions, such as when a shutdown is scheduled or initiated[1][2].
3. Scheduled Events for Scale Sets: For Virtual Machine Scale Sets, you can enable termination notifications using Scheduled Events. This allows instances to receive notifications before they are terminated, giving them time to prepare. However, this is more relevant to scale set instances rather than individual VM shutdowns[4].
These methods allow you to manage and receive notifications related to VM shutdowns in Azure, ensuring you are informed before a VM is stopped.
Citations:
[1] https://stackoverflow.com/questions/74200229/azure-alert-to-notify-when-a-vm-is-stopped
[2] https://learn.microsoft.com/en-us/azure/devtest-labs/devtest-lab-auto-shutdown
[3] https://support.mydre.org/portal/en/kb/articles/adjusting-the-autoshutdown
[4] https://docs.azure.cn/en-us/virtual-machine-scale-sets/virtual-machine-scale-sets-terminate-notification
[5] https://www.anoopcnair.com/postpone-auto-shutdown-of-azure-vm-using-email/
[6] https://superuser.com/questions/775414/do-i-need-to-shut-down-before-powering-off-a-vm
[7] https://www.youtube.com/watch?v=MZjUQISwplM
[8] https://stackoverflow.com/questions/59476551/how-to-give-an-announce-message-before-forcing-users-to-logoff-on-remote-desktop
[9] https://learn.microsoft.com/en-us/azure/virtual-machines/auto-shutdown-vm