PowerShell ile Azure DNS Zone ve Kayıt Yönetimi

Kurumsal DNS yönetimi onlarca veya yüzlerce kayıt içerebilir. PowerShell ile DNS kayıtlarını toplu oluşturabilir ve mevcut yapılandırmayı yedekleyebilirsiniz.

DNS Zone ve Kayıt Oluşturmak

PowerShell
New-AzprivateDnsZone -ResourceGroupName "newrg-" -Name "bakionur.com"
 
New-AzprivateDnsRecordSet -ResourceGroupName "newrg-" -ZoneName "bakionur.com" `
    -Name "www" -RecordType A -Ttl 3600 `
    -privatednsrecord (New-AzPrivateDnsRecordConfig -IPv4Address "90.90.90.90")
 
New-AzprivateDnsRecordSet -ResourceGroupName "newrg-" -ZoneName "bakionur.com" `
    -Name "api" -RecordType CNAME -Ttl 3600 `
    -privatednsrecord (New-AzPrivateDnsRecordConfig -Cname "onurtestapp.azurewebsites.net")
Write-Host "DNS kayıtları olusturuldu." -ForegroundColor Green
 

Tüm DNS Kayıtlarını Yedeklemek

PowerShell
$records = Get-AzprivateDnsRecordSet -ResourceGroupName "newrg-" -ZoneName "bakionur.com"
$records | Select-Object Name, RecordType, Ttl,
    @{N="Value"; E={ ($_.Records | ForEach-Object { $_.ToString() }) -join "," }} |
    Export-Csv "dns_backup_$(Get-Date -Format 'yyyyMMdd').csv" -NoTypeInformation
Write-Host "DNS yedegi alındı." -ForegroundColor Cyan