summary import { VirtualMachineInstallPatchesParameters , ComputeManagementClient } from "@msinternal/compute-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function installPatchStateOfAVirtualMachine ( ) { const subscriptionId = "{subscription-id}" ; const resourceGroupName = "myResourceGroupName" ; const vmName = "myVMName" ; const installPatchesInput = { maximumDuration : "PT4H" , rebootSetting : "IfRequired" , windowsParameters : { classificationsToInclude : [ "Critical" , "Security" ] , maxPatchPublishDate : new Date ( "2020-11-19T02:36:43.0539904+00:00" ) } } ; const credential = new DefaultAzureCredential ( ) ; const client = new ComputeManagementClient ( credential , subscriptionId ) ; const result = await client . virtualMachines . beginInstallPatchesAndWait ( resourceGroupName , vmName , installPatchesInput ) ; console . log ( result ) ; } installPatchStateOfAVirtualMachine ( ) . catch ( console . error ) ;