Gallery › Sovereignty › Azure built-in policies
[Preview]: Azure NetApp Files volumes should replicate only with volumes in allowed locations
Converted Policy Audit Disabled Mode Indexed Version 1.0.0-preview Preview
Restrict the locations of Azure NetApp Files replication partners to meet data residency and sovereignty requirements. A volume in a replication relationship is non-compliant when the remote volume's region is outside the allowed replica locations, or when the volume is a replication destination outside the allowed replica locations. Volumes without replication are not evaluated. A source volume's own location is not evaluated.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
{
"properties": {
"displayName": "[Preview]: Azure NetApp Files volumes should replicate only with volumes in allowed locations",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Restrict the locations of Azure NetApp Files replication partners to meet data residency and sovereignty requirements. A volume in a replication relationship is non-compliant when the remote volume's region is outside the allowed replica locations, or when the volume is a replication destination outside the allowed replica locations. Volumes without replication are not evaluated. A source volume's own location is not evaluated.",
"metadata": {
"version": "1.0.0-preview",
"category": "Sovereignty",
"preview": true
},
"version": "1.0.0-preview",
"parameters": {
"allowedReplicaLocations": {
"type": "Array",
"metadata": {
"displayName": "Allowed replica locations",
"description": "The list of locations where Azure NetApp Files volume replicas and their replication partners are allowed.",
"strongType": "location"
}
},
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.NetApp/netAppAccounts/capacityPools/volumes"
},
{
"field": "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/dataProtection.replication.remoteVolumeResourceId",
"exists": "true"
},
{
"anyOf": [
{
"allOf": [
{
"field": "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/dataProtection.replication.remoteVolumeRegion",
"exists": "true"
},
{
"field": "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/dataProtection.replication.remoteVolumeRegion",
"notEquals": ""
},
{
"value": "[replace(toLower(field('Microsoft.NetApp/netAppAccounts/capacityPools/volumes/dataProtection.replication.remoteVolumeRegion')), ' ', '')]",
"notIn": "[parameters('allowedReplicaLocations')]"
}
]
},
{
"allOf": [
{
"field": "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/dataProtection.replication.endpointType",
"equals": "Dst"
},
{
"value": "[replace(toLower(field('location')), ' ', '')]",
"notIn": "[parameters('allowedReplicaLocations')]"
}
]
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0-PREVIEW"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/9860282b-3c80-4538-8bd7-dbc8cf012c6e",
"name": "9860282b-3c80-4538-8bd7-dbc8cf012c6e"
}# Converted from NetAppVolumeReplicaLocations_Audit.json by ConvertTo-Bylaw.
Policy '9860282b-3c80-4538-8bd7-dbc8cf012c6e' {
Properties @{
DisplayName = '[Preview]: Azure NetApp Files volumes should replicate only with volumes in allowed locations'
Description = 'Restrict the locations of Azure NetApp Files replication partners to meet data residency and sovereignty requirements. A volume in a replication relationship is non-compliant when the remote volume''s region is outside the allowed replica locations, or when the volume is a replication destination outside the allowed replica locations. Volumes without replication are not evaluated. A source volume''s own location is not evaluated.'
Version = '1.0.0-preview'
Category = 'Sovereignty'
Preview = $true
PolicyVersion = '1.0.0-preview'
Mode = 'Indexed'
}
Parameter AllowedReplicaLocations @{
Type = 'Array'
DisplayName = 'Allowed replica locations'
Description = 'The list of locations where Azure NetApp Files volume replicas and their replication partners are allowed.'
Metadata = [ordered]@{ strongType = 'location' }
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.NetApp/netAppAccounts/capacityPools/volumes' {
When {
Field dataProtection.replication.remoteVolumeResourceId | Must -Exist
}
Require 'dataProtection.replication.remoteVolumeRegion is as required' {
AnyOf {
Field dataProtection.replication.remoteVolumeRegion | Must -Not -Exist
Field dataProtection.replication.remoteVolumeRegion | Must -Be ''
Arm '[replace(toLower(field(''Microsoft.NetApp/netAppAccounts/capacityPools/volumes/dataProtection.replication.remoteVolumeRegion'')), '' '', '''')]' | Must -BeIn (Param AllowedReplicaLocations)
}
}
Require 'dataProtection.replication.endpointType and location are as required' {
AnyOf {
Field dataProtection.replication.endpointType | Must -Not -Be 'Dst' -IfPresent
Arm '[replace(toLower(field(''location'')), '' '', '''')]' | Must -BeIn (Param AllowedReplicaLocations)
}
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Sovereignty/NetAppVolumeReplicaLocations_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw