@@ -124,6 +124,41 @@ $subnet = $virtualNetwork | Select -ExpandProperty subnets | Where-Object {$_.N
124
124
$privateEndpoint = New-AzPrivateEndpoint -ResourceGroupName $ResourceGroupName -Name $PrivateEndpointName -Location "westcentralus" -Subnet $subnet -PrivateLinkServiceConnection $privateEndpointConnection
125
125
```
126
126
127
+ ### Integrate the private endpoint with private DNS zone
128
+
129
+ After you create the private endpoint, you can integrate it with a private DNS zone by using the following PowerSehll script:
130
+
131
+ ``` azurepowershell-interactive
132
+ Import-Module Az.PrivateDns
133
+ $zoneName = "privatelink.documents.azure.com"
134
+ $zone = New-AzPrivateDnsZone -ResourceGroupName $ResourceGroupName `
135
+ -Name $zoneName
136
+
137
+ $link = New-AzPrivateDnsVirtualNetworkLink -ResourceGroupName $ResourceGroupName `
138
+ -ZoneName $zoneName `
139
+ -Name "myzonelink" `
140
+ -VirtualNetworkId $virtualNetwork.Id
141
+
142
+ $pe = Get-AzPrivateEndpoint -Name $PrivateEndpointName `
143
+ -ResourceGroupName $ResourceGroupName
144
+
145
+ $networkInterface = Get-AzResource -ResourceId $pe.NetworkInterfaces[0].Id `
146
+ -ApiVersion "2019-04-01"
147
+
148
+ foreach ($ipconfig in $networkInterface.properties.ipConfigurations) {
149
+ foreach ($fqdn in $ipconfig.properties.privateLinkConnectionProperties.fqdns) {
150
+ Write-Host "$($ipconfig.properties.privateIPAddress) $($fqdn)"
151
+ $recordName = $fqdn.split('.',2)[0]
152
+ $dnsZone = $fqdn.split('.',2)[1]
153
+ New-AzPrivateDnsRecordSet -Name $recordName `
154
+ -RecordType A -ZoneName $zoneName `
155
+ -ResourceGroupName $ResourceGroupName -Ttl 600 `
156
+ -PrivateDnsRecords (New-AzPrivateDnsRecordConfig `
157
+ -IPv4Address $ipconfig.properties.privateIPAddress)
158
+ }
159
+ }
160
+ ```
161
+
127
162
### Fetch the private IP addresses
128
163
129
164
After the private endpoint is provisioned, you can query the IP addresses and the FQDNS mapping by using the following PowerShell script:
0 commit comments