When creating a dynamic group with a filter that uses tags, how do you choose a tag value that hasn't been assigned to a resource yet?

For example, I am trying to create new patching deployment schedules based on patching windows. A new tag called 'Patch_Window' would have values such as 'Monday-10pm' 'Tuesday-12am' 'Wednesday-10pm', etc, that would indicate when the patching would begin for that group. There would be a dynamic group for each one of these windows. But since this is a new solution, there aren't any VMs that have these tag values yet, so I cannot choose the tag value from the tag list.

Is there a a way I can pre-define the possible values of the tag in Azure Portal so I can choose them in the filter? I thought this would be possible in the 'Tags' space in Azure Portal but it isn't.

The only reason Thu-8pm shows up is because I applied that tag value to a testing VM enter image description here

1

There are 1 best solutions below

3
Venkat V On

Is there a a way I can pre-define the possible values of the tag in Azure Portal so I can choose them in the filter?

Yes, you can create predefined tag with a value using PowerShell.

I have followed this MSDocument to create predefined tag with a value without any resources.

PowerShell Script

Connect-AzAccount 
New-AzTag -Name "Department" -Value "HR"  

Output:

enter image description here

When I checked the tags in the portal, I found that although the tags were present, no resources were assigned to the particular tag.

enter image description here

When I tried to filter the tags in update management, it did not show any results

Note: You cannot filter by tag if no resources are associated with that tag.

enter image description here