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

Adding new policy definition to handle custom roles with exclusionlist #480

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')]"
}
}
}
}
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"
}
}
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')]"
}
}
Loading