Gallery › SQL › Azure built-in policies
SQL Managed Instances should avoid using GRS backup redundancy
Converted Policy Deny Disabled Mode Indexed Version 2.0.0
Managed Instances should avoid using the default geo-redundant storage for backups, if data residency rules require data to stay within a specific region. Note: Azure Policy is not enforced when creating a database using T-SQL. If not explicitly specified, database with geo-redundant backup storage is created via T-SQL.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONSqlManagedInstance_BlockGrsBackupRedundancy_Deny.json · 93 lines
{
"properties": {
"displayName": "SQL Managed Instances should avoid using GRS backup redundancy",
"description": "Managed Instances should avoid using the default geo-redundant storage for backups, if data residency rules require data to stay within a specific region. Note: Azure Policy is not enforced when creating a database using T-SQL. If not explicitly specified, database with geo-redundant backup storage is created via T-SQL.",
"mode": "Indexed",
"policyType": "BuiltIn",
"metadata": {
"version": "2.0.0",
"category": "SQL"
},
"version": "2.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Deny",
"Disabled"
],
"defaultValue": "Deny"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Sql/managedInstances"
},
{
"anyOf": [
{
"allOf": [
{
"value": "[requestContext().apiVersion]",
"lessOrEquals": "2021-02-01-preview"
},
{
"not": {
"anyOf": [
{
"field": "Microsoft.Sql/managedInstances/storageAccountType",
"equals": "LRS"
},
{
"field": "Microsoft.Sql/managedInstances/storageAccountType",
"equals": "ZRS"
}
]
}
}
]
},
{
"allOf": [
{
"value": "[requestContext().apiVersion]",
"greater": "2021-02-01-preview"
},
{
"not": {
"anyOf": [
{
"field": "Microsoft.Sql/managedInstances/requestedBackupStorageRedundancy",
"equals": "Local"
},
{
"field": "Microsoft.Sql/managedInstances/requestedBackupStorageRedundancy",
"equals": "Zone"
}
]
}
}
]
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"2.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/a9934fd7-29f2-4e6d-ab3d-607ea38e9079",
"name": "a9934fd7-29f2-4e6d-ab3d-607ea38e9079"
}Bylawa9934fd7-29f2-4e6d-ab3d-607ea38e9079.bylaw.ps1 · 44 lines
# Converted from SqlManagedInstance_BlockGrsBackupRedundancy_Deny.json by ConvertTo-Bylaw.
Policy 'a9934fd7-29f2-4e6d-ab3d-607ea38e9079' {
Properties @{
DisplayName = 'SQL Managed Instances should avoid using GRS backup redundancy'
Description = 'Managed Instances should avoid using the default geo-redundant storage for backups, if data residency rules require data to stay within a specific region. Note: Azure Policy is not enforced when creating a database using T-SQL. If not explicitly specified, database with geo-redundant backup storage is created via T-SQL.'
Version = '2.0.0'
Category = 'SQL'
PolicyVersion = '2.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Deny', 'Disabled')
Default = 'Deny'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Sql/managedInstances' {
Require 'storageAccountType is as required' {
AnyOf {
Arm '[requestContext().apiVersion]' | Must -BeGreaterThan '2021-02-01-preview'
AnyOf {
Field storageAccountType | Must -Be 'LRS'
Field storageAccountType | Must -Be 'ZRS'
}
}
}
Require 'requestedBackupStorageRedundancy is as required' {
AnyOf {
Arm '[requestContext().apiVersion]' | Must -BeLessOrEqual '2021-02-01-preview'
AnyOf {
Field requestedBackupStorageRedundancy | Must -Be 'Local'
Field requestedBackupStorageRedundancy | Must -Be 'Zone'
}
}
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/SQL/SqlManagedInstance_BlockGrsBackupRedundancy_Deny.json in Azure/azure-policy, under the MIT licence.
Bylaw