A recent customer requirement arose during an engagement: enforce naming convention on Azure Resource Group name using Azure policy. That’s been possible for a while, but in this instance the customer has multiple “schemas” for their RG names.
Research determines this is now (since 23/1/19) possible using multiple name matches in JSON. It’ll take time to define all the matches required for any client if they have multiple RG name possibilities.
You use ? to denote 1 character, and # to denote a single numeric. The issue here is that if clients don’t have a set number of digits for any specific field in the RG name, you have to cater for every eventuality – so you could end up defining lots; one encouraging factor to try and drive a naming convention with fixed length fields….
e.g. If you have has the first field as either 2 or 3 digits, it’s; RG-?? and RG-???. And, if the next field is 3, or 4 digits, you need RG-??-???, RG-??-????, RG-???-??? and RG-???-????. As you can see, the more variable length fields you have, the more name matches you need to specify. Add 2 or 3 more variable length fields and this can easily become unwieldy & see over 100 matches.
Recommendation: always try for fixed length fields within a resource group name.
See this link for more details: https://docs.microsoft.com/en-us/azure/governance/policy/samples/allow-multiple-name-patterns