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"