Forum Discussion

Patti Santacroce's avatar
Patti Santacroce
Copper Contributor
Sep 07, 2021

Policy initiative

I hope someone can help me get this last piece I have been stuck on. I have created about 6 different Tags. I  want to create a policy initiative. I can't seem to get this created via PowerShell. 

I am using the set-New-AzPolicySetDefinition cmdlet.  The error I am getting New-AzPolicySetDefinition: The provided value for parameter 'PolicyDefinition' is not a valid JSON array.

Please see attached with two examples on what I tried.

Any help will be much appreciated.

Regards,

PS

1 Reply

  • BrooksV's avatar
    BrooksV
    Copper Contributor

    Patti Santacroce 


    It's been over 7 months since you posted this thread and I am sure you figured out how to script a solution by now.

     

    In case others have a similar need to create Policy Initiatives using PowerShell, I hope the attached PowerShell script will be of assistance.

     

    This script supports the following:

    • Initiatives based on Custom and Built-In Polices
    • Dynamic creation for multiple Assignment Scopes
    • Dynamic creation for Parameters and Values including Effect Parameter
    • Dynamic creation of Default and Tag specific NonComplianceMessages for Assignments
    • Dynamic creation RBAC Role Assignments for Managed Identity when required. 
      • Modify as well as deployIfNotExists Policies requires RBAC role assignments to be created as part of the Policy  Assignment Process

    Regards,
    BrooksV