forked from phealy/azure-custom-dns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
privateDNShubLinkPolicyDeployINE.json
90 lines (90 loc) · 3.18 KB
/
privateDNShubLinkPolicyDeployINE.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{
"properties": {
"displayName": "Private DNS - deployINE virtual network link",
"policyType": "Custom",
"mode": "All",
"description": "Automatically create a link to a selected virtual network when a private DNS zone is created. This is useful when DNS zones need to be linked to a hub virtual network where DNS forwarders have been deployed.",
"parameters": {
"virtualNetworkLinkName": {
"type": "String",
"metadata": {
"displayName": "Virtual Network Link Name",
"description": "The name of the virtual network link to create"
}
},
"targetVnet": {
"type": "String",
"metadata": {
"displayName": "Target virtual network",
"description": "The target virtual network for Private DNS zone connections"
}
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.Network/privateDnsZones"
},
"then": {
"effect": "deployIfNotExists",
"details": {
"type": "Microsoft.Network/privateDnsZones/virtualNetworkLinks",
"name": "[parameters('virtualNetworkLinkName')]",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/4d97b98b-1d4f-4787-a291-c67834d212e7"
],
"existenceCondition": {
"field": "Microsoft.Network/privateDnsZones/virtualNetworkLinks/virtualNetwork.id",
"equals": "[parameters('targetVnet')]"
},
"deployment": {
"properties": {
"mode": "incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"privateDNSZoneName": {
"type": "string"
},
"virtualNetworkLinkName": {
"type": "string"
},
"targetVnetId": {
"type": "string"
}
},
"resources": [
{
"name": "[concat(parameters('privateDNSZoneName'), '/', parameters('virtualNetworkLinkName'))]",
"type": "Microsoft.Network/privateDnsZones/virtualNetworkLinks",
"apiVersion": "2018-09-01",
"tags": {},
"location": "global",
"properties": {
"virtualNetwork": {
"id": "[parameters('targetVnetId')]"
},
"registrationEnabled": false
}
}
]
},
"parameters": {
"privateDNSZoneName": {
"value": "[field('name')]"
},
"virtualNetworkLinkName": {
"value": "[parameters('virtualNetworkLinkName')]"
},
"targetVnetId": {
"value": "[parameters('targetVnet')]"
}
}
}
}
}
}
}
}
}