Did you try
az network dns zone export
https://learn.microsoft.com/en-us/azure/dns/dns-import-export
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Folks,
I have a private DNS zone group with over 500 record sets. I need to move these record sets to another subscription. Is there an automated way to accomplish this?
Manually, I would need to open each individual private endpoint from recordsets and delete and add records, but with over 500 endpoints, this is time-consuming and inefficient.
I've written a script to automate this process, but it's not working. All the variables are correct and the resources exist, but no errors are being returned.
foreach ($endpointName in $endpointNames) {
Write-Host "Processing Private Endpoint: $endpointName"
$endpointNameWithEndpt = "$endpointName-endpt"
az account set --subscription $Subscriptiondev
# Get private endpoint details
$privateEndpoint = Get-AzPrivateEndpoint -Name $endpointNameWithEndpt
$resourceGroupName = $privateEndpoint.ResourceGroupName
Write-Host "Resource Group: $resourceGroupName"
# Fetch DNS zone group details
$dnsZoneGroup = az network private-endpoint dns-zone-group list `
--endpoint-name $endpointNameWithEndpt `
--resource-group $resourceGroupName `
--query "[].privateDnsZoneConfigs[].privateDnsZoneId" -o json | ConvertFrom-Json
if ($dnsZoneGroup) {
foreach ($dnsZoneId in $dnsZoneGroup) {
$dnsZoneName = ($dnsZoneId -split "/")[-1]
Write-Host "Found Private DNS Zone: $dnsZoneName"
Write-Host "Removing DNS Zone: $dnsZoneName from endpoint: $endpointNameWithEndpt"
az network private-endpoint dns-zone-group remove `
--resource-group $resourceGroupName `
--endpoint-name $endpointNameWithEndpt `
--zone-name $dnsZoneName `
--name "default" `
--subscription $Subscriptiondev
}
} else {
Write-Host "No DNS zones associated with $endpointNameWithEndpt"
}
}
Did you try
az network dns zone export
https://learn.microsoft.com/en-us/azure/dns/dns-import-export