-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Describe the bug
The latest azure cli version fails to update the OS profile with below error.
"ERROR: Couldn't find 'automaticByPlatformSettings' in 'osProfile.windowsConfiguration.patchSettings'. Available options: ['assessmentMode', 'patchMode']
"
Command:
az vm update --resource-group $AzResourceGroup.name
--name $VirtualMachineName --set osProfile.windowsConfiguration.enableAutomaticUpdates=true
osProfile.windowsConfiguration.patchSettings.patchMode=AutomaticByPlatform osProfile.windowsConfiguration.patchSettings.automaticByPlatformSettings.bypassPlatformSafetyChecksOnUserSchedule=true
| Out-Null`
Note: The above used to work as expected until v2.78 and probably for later releases before v2.81. We noticed our pipelines started with fail after AzureManagedPools updated the underneath azure cli version to v2.81. We figured out a workaround but wanted to highlist so this can be fixed in later versions of azure cli.
Steps to reproduce:
- Create a windows VM with default setting with "patchMode" as "AutomaticByOS" and "enableAutomaticUpdates" to true.
- Run above command to update the upgrade configs for Customer Managed Schedules
Work Around:
Instead of az vm update we are direcly utlizing the az rest api calls.
Example:
$azVmId = $result.id $body = '{"properties":{"osProfile":{"windowsConfiguration":{"enableAutomaticUpdates":true,"patchSettings":{"patchMode":"AutomaticByPlatform","automaticByPlatformSettings":{"bypassPlatformSafetyChecksOnUserSchedule":true}}}}}}' $jsonBody = $body | ConvertTo-Json -Depth 10 -Compress az rest --uri "https://management.azure.com/$azVmId?api-version=2024-03-01"
--method patch --headers "Content-Type=application/json"
--body $jsonBody | Out-Null
Related command
az vm update
Errors
ERROR: Couldn't find 'automaticByPlatformSettings' in 'osProfile.windowsConfiguration.patchSettings'. Available options: ['assessmentMode', 'patchMode']
Issue script & Debug output
Not sure. But added a workaround which might help the backend team to figure the root cause.
Expected behavior
az vm update should be able to update the automatic upgrade configs without any errors.
Environment Summary
azure cli v2.82
Additional context
NA