Skip to content

Instantly share code, notes, and snippets.

@jesseloudon
Last active May 16, 2020 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesseloudon/288c346d56a438dd2212d0dd61d91422 to your computer and use it in GitHub Desktop.
Save jesseloudon/288c346d56a438dd2212d0dd61d91422 to your computer and use it in GitHub Desktop.
Custom Azure Policy to Audit Role Assignment Type
{
"mode": "All",
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Authorization/roleAssignments"
},
{
"field": "Microsoft.Authorization/roleAssignments/principalType",
"equals": "[parameters('principalType')]"
}
]
},
"then": {
"effect": "audit"
}
},
"parameters": {
"principalType": {
"type": "String",
"metadata": {
"displayName": "principalType",
"description": "Which principaltype to audit against e.g. 'User'"
},
"allowedValues": [
"User",
"Group",
"ServicePrincipal"
],
"defaultValue": "User"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment