Mapping Azure Virtual Machine configuration to maintenance configraiton

sns 9,246 Reputation points
2023-11-12T08:40:55.15+00:00

I have created mainteance configuration using below command

New-AzMaintenanceConfiguration -ResourceGroupName smdtest -Name workervmscentralus -MaintenanceScope Host -Location centralus -StartDateTime "2020-08-01 00:00" -ExpirationDateTime "2021-08-04 00:00" -Timezone "Pacific Standard Time" -Duration 05:00 -RecurEvery Day

and next I have tried to map couple of virtual machine to above mainteance configuration

For that I am trying to use following dynmic scope withe help of following command

New-AzConfigurationAssignment -ConfigurationAssignmentName $maintenanceConfigurationName -MaintenanceConfigurationId $maintenanceConfigurationInGuestPatchCreated.Id -FilterLocation eastus2euap,centraluseuap -FilterOsType Windows,Linux -FilterTag '{"tagKey1" : ["tagKey1Value1", "tagKey1Value2"], "tagKey2" : ["tagKey2Value1", "tagKey2Value2", "tagKey2Value3"] }' -FilterOperator "Any"

I am not sure about what exactly tage key1 and tag key value 2 etc in the above command. is it referring virtual machine names? could you please clarify so that I can place those machines sucessfully in the mainteance configation

Azure Update Manager
Azure Update Manager
An Azure service to centrally manages updates and compliance at scale.
376 questions
0 comments No comments
{count} votes

Accepted answer
  1. SwathiDhanwada-MSFT 18,996 Reputation points Moderator
    2023-11-13T09:42:42.9566667+00:00

    sns The -FilterTag parameter in the New-AzConfigurationAssignment cmdlet is used to filter the virtual machines that will be included in the maintenance configuration. The tag key-value pairs that you specify in the filter will be used to match against the tags that are assigned to the virtual machines.

    For example, if you have assigned the tag "Environment" with the value "Production" to your virtual machines, you can use the following filter to include only those virtual machines in the maintenance configuration:

    -FilterTag '{"Environment" : ["Production"]}'
    
    

    Note that the -FilterLocation parameter is used to filter virtual machines based on their location, and the -FilterOsType parameter is used to filter virtual machines based on their operating system type. You can use these parameters in combination with the -FilterTag parameter to create a more specific filter for your virtual machines.

    Sample example to create dynamic scope.

     $a =Get-AzMaintenanceConfiguration -ResourceGroupName compute-resources -Name workervms 
    
    New-AzConfigurationAssignment -ConfigurationAssignmentName $a.Name -MaintenanceConfigurationId $a.Id -FilterOsType Linux -FilterOperator "Any"
    

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.