Gallery › Backup › Azure Landing Zones Library
Enforce enhanced recovery and backup policies
Converted Initiative Version 1.1.0
Enforce enhanced recovery and backup policies on assigned scopes.
ConvertTo-Bylaw converted this initiative, and proved that the file compiles back to the same definition.
Azure Policy JSONEnforce-Backup.1.0.0.alz_policy_set_definition.json · 138 lines
{
"name": "Enforce-Backup",
"properties": {
"description": "Enforce enhanced recovery and backup policies on assigned scopes.",
"displayName": "Enforce enhanced recovery and backup policies",
"metadata": {
"alzCloudEnvironments": [
"AzureCloud",
"AzureChinaCloud",
"AzureUSGovernment"
],
"category": "Backup",
"source": "https://github.com/Azure/Enterprise-Scale/",
"version": "1.1.0"
},
"parameters": {
"checkAlwaysOnSoftDeleteOnly": {
"allowedValues": [
true,
false
],
"defaultValue": false,
"metadata": {
"description": "This parameter checks if Soft Delete is 'Locked' for Backup Vaults in scope. Selecting 'true' will mark only vaults with Soft Delete 'AlwaysOn' as compliant. Selecting 'false' will mark vaults that have Soft Delete either 'On' or 'AlwaysOn' as compliant.",
"displayName": "CheckAlwaysOnSoftDeleteOnly"
},
"type": "Boolean"
},
"checkLockedImmutabilityOnly": {
"allowedValues": [
true,
false
],
"defaultValue": false,
"metadata": {
"description": "This parameter checks if Immutability is locked for Backup Vaults in scope. Selecting 'true' will mark only vaults with Immutability 'Locked' as compliant. Selecting 'false' will mark vaults that have Immutability either 'Enabled' or 'Locked' as compliant.",
"displayName": "checkLockedImmutabilityOnly"
},
"type": "Boolean"
},
"effect": {
"allowedValues": [
"Audit",
"Disabled"
],
"defaultValue": "Audit",
"metadata": {
"description": "Enable or disable the execution of the policy.",
"displayName": "Effect"
},
"type": "String"
}
},
"policyDefinitions": [
{
"definitionVersion": "1.*.*-preview",
"groupNames": [],
"parameters": {
"checkLockedImmutabiltyOnly": {
"value": "[parameters('checkLockedImmutabilityOnly')]"
},
"effect": {
"value": "[parameters('effect')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/2514263b-bc0d-4b06-ac3e-f262c0979018",
"policyDefinitionReferenceId": "BackupBVault-Immutability"
},
{
"definitionVersion": "1.*.*-preview",
"groupNames": [],
"parameters": {
"checkLockedImmutabilityOnly": {
"value": "[parameters('checkLockedImmutabilityOnly')]"
},
"effect": {
"value": "[parameters('effect')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/d6f6f560-14b7-49a4-9fc8-d2c3a9807868",
"policyDefinitionReferenceId": "BackupRVault-Immutability"
},
{
"definitionVersion": "1.*.*-preview",
"groupNames": [],
"parameters": {
"checkAlwaysOnSoftDeleteOnly": {
"value": "[parameters('checkAlwaysOnSoftDeleteOnly')]"
},
"effect": {
"value": "[parameters('effect')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/9798d31d-6028-4dee-8643-46102185c016",
"policyDefinitionReferenceId": "BackupBVault-SoftDelete"
},
{
"definitionVersion": "1.*.*-preview",
"groupNames": [],
"parameters": {
"checkAlwaysOnSoftDeleteOnly": {
"value": "[parameters('checkAlwaysOnSoftDeleteOnly')]"
},
"effect": {
"value": "[parameters('effect')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/31b8092a-36b8-434b-9af7-5ec844364148",
"policyDefinitionReferenceId": "BackupRVault-SoftDelete"
},
{
"definitionVersion": "1.*.*-preview",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('effect')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/c58e083e-7982-4e24-afdc-be14d312389e",
"policyDefinitionReferenceId": "BackupBVault-MUA"
},
{
"definitionVersion": "1.*.*-preview",
"groupNames": [],
"parameters": {
"effect": {
"value": "[parameters('effect')]"
}
},
"policyDefinitionId": "/providers/Microsoft.Authorization/policyDefinitions/c7031eab-0fc0-4cd9-acd0-4497bd66d91a",
"policyDefinitionReferenceId": "BackupRVault-MUA"
}
],
"policyType": "Custom",
"version": "1.0.0"
},
"type": "Microsoft.Authorization/policySetDefinitions"
}BylawEnforce-Backup.bylaw.ps1 · 91 lines
# Converted from Enforce-Backup.1.0.0.alz_policy_set_definition.json by ConvertTo-Bylaw.
Initiative 'Enforce-Backup' {
Properties @{
DisplayName = 'Enforce enhanced recovery and backup policies'
Description = 'Enforce enhanced recovery and backup policies on assigned scopes.'
Category = 'Backup'
Version = '1.1.0'
PolicyVersion = '1.0.0'
Metadata = [ordered]@{ alzCloudEnvironments = @('AzureCloud', 'AzureChinaCloud', 'AzureUSGovernment'); source = 'https://github.com/Azure/Enterprise-Scale/' }
}
Parameter CheckAlwaysOnSoftDeleteOnly @{
Type = 'Boolean'
AllowedValues = @($true, $false)
Default = $false
DisplayName = 'CheckAlwaysOnSoftDeleteOnly'
Description = 'This parameter checks if Soft Delete is ''Locked'' for Backup Vaults in scope. Selecting ''true'' will mark only vaults with Soft Delete ''AlwaysOn'' as compliant. Selecting ''false'' will mark vaults that have Soft Delete either ''On'' or ''AlwaysOn'' as compliant.'
}
Parameter CheckLockedImmutabilityOnly @{
Type = 'Boolean'
AllowedValues = @($true, $false)
Default = $false
DisplayName = 'checkLockedImmutabilityOnly'
Description = 'This parameter checks if Immutability is locked for Backup Vaults in scope. Selecting ''true'' will mark only vaults with Immutability ''Locked'' as compliant. Selecting ''false'' will mark vaults that have Immutability either ''Enabled'' or ''Locked'' as compliant.'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy.'
}
PolicyDefinition @{
Id = '2514263b-bc0d-4b06-ac3e-f262c0979018'
ReferenceId = 'BackupBVault-Immutability'
Version = '1.*.*-preview'
Parameters = [ordered]@{
checkLockedImmutabiltyOnly = (Param CheckLockedImmutabilityOnly)
effect = (Param Effect)
}
}
PolicyDefinition @{
Id = 'd6f6f560-14b7-49a4-9fc8-d2c3a9807868'
ReferenceId = 'BackupRVault-Immutability'
Version = '1.*.*-preview'
Parameters = [ordered]@{
checkLockedImmutabilityOnly = (Param CheckLockedImmutabilityOnly)
effect = (Param Effect)
}
}
PolicyDefinition @{
Id = '9798d31d-6028-4dee-8643-46102185c016'
ReferenceId = 'BackupBVault-SoftDelete'
Version = '1.*.*-preview'
Parameters = [ordered]@{
checkAlwaysOnSoftDeleteOnly = (Param CheckAlwaysOnSoftDeleteOnly)
effect = (Param Effect)
}
}
PolicyDefinition @{
Id = '31b8092a-36b8-434b-9af7-5ec844364148'
ReferenceId = 'BackupRVault-SoftDelete'
Version = '1.*.*-preview'
Parameters = [ordered]@{
checkAlwaysOnSoftDeleteOnly = (Param CheckAlwaysOnSoftDeleteOnly)
effect = (Param Effect)
}
}
PolicyDefinition @{
Id = 'c58e083e-7982-4e24-afdc-be14d312389e'
ReferenceId = 'BackupBVault-MUA'
Version = '1.*.*-preview'
Parameters = @{
effect = (Param Effect)
}
}
PolicyDefinition @{
Id = 'c7031eab-0fc0-4cd9-acd0-4497bd66d91a'
ReferenceId = 'BackupRVault-MUA'
Version = '1.*.*-preview'
Parameters = @{
effect = (Param Effect)
}
}
}Members (6)
- Immutability must be enabled for backup vaults
- Immutability must be enabled for Recovery Services vaults
- Soft delete should be enabled for Backup Vaults
- Soft delete must be enabled for Recovery Services Vaults.
- Multi-User Authorization (MUA) must be enabled for Backup Vaults.
- Multi-User Authorization (MUA) must be enabled for Recovery Services Vaults.
Source: policy_set_definitions/Enforce-Backup.1.0.0.alz_policy_set_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw