Skip to content

Commit c1d25f9

Browse files
Merge pull request #223779 from maulikshah23/patch-12
Update automatic-vm-guest-patching.md
2 parents abf97ae + e70ee7a commit c1d25f9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

articles/virtual-machines/automatic-vm-guest-patching.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,20 @@ PUT on `/subscriptions/subscription_id/resourceGroups/myResourceGroup/providers/
220220
}
221221
```
222222

223-
### Azure PowerShell for Windows VMs
224-
Use the [Set-AzVMOperatingSystem](/powershell/module/az.compute/set-azvmoperatingsystem) cmdlet to enable automatic VM guest patching when creating or updating a VM.
223+
### Azure PowerShell when creating a Windows VM
224+
Use the [Set-AzVMOperatingSystem](/powershell/module/az.compute/set-azvmoperatingsystem) cmdlet to enable automatic VM guest patching when creating a VM.
225225

226226
```azurepowershell-interactive
227227
Set-AzVMOperatingSystem -VM $VirtualMachine -Windows -ComputerName $ComputerName -Credential $Credential -ProvisionVMAgent -EnableAutoUpdate -PatchMode "AutomaticByPlatform"
228228
```
229+
### Azure PowerShell when updating a Windows VM
230+
Use the [Set-AzVMOperatingSystem](/powershell/module/az.compute/set-azvmoperatingsystem) and [Update-AzVM](/powershell/module/az.compute/update-azvm) cmdlet to enable automatic VM guest patching on an existing VM.
231+
232+
```azurepowershell-interactive
233+
Get-AzVM -VM $VirtualMachine -Windows -ComputerName $ComputerName -Credential $Credential
234+
Set-AzVMOperatingSystem -VM $VirtualMachine -PatchMode "AutomaticByPlatform"
235+
Update-AzVM -VM $VirtualMachine
236+
```
229237

230238
### Azure CLI for Windows VMs
231239
Use [az vm create](/cli/azure/vm#az-vm-create) to enable automatic VM guest patching when creating a new VM. The following example configures automatic VM guest patching for a VM named *myVM* in the resource group named *myResourceGroup*:

0 commit comments

Comments
 (0)