-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9ba97c
commit 1da409c
Showing
6 changed files
with
134 additions
and
1 deletion.
There are no files selected for viewing
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
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
Binary file not shown.
72 changes: 72 additions & 0 deletions
72
.../managementGroupTemplates/policyAssignments/AUDIT-ResourceRGLocationPolicyAssignment.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,72 @@ | ||
{ | ||
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/managementGroupDeploymentTemplate.json#", | ||
"contentVersion": "1.0.0.0", | ||
"parameters": { | ||
"topLevelManagementGroupPrefix": { | ||
"type": "string", | ||
"metadata": { | ||
"description": "Provide the ESLZ company prefix to the intermediate root management group containing the policy definitions." | ||
} | ||
}, | ||
"effect": { | ||
"type": "string", | ||
"allowedValues": [ | ||
"Deny", | ||
"Audit", | ||
"Disabled" | ||
], | ||
"defaultValue": "Audit" | ||
}, | ||
"enforcementMode": { | ||
"type": "string", | ||
"allowedValues": [ | ||
"Default", | ||
"DoNotEnforce" | ||
], | ||
"defaultValue": "Default" | ||
}, | ||
"nonComplianceMessagePlaceholder": { | ||
"type": "string", | ||
"defaultValue": "{enforcementMode}" | ||
} | ||
}, | ||
"variables": { | ||
"policyDefinitions": { | ||
"auditRGL": "[concat('/providers/Microsoft.Management/managementGroups/', parameters('topLevelManagementGroupPrefix'), '/providers/Microsoft.Authorization/policySetDefinitions/Audit-ResourceRGLocation')]" | ||
}, | ||
"policyAssignmentNames": { | ||
"auditRGL": "Audit-ResourceRGLocation", | ||
"description": "Resource Group and Resource locations should match.", | ||
"displayName": "Resource Group and Resource locations should match" | ||
}, | ||
"nonComplianceMessage": { | ||
"message": "Resources {enforcementMode} be Zone Resilient.", | ||
"Default": "must", | ||
"DoNotEnforce": "should" | ||
} | ||
}, | ||
"resources": [ | ||
{ | ||
"type": "Microsoft.Authorization/policyAssignments", | ||
"apiVersion": "2022-06-01", | ||
"name": "[variables('policyAssignmentNames').auditRGL]", | ||
"properties": { | ||
"description": "[variables('policyAssignmentNames').description]", | ||
"displayName": "[variables('policyAssignmentNames').displayName]", | ||
"policyDefinitionId": "[variables('policyDefinitions').auditRGL]", | ||
"enforcementMode": "[parameters('enforcementMode')]", | ||
"nonComplianceMessages": [ | ||
{ | ||
"message": "[replace(variables('nonComplianceMessage').message, parameters('nonComplianceMessagePlaceholder'), variables('nonComplianceMessage')[parameters('enforcementMode')])]" | ||
} | ||
], | ||
"parameters": { | ||
"effect": { | ||
"value": "[parameters('effect')]" | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"outputs": {} | ||
} |
58 changes: 58 additions & 0 deletions
58
src/resources/Microsoft.Authorization/policyDefinitions/Audit-ResourceRGLocation.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,58 @@ | ||
{ | ||
"name": "Audit-ResourceRGLocation", | ||
"type": "Microsoft.Authorization/policyDefinitions", | ||
"apiVersion": "2021-06-01", | ||
"scope": null, | ||
"properties": { | ||
"displayName": "Resource Group and Resource locations should match", | ||
"description": "In order to improve resilience and reliability, you need to be aware of where resources are deployed. To aid this awareness, ensure that the location of the resource group matches the location of the resources it contains.", | ||
"version": "1.0.0", | ||
"metadata": { | ||
"version": "1.0.0", | ||
"category": "General", | ||
"source": "https://github.com/Azure/Enterprise-Scale/", | ||
"alzCloudEnvironments": [ | ||
"AzureCloud", | ||
"AzureChinaCloud", | ||
"AzureUSGovernment" | ||
] | ||
}, | ||
"mode": "Indexed", | ||
"parameters": { | ||
"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": "location", | ||
"notEquals": "[resourceGroup().location]" | ||
}, | ||
{ | ||
"field": "location", | ||
"notEquals": "global" | ||
}, | ||
{ | ||
"field": "type", | ||
"notEquals": "Microsoft.AzureActiveDirectory/b2cDirectories" | ||
} | ||
] | ||
}, | ||
"then": { | ||
"effect": "[parameters('effect')]" | ||
} | ||
} | ||
} | ||
} |
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