HOw to place Linux Vitual machine and map to maintenance configuration

sns 9,236 Reputation points
2023-11-13T06:32:38.1966667+00:00

I have created mainteance configuration as below

User's image

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

can you give me exact command

I have 2 linux VMs ready with me

Azure Update Manager
Azure Update Manager
An Azure service to centrally manages updates and compliance at scale.
311 questions
{count} votes

Accepted answer
  1. SwathiDhanwada-MSFT 18,766 Reputation points
    2023-11-13T08:10:04.4666667+00:00

    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"]}'
    

    sns In this example, the tag key is "Environment" and the tag value is "Production". The filter operator is set to "Any", which means that any virtual machine that has at least one of the specified tags will be included in the maintenance configuration.

    If you want to include multiple tag key-value pairs in the filter, you can separate them with commas. For example:

    -FilterTag '{"Environment" : ["Production"], "Department" : ["IT", "Finance"]}'
    

    In this example, the filter will include virtual machines that have the tag "Environment" with the value "Production" and the tag "Department" with the value "IT" or "Finance".

    To include your Linux virtual machines in the maintenance configuration, you'll need to assign appropriate tags to them and use those tags in the filter. For example, you can assign the tag "OS" with the value "Linux" to your Linux virtual machines and use the following filter to include them in the maintenance configuration:

    -FilterTag '{"OS" : ["Linux"]}'
    

    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 comments No comments

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.