Skip to content

VM update commands fails to update VM OS configs with azure cli v2.81 & v2.82 #32671

@amyadav11

Description

@amyadav11

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:

  1. Create a windows VM with default setting with "patchMode" as "AutomaticByOS" and "enableAutomaticUpdates" to true.
  2. 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

Metadata

Metadata

Labels

Auto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamBreaking ChangeComputeaz vm/vmss/image/disk/snapshotcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-triageThis issue needs the team to triage.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions