last sync: 2021-Nov-26 17:15:01 UTC

Azure Policy definition

[Preview]: Configure Recovery Services vaults to use private DNS zones for backup

Name [Preview]: Configure Recovery Services vaults to use private DNS zones for backup
Azure Portal
Id af783da1-4ad1-42be-800d-d19c70038820
Version 1.0.1-preview
details on versioning
Category Backup
Microsoft docs
Description Use private DNS zones to override the DNS resolution for a private endpoint. A private DNS zone links to your virtual network to resolve to your Recovery Services vault. Learn more at: https://aka.ms/AB-PrivateEndpoints.
Mode Indexed
Type BuiltIn
Preview True
Deprecated FALSE
Effect Default: DeployIfNotExists
Allowed: (DeployIfNotExists, Disabled)
Used RBAC Role
Role Name Role Id
Network Contributor 4d97b98b-1d4f-4787-a291-c67834d212e7
History
Date/Time (UTC ymd) (i) Change type Change detail
2021-07-30 15:17:20 change Patch, suffix remains equal (1.0.0-preview > 1.0.1-preview)
2021-05-26 13:43:16 add af783da1-4ad1-42be-800d-d19c70038820
Used in Initiatives none
JSON Changes

JSON
{
  "displayName": "[Preview]: Configure Recovery Services vaults to use private DNS zones for backup",
  "policyType": "BuiltIn",
  "mode": "Indexed",
  "description": "Use private DNS zones to override the DNS resolution for a private endpoint. A private DNS zone links to your virtual network to resolve to your Recovery Services vault. Learn more at: https://aka.ms/AB-PrivateEndpoints.",
  "metadata": {
    "version": "1.0.1-preview",
    "preview": true,
    "category": "Backup"
  },
  "parameters": {
    "privateDnsZone-Backup": {
      "type": "String",
      "metadata": {
        "displayName": "Private DNS Zone ID for backup",
        "description": "Specifies private DNS Zone ID required to resolve DNS to private IP for the Azure Backup service.",
        "strongType": "Microsoft.Network/privateDnsZones",
        "assignPermissions": true
      }
    },
    "privateDnsZone-Blob": {
      "type": "String",
      "metadata": {
        "displayName": "Private DNS Zone ID for blobs",
        "description": "Specifies private DNS Zone ID required to resolve DNS to private IP for the Azure Blob service.",
        "strongType": "Microsoft.Network/privateDnsZones",
        "assignPermissions": true
      }
    },
    "privateDnsZone-Queue": {
      "type": "String",
      "metadata": {
        "displayName": "Private DNS Zone ID for queues",
        "description": "Specifies private DNS Zone ID required to resolve DNS to private IP for the Azure Queue service.",
        "strongType": "Microsoft.Network/privateDnsZones",
        "assignPermissions": true
      }
    },
    "effect": {
      "type": "String",
      "metadata": {
        "displayName": "Effect",
        "description": "Enable or disable the execution of the policy."
      },
      "allowedValues": [
        "DeployIfNotExists",
        "Disabled"
      ],
      "defaultValue": "DeployIfNotExists"
    }
  },
  "policyRule": {
    "if": {
      "allOf": [
        {
          "field": "type",
          "equals": "Microsoft.Network/privateEndpoints"
        },
        {
          "count": {
            "field": "Microsoft.Network/privateEndpoints/privateLinkServiceConnections[*]",
            "where": {
              "allOf": [
                {
                  "field": "Microsoft.Network/privateEndpoints/privateLinkServiceConnections[*].privateLinkServiceId",
                  "contains": "Microsoft.RecoveryServices/vaults"
                },
                {
                  "field": "Microsoft.Network/privateEndpoints/privateLinkServiceConnections[*].groupIds[*]",
                  "equals": "AzureBackup"
                }
              ]
            }
          },
          "greaterOrEquals": 1
        }
      ]
    },
    "then": {
      "effect": "[parameters('effect')]",
      "details": {
        "type": "Microsoft.Network/privateEndpoints/privateDnsZoneGroups",
        "roleDefinitionIds": [
          "/providers/Microsoft.Authorization/roleDefinitions/4d97b98b-1d4f-4787-a291-c67834d212e7"
        ],
        "deployment": {
          "properties": {
            "mode": "incremental",
            "template": {
              "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
              "contentVersion": "1.0.0.0",
              "parameters": {
                "privateDnsZone-Backup": {
                  "type": "string"
                },
                "privateDnsZone-Blob": {
                  "type": "string"
                },
                "privateDnsZone-Queue": {
                  "type": "string"
                },
                "privateEndpointName": {
                  "type": "string"
                },
                "location": {
                  "type": "string"
                }
              },
              "resources": [
                {
                  "name": "[concat(parameters('privateEndpointName'), '/deployedByPolicy')]",
                  "type": "Microsoft.Network/privateEndpoints/privateDnsZoneGroups",
                  "apiVersion": "2020-03-01",
                  "location": "[parameters('location')]",
                  "properties": {
                    "privateDnsZoneConfigs": [
                      {
                        "name": "privateDnsZone-Backup",
                        "properties": {
                          "privateDnsZoneId": "[parameters('privateDnsZone-Backup')]"
                        }
                      },
                      {
                        "name": "privateDnsZone-Blob",
                        "properties": {
                          "privateDnsZoneId": "[parameters('privateDnsZone-Blob')]"
                        }
                      },
                      {
                        "name": "privateDnsZone-Queue",
                        "properties": {
                          "privateDnsZoneId": "[parameters('privateDnsZone-Queue')]"
                        }
                      }
                    ]
                  }
                }
              ]
            },
            "parameters": {
              "privateDnsZone-Backup": {
                "value": "[parameters('privateDnsZone-Backup')]"
              },
              "privateDnsZone-Blob": {
                "value": "[parameters('privateDnsZone-Blob')]"
              },
              "privateDnsZone-Queue": {
                "value": "[parameters('privateDnsZone-Queue')]"
              },
              "privateEndpointName": {
                "value": "[field('name')]"
              },
              "location": {
                "value": "[field('location')]"
              }
            }
          }
        }
      }
    }
  }
}