Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Policy]: Enforce the presence of mandatory tags provided via parameter #1837

Open
1 task done
cjasset opened this issue Nov 14, 2024 · 5 comments
Open
1 task done
Assignees
Labels

Comments

@cjasset
Copy link

cjasset commented Nov 14, 2024

Policy Definition or Initiative

Definition

Built-in/Custom

Custom

Built-in policy definition or initiative ID

Custom policy definition or initiative description

A policy that audits for the presence of mandatory tags on resource groups and resources. Customer can input an array of tags and the policy will audit to ensure those tags are present and not null.

Scope

Intermediate Root

Default Assignment

  • Yes

Comments/thoughts

Obviously there are already more complex tagging policies that can look for specific values etc but I have found for customers just getting started are not interested in updating or writing custom policies. A simple policy where they can input an array of mandatory tags is a good starting point. Later as they refine their environment they can iterate on this strategy. Here is an example policy I put together for a few of my customers which validates mandatory tags on resource groups.

mandatorytagspolicy.txt

@Springstone
Copy link
Member

@cjasset thanks for posting this issue.
This is technically possible with built-in policies https://www.azadvertizer.net/azpolicyadvertizer/871b6d14-10aa-478d-b590-94f262ecfa99.html and https://www.azadvertizer.net/azpolicyadvertizer/96670d01-0a4d-4649-9c89-2d3abc0a5025.html

You can create an initiative and use the same policy multiple times and just provide the unique tag for each instance. You can then either "DONOTENFORCE" or OVERRIDE the Effect to AUDIT, if this is your goal.

Are you asking for a single policy that can do the same?

@Springstone Springstone added the Needs: Author Feedback 👂 Needs the author to provide feedback label Nov 15, 2024
@cjasset
Copy link
Author

cjasset commented Nov 15, 2024

Thanks for the reply. I am aware of the built-in policies but as you point out, you would have to create an initiative and use the same policy over and over with 1 tag per policy. This isn't really scalable for both the customer and the ALZ team from a deployment perspective. Thats why I put together the attached policy which is a simpler solution. 1 policy, with an array of tags for input.

@mattfeltonma
Copy link

mattfeltonma commented Nov 15, 2024

Suggesting a customer use the existing built-in policy which supports 1 tag per policy has the potential to create scale issues. There is no reason that we shouldn't be providing a built-in policy that supports multiple tags, which it looks like @cjasset has already provided.

What is the issue with getting the policy he has provided incorporated into the solution?

@Springstone Springstone removed the Needs: Author Feedback 👂 Needs the author to provide feedback label Nov 18, 2024
@Springstone
Copy link
Member

No issue, just clarifying if the built-ins were considered. Just can't promise it in this refresh as we have a significant backlog (version pinning, etc), but will add it and hopefully we can get it in on time.

@Springstone
Copy link
Member

Springstone commented Nov 18, 2024

PR is on the way, but will only be part of Policy Refresh in early Jan. Can't assign by default as customer needs to provide the tag array.

#1843

@Springstone Springstone added this to the policy-refresh-fy25-q2 milestone Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants