Is it possible to enforce a Resource Naming Convention using a RegEx from an Azure Policy.

Sai Kiran Maturi 66 Reputation points
2023-07-11T17:21:04.89+00:00

Is it possible to enforce a required resource naming convention using a RegEx from an Azure Policy.

Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
949 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Saurabh Sharma 23,826 Reputation points Microsoft Employee
    2023-07-11T20:59:48.1133333+00:00

    @Sai Kiran Maturi

    Thanks for using Microsoft Q&A !!

    No, it is not possible to enforce a required resource naming convention using regex from an Azure policy. You can use the existing Logical Operators(not, allOf,anyOf) along with supported conditions to achieve a certain level of resource naming validations however complex one using regex is not supported. Please let me know if you have any questions.

    Thanks Saurabh


    Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.

    1 person found this answer helpful.

  2. Hoang Viet Do 0 Reputation points
    2024-11-28T04:49:57.3766667+00:00

    regex is not supported yet, but with match you can define placeholders

    When using the match and notMatch conditions, provide a hashtag (#) to match a digit, question mark (?) for a letter, and a dot (.) to match any character, and any other character to match that actual character. While match and notMatch are case-sensitive, all other conditions that evaluate a stringValue are case-insensitive. Case-insensitive alternatives are available in matchInsensitively and notMatchInsensitively.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.