I'm wondering if I need to clear some cache or something with the issue I'm having.
I'm trying to remove A records from a DNS Zone and replacing them with a CName record that has the same host name.
Remove-DnsServerResourceRecord -Zonename $line -InputObject $record -Force
Add-DnsServerResourceRecordCName -Zonename $line -Name $hostname -TimeToLive $ttl -HostNameAlias $target
This throws me:
Add-DnsServerResourceRecordCName : Failed to create resource record @ in zone zone.tld on server NS01.
At C:\admin\updatettl.ps1:56 char:4
+ Add-DnsServerResourceRecordCName -Zonename $line -Name $hostname > -TimeToLive …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ResourceExists: (@:root/Microsoft/…urceRecordCName) > [Add-DnsServerResourceRecordCName]
, CimException
+ FullyQualifiedErrorId : WIN32 9709,Add-DnsServerResourceRecordCName
Any ideas?
Thanks
Best Answer
Microsofts DNS Server implementation will not allow you to create a CNAME at the zone apex as per RFC 1034 ยง3.6.2.
The error you receive (9709,
DNS_ERROR_CNAME_COLLISION
) is a bit cryptic, but you won't (and shouldn't) be able to add it anyways.On the other hand, placing a CNAME RR at the apex effectively introduces a collision with the NS and SOA records for the zone, at which point the error does make some sense