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"