Skip to content

Instantly share code, notes, and snippets.

@smereczynski
Created January 24, 2019 16:48
Show Gist options
  • Save smereczynski/c7b248f8a785775cb09c88f0429518dd to your computer and use it in GitHub Desktop.
Save smereczynski/c7b248f8a785775cb09c88f0429518dd to your computer and use it in GitHub Desktop.
Policy definition for denying deployments where RG or SA does not have tags values for defined tags keys.
{
"if": {
"allOf": [
{
"anyOf": [
{
"field": "type",
"equals": "Microsoft.Resources/subscriptions/resourceGroups"
},
{
"field": "type",
"equals": "Microsoft.Storage/storageAccounts"
}
]
},
{
"anyOf": [
{
"field": "tags.env",
"exists": false
},
{
"field": "tags.bu",
"exists": false
},
{
"field": "tags.costcenter",
"exists": false
}
]
}
]
},
"then": {
"effect": "deny"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment