Azure / azure-policy

Repository for Azure Resource Policy built-in definitions and samples
MIT License
1.52k stars 1.09k forks source link

Alias request: Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile.scheduledEventsProfile.terminateNotificationProfile #1393

Open sdx-jkataja opened 1 month ago

sdx-jkataja commented 1 month ago

Please change the terminateNotificationProfile aliases to modifiable.

We run build jobs on Azure Kubernetes using Spot Virtual Machines. These may be reclaimed as the excess capacity runs out. We would like to receive advance notifications before the nodes are terminated. The spot machines are added as an AKS Node Pool, which is then backed by a VM Scale Set. Scale set has support for termination notifications, but the scale sets created by AKS have the parameter disabled. The node pool resource also does not pass through the parameter to enable termination notifications.

I attempted to enable the notifications by writing an Azure Policy that detects out of policy spot scale sets without the notifications and remedies the issue by enabling the setting. However, I encountered the following error (reformatted):

The policy definition '00000000-0000-0000-0000-000000000000' has operations referring to aliases that are not modifiable: 
'Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile.scheduledEventsProfile.terminateNotificationProfile.enable,
Microsoft.Compute/virtualMachineScaleSets/virtualMachineProfile.scheduledEventsProfile.terminateNotificationProfile.notBeforeTimeout'.Save 

Instructions and sample parameter values on how to enable the notifications with CLI: https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-terminate-notification