How to enable Automatic Guest OS Patching for Windows Azure VMs?
- Get link
- X
- Other Apps
For any organization and project security plays a very important role, towards that Microsoft tries to simplify and eases the effort required by the customer or end-user. One such thing that they recently announced is Automatic Guest OS patching for windows Azure VMs which is now public preview.
With Azure Automatic Guest OS patching enabled it helps update management by safely and automatically patching virtual machines to maintain security compliance. Here VMs are checked periodically for available operating system patches. Operating system patches classified as critical or security are automatically downloaded and applied on the VM. If VM is powered off during assessment by the platform for patching, VM will be automatically assessed during the next periodic assessment when it's turned on. Patches are applied within the 30 days of the monthly Windows update release.
Automatic VM guest patching has the following capabilities:
- Patches classified as Critical or Security is automatically downloaded and applied on the VM.
- Patches are applied during off-peak hours in the VMs time zone. The VM must be running during off-peak hours for patches to be automatically installed.
- Patches are applied based on availability-first principles.
- Works for all VM sizes (No additional cost etc.)
Pre-Requisites
- VM must have Azure VM Agent installed.
- Supported OS - Windows Server 2012 R2, 2016, 2019. Custom images are currently not supported in the preview.
- Windows update service must be running on VM.
- Use Compute API version 2020-06-01 or higher.
- The virtual machine must be able to access Windows Update endpoints.
Steps to enable Automatic Guest OS Patching
You can enable using Azure PowerShell or CLI 2.0 or Rest API. In this post, I will be showing using Azure CLI 2.0.
# Register az feature - Note: Feature registration can take up to 15 minutes az feature register --namespace Microsoft.Compute --name InGuestAutoPatchVMPreview # Check the registration status az feature show --namespace Microsoft.Compute --name InGuestAutoPatchVMPreview #Once the feature is registered for your subscription, complete the opt-in process by propagating the change into the Compute resource provider. az provider register --namespace Microsoft.Compute
Once the above commands are executed you can enable automatic guest os patching for your existing Azure VMs use the following command.
az vm update --resource-group <myResourceGroup> --name <VM name> --set osProfile.windowsConfiguration.enableAutomaticUpdates=true osProfile.windowsConfiguration.patchSettings.patchMode=AutomaticByPlatform
Once enabled you can view the status or changes applied using the following command.
az vm get-instance-view --resource-group <myresourcegroup> --name <vm name>
Note: If the Automatic updates feature is not enabled on the flag then this Auto patching by platform can't be enabled.
In case if you want to trigger an on-demand patch assessment on your VM at any time use the below command. on-demand patch assessment doesn't automatically trigger it will still go through things like VMs off-peak hours and availability-first patching process.
Invoke-AzVmPatchAssessment -ResourceGroupName <myresourcegroup> -VMName <vm name>
Reference:
https://azure.microsoft.com/en-us/updates/automatic-vm-guest-patching-now-in-preview/
Comments
Post a Comment