-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding new policy definition to handle custom roles with exclusionlist (
#480) * adding new Azure policy for custom roles * Updating display name * moving parameters in correct alphabetic order --------- Co-authored-by: Sebastian Claesson <[email protected]>
- Loading branch information
1 parent
c158559
commit 0465268
Showing
3 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
policyDefinitions/Authorization/deny-custom-roles-with-exclusionlist/azurepolicy.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"name": "4eaae358-7df4-4338-ae26-c4547ebe9403", | ||
"type": "Microsoft.Authorization/policyDefinitions", | ||
"properties": { | ||
"displayName": "Deny custom roles with exclusionlist", | ||
"description": "This policy will audit or deny the creation of RBAC custom roles, excluding specified role definition names.", | ||
"metadata": { | ||
"version": "1.0.0", | ||
"category": "Authorization" | ||
}, | ||
"mode": "All", | ||
"parameters": { | ||
"excludedRoleNames": { | ||
"type": "array", | ||
"metadata": { | ||
"displayName": "Excluded Role Names", | ||
"description": "Names of Roles to be excluded from the policy." | ||
}, | ||
"defaultValue": [] | ||
}, | ||
"effect": { | ||
"type": "string", | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "Deny, Audit or Disabled the execution of the Policy" | ||
}, | ||
"allowedValues": [ | ||
"Deny", | ||
"Audit", | ||
"Disabled" | ||
], | ||
"defaultValue": "Audit" | ||
} | ||
}, | ||
"policyRule": { | ||
"if": { | ||
"allOf": [ | ||
{ | ||
"field": "type", | ||
"equals": "Microsoft.Authorization/roleDefinitions" | ||
}, | ||
{ | ||
"field": "Microsoft.Authorization/roleDefinitions/type", | ||
"notEquals": "BuiltInRole" | ||
}, | ||
{ | ||
"field": "Microsoft.Authorization/roleDefinitions/roleName", | ||
"notIn": "[parameters('ExcludedRoleNames')]" | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]" | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...efinitions/Authorization/deny-custom-roles-with-exclusionlist/azurepolicy.parameters.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"excludedRoleNames": { | ||
"type": "array", | ||
"metadata": { | ||
"displayName": "Excluded Role Names", | ||
"description": "Names of Roles to be excluded from the policy." | ||
}, | ||
"defaultValue": [] | ||
}, | ||
"effect": { | ||
"type": "string", | ||
"metadata": { | ||
"displayName": "Effect", | ||
"description": "Deny, Audit or Disabled the execution of the Policy" | ||
}, | ||
"allowedValues": [ | ||
"Deny", | ||
"Audit", | ||
"Disabled" | ||
], | ||
"defaultValue": "Audit" | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
policyDefinitions/Authorization/deny-custom-roles-with-exclusionlist/azurepolicy.rules.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"if": { | ||
"allOf": [ | ||
{ | ||
"field": "type", | ||
"equals": "Microsoft.Authorization/roleDefinitions" | ||
}, | ||
{ | ||
"field": "Microsoft.Authorization/roleDefinitions/type", | ||
"notEquals": "BuiltInRole" | ||
}, | ||
{ | ||
"field": "Microsoft.Authorization/roleDefinitions/roleName", | ||
"notIn": "[parameters('ExcludedRoleNames')]" | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]" | ||
} | ||
} |