Azure tags: search for value including wildcard

azureazure-cli

We'd like to have multi-valued tags. For example, for the tag "application", we have some resources that involve several applications, i.e. Virtual Machines running several JBoss instances for different applications. As far as I know, multi-valued tags are not allowed for the time being. As a workaround, I'm considering values for the tag like "app1, app2". However, I can't see how we could actually use those values for proper queries. I would have expected to be able to do something like

az resource list --tag 'application=*app1*'

That's not working though. According to https://docs.microsoft.com/en-us/cli/azure/resource?view=azure-cli-latest#az-resource-list, wildcards are allowed in tag names, but not in tag values:

az resource list --tag 'test*'

Are you aware of any method we could use to handle these pseudo-multi-valued tags?

Thank you and best regards.

Best Answer

The filter in the Az CLI will not allow that kind of search, so you would have to do that sort of filtering yourself in your own bash/PowerShell code once you retrieve a list of resources.

Related Topic