Description
Describe the bug
When applying instance protection to a scale set instance via the Azure portal, the behavior is as expected.
Upon reviewing the instance changes, it is noted that only the etag and protectionPolicy were modified.
However, when executing the recommended Azure CLI command:
az vmss update --resource-group --name --instance-id --protect-from-scale-in true
Additional changes are observed in the instance view.
Further investigation revealed that, besides the modifications to the etag and protectionPolicy, several other elements were altered:
The latestModelApplied status changed from true to false.
The modelDefinitionApplied switched from “VirtualMachineScaleSet” to “VirtualMachine”.
The healthProbe was removed from the networkProfileConfiguration.
Same behavior was noticed making call from C# code using latest version of sdk.
To resolve this issue and update the instance to the latest model, I executed another CLI command:
az vmss update-instances --resource-group --name --instance-id
or equivalent call from C# code using sdk.
Related command
az vmss update --resource-group --name --instance-id --protect-from-scale-in true
Errors
Besides the modifications to the etag and protectionPolicy, several other elements were altered:
The latestModelApplied status changed from true to false.
The modelDefinitionApplied switched from “VirtualMachineScaleSet” to “VirtualMachine”.
The healthProbe was removed from the networkProfileConfiguration.
Issue script & Debug output
Expected behavior
Modification of etag and protectionPolicy only
Environment Summary
az --version
azure-cli 2.65.0 *
core 2.65.0 *
telemetry 1.1.0
Dependencies:
msal 1.31.0
azure-mgmt-resource 23.1.1
Additional context
Customer is setting protection status from c# code using Azure.ResourceManager package