Created
June 6, 2018 10:36
-
-
Save tyconsulting/9075d3a3eef8401bdc2ba88aadd74f3c to your computer and use it in GitHub Desktop.
ARM Template - Policy Definition with input parameters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"roleDefinitionIds": { | |
"type": "string" | |
} | |
}, | |
"variables": {}, | |
"resources": [ | |
{ | |
"type": "Microsoft.Authorization/policyDefinitions", | |
"name": "allowed-role-definitions-def", | |
"apiVersion": "2018-03-01", | |
"properties": { | |
"policyType": "Custom", | |
"displayName": "Allowed Role Definitions", | |
"description": "This policy defines a white list of role deifnitions that can be used in IAM", | |
"mode": "all", | |
"parameters": { | |
"roleDefinitionIds": { | |
"type": "array", | |
"metadata": { | |
"description": "The list of role definition Ids", | |
"displayName": "Approved Role Definitions" | |
} | |
} | |
}, | |
"policyRule": { | |
"if": { | |
"allOf": [ | |
{ | |
"field": "type", | |
"equals": "Microsoft.Authorization/roleAssignments" | |
}, | |
{ | |
"not": { | |
"field": "Microsoft.Authorization/roleAssignments/roleDefinitionId", | |
"in": "[parameters('roleDefinitionIds')]" | |
} | |
} | |
] | |
}, | |
"then": { | |
"effect": "deny" | |
} | |
} | |
} | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment