Created
September 28, 2019 09:33
-
-
Save goyalmohit/a25cb3398a9033534077efd006823aa7 to your computer and use it in GitHub Desktop.
Built-In Azure Policy to restrict azure locations
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
{ | |
"properties": { | |
"displayName": "Allowed locations", | |
"policyType": "BuiltIn", | |
"description": "This policy enables you to restrict the locations your organization can specify when deploying resources. Use to enforce your geo-compliance requirements. Excludes resource groups, Microsoft.AzureActiveDirectory/b2cDirectories, and resources that use the 'global' region.", | |
"mode": "Indexed", | |
"parameters": { | |
"listOfAllowedLocations": { | |
"type": "Array", | |
"metadata": { | |
"description": "The list of locations that can be specified when deploying resources.", | |
"strongType": "location", | |
"displayName": "Allowed locations" | |
} | |
} | |
}, | |
"policyRule": { | |
"if": { | |
"allOf": [ | |
{ | |
"field": "location", | |
"notIn": "[parameters('listOfAllowedLocations')]" | |
}, | |
{ | |
"field": "location", | |
"notEquals": "global" | |
}, | |
{ | |
"field": "type", | |
"notEquals": "Microsoft.AzureActiveDirectory/b2cDirectories" | |
} | |
] | |
}, | |
"then": { | |
"effect": "Deny" | |
} | |
} | |
}, | |
"id": "/providers/Microsoft.Authorization/policyDefinitions/e56962a6-4747-49cd-b67b-bf8b01975c4c", | |
"type": "Microsoft.Authorization/policyDefinitions", | |
"name": "e56962a6-4747-49cd-b67b-bf8b01975c4c" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment