0

The command to create Azure Private Dns zone iss as below :

'''$dnszone = New-AzPrivateDnsZone -ResourceGroupName “Test” -Name “privatelink.database.windows.net”'''

the name parameter value "privatelink.database.windows.net" we need to type manually.

How can we autofetch it or auto create it based on the object for which we are creating Private End Point ??

1 Answers1

0

You can use it like this:

$sqlserverFQDN = (Get-AzResource -ResourceType "Microsoft.Sql/servers" -Name $serverName -ResourceGroupName $rgName ).Properties.fullyQualifiedDomainName

$result= $sqlserverFQDN -replace "$serverName","privatelink"

echo $result

enter image description here

Nancy
  • 26,865
  • 3
  • 18
  • 34
  • Thanks You for your answer. I also wanted to ask what logic can we apply if we want to consider other resources like Storage Account , etc etc ? – Manvendra Bele Jan 14 '21 at 12:05
  • You can see the Private DNS zone name [here](https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-dns#azure-services-dns-zone-configuration) for your Azure service. Usually, it's adding `privatelink` prefix in the part of FQDN of Azure service endpoint. – Nancy Jan 15 '21 at 01:32