How turn off Windows Azure VM Automatic Updates

Jan Vávra 231 Reputation points

I have a VM with

$vm = Get-AzVM -ResourceGroupName $rgName -Name $vmName     
>> AutomaticByOS
>> True

Can I somehow change it to a manual patch orchestration? This command fails

$vm.OSProfile.WindowsConfiguration.EnableAutomaticUpdates = $False
$vm.OSProfile.WindowsConfiguration.PatchSettings.PatchMode =  "Manual"
Update-AzVM -ResourceGroupName $resourceGroupName -VM $vm

Update-AzVM: Changing property 'windowsConfiguration.enableAutomaticUpdates' is not allowed.
ErrorCode: PropertyChangeNotAllowed
ErrorMessage: Changing property 'windowsConfiguration.enableAutomaticUpdates' is not allowed.
ErrorTarget: windowsConfiguration.enableAutomaticUpdates
StatusCode: 409
OperationID : 59cf8ced-e3b6-4b23-bb33-4089e5ecefe4

And I cannot find settings in the Portal for it.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
6,783 questions
Azure Update Manager
Azure Update Manager
An Azure service to centrally manages updates and compliance at scale.
185 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. deherman-MSFT 31,991 Reputation points Microsoft Employee

    @Jan Vávra

    Unfortunately these values are not able to be changed once the VM is created. If you require changing these values you will need to recreate the VM. Details about this can be on the Automatic VM guest patching for Azure VMs page:

    For Windows VMs, the property osProfile.windowsConfiguration.enableAutomaticUpdates can only be set when the VM is first created. This impacts certain patch mode transitions. Switching between AutomaticByPlatform and Manual modes is supported on VMs that have osProfile.windowsConfiguration.enableAutomaticUpdates=false. Similarly switching between AutomaticByPlatform and AutomaticByOS modes is supported on VMs that have osProfile.windowsConfiguration.enableAutomaticUpdates=true. Switching between AutomaticByOS and Manual modes is not supported.

    Sorry for the bad news. Let me know if you need more assistance or have more questions.

    If you still have questions, please let us know in the "comments" and we would be happy to help you. Comment is the fastest way of notifying the experts. If the answer has been helpful, we appreciate hearing from you and would love to help others who may have the same question. Accepting answers helps increase visibility of this question for other members of the Microsoft Q&A community. Thank you for helping to improve Microsoft Q&A! User's image