Dynamically assign parameter values for two different tenants #927
Replies: 1 comment 3 replies
-
There is. It took me a second to understand and figure it out, but now that I do, I have much cleaner code for my assignments. You'll want to reference this documentation: https://azure.github.io/enterprise-azure-policy-as-code/policy-assignments/ and specifically try out some assignments with children. It's pretty flexible and I don't think the documentation makes this super clear with its examples and wording. Anything you want to be inherited, put those settings under the root node of your assignment and then anything you want to be different between the 2 tenants, put those settings under the children nodes. So, for most of my assignments I'll define everything, including the shared parameters under a root node in the assignment and then in the child node, only designate the node name and parameters that I want to change. Play around a little bit to get a better understanding of what can and can't be done. You don't want to define duplicate parameters and things, it'll error out on that, but once you get the hang of it, it should make good sense, and you should be able to minimize the amount of assignment files you have going on pretty well. FWIW, I also prefer the json approach even for larger policy sets. I personally haven't run into the json limitations yet applying mostly the ALZ default policies. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everybody,
I have two tenants (dev & prod) both are working with ALZ (azure landingzones). Now I want to deploy policies for private dns zones which have their resourceid to the corresponding connectivity subscription.
My question is now how can I manage those tenant specific settings? Is there a way to provide a parameter file depending on the pac-environment. For instance the policy for app services - https://www.azadvertizer.net/azpolicyadvertizer/b318f84a-b872-429b-ac6d-a01b96814452.html - this policy requires the privatednszoneid. One approach would be to make a folder for test and prod and hardcode the resourcestring directly into the parameter, which seems a bit clumsy to me. I read through the CSV-approach but honestly I did not understand that.
Is there a better way to this?
Beta Was this translation helpful? Give feedback.
All reactions