The Remove-AzPrivateDnsRecordConfig cmdlet removes a Private Domain Name System (DNS) record from a record set. The RecordSet object is an offline object, and changes to it do not change the Private DNS responses until after you run the Set-AzPrivateDnsRecordSet cmdlet to persist the change to the Microsoft Azure Private DNS service. To remove a record, all the fields for that record type must match exactly. You cannot add or remove SOA records. SOA records are automatically created when a Private DNS zone is created and automatically deleted when the Private DNS zone is deleted. You can pass the RecordSet object to this cmdlet as a parameter or by using the pipeline operator.
Examples
Example 1: Remove an A record from a record set
$RecordSet = Get-AzPrivateDnsRecordSet -Name "www" -RecordType A -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
Remove-AzPrivateDnsRecordConfig -RecordSet $RecordSet -Ipv4Address 1.2.3.4
Set-AzPrivateDnsRecordSet -RecordSet $RecordSet
# The above sequence can also be piped:
Get-AzPrivateDnsRecordSet -Name "www" -RecordType A -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" | Remove-AzPrivateDnsRecordConfig -Ipv4Address 1.2.3.4 | Set-AzPrivateDnsRecordSet
Id : /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myresourcegroup/providers/Micros
oft.Network/privateDnsZones/myzone.com/A/www
Name : www
ZoneName : myzone.com
ResourceGroupName : MyResourceGroup
Ttl : 3600
Etag : xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
RecordType : A
Records : {}
Metadata :
IsAutoRegistered :
This example removes an A record from an existing record set. If this is the only record in the record set, the result will be an empty record set. To remove a record set entirely, see Remove-AzPrivateDnsRecordSet.
Example 2: Remove an AAAA record from a record set
Id : /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myresourcegroup/providers/Micros
oft.Network/privateDnsZones/myzone.com/AAAA/www
Name : www
ZoneName : myzone.com
ResourceGroupName : MyResourceGroup
Ttl : 3600
Etag : xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
RecordType : AAAA
Records : {}
Metadata :
IsAutoRegistered :
This example removes an AAAA record from an existing record set. If this is the only record in the record set, the result will be an empty record set. To remove a record set entirely, see Remove-AzPrivateDnsRecordSet.
Example 3: Remove a CNAME record from a record set
Id : /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myresourcegroup/providers/Micros
oft.Network/privateDnsZones/myzone.com/CNAME/www
Name : www
ZoneName : myzone.com
ResourceGroupName : MyResourceGroup
Ttl : 3600
Etag : xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
RecordType : CNAME
Records : {}
Metadata :
IsAutoRegistered :
This example removes a CNAME record from an existing record set. Because a CNAME record set can contain at most one record, the result is an empty record set.
Id : /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myresourcegroup/providers/Micros
oft.Network/privateDnsZones/myzone.com/MX/www
Name : www
ZoneName : myzone.com
ResourceGroupName : MyResourceGroup
Ttl : 3600
Etag : xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
RecordType : MX
Records : {}
Metadata :
IsAutoRegistered :
This example removes an MX record from an existing record set. The record name "@" indicates a record set at the zone apex. If this is the only record in the record set, the result is an empty record set. To remove a record set entirely, see Remove-AzPrivateDnsRecordSet.
Id : /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myresourcegroup/providers/Micros
oft.Network/privateDnsZones/3.2.1.in-addr.arpa/PTR/4
Name : 4
ZoneName : 3.2.1.in-addr.arpa
ResourceGroupName : MyResourceGroup
Ttl : 3600
Etag : xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
RecordType : PTR
Records : {}
Metadata :
IsAutoRegistered :
This example removes a PTR record from an existing record set. If this is the only record in the record set, the result is an empty record set. To remove a record set entirely, see Remove-AzPrivateDnsRecordSet.
Id : /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myresourcegroup/providers/Micros
oft.Network/privateDnsZones/myzone.com/SRV/_sip._tcp
Name : _sip._tcp
ZoneName : myzone.com
ResourceGroupName : MyResourceGroup
Ttl : 3600
Etag : xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
RecordType : SRV
Records : {}
Metadata :
IsAutoRegistered :
This example removes an SRV record from an existing record set. If this is the only record in the record set, the result is an empty record set. To remove a record set entirely, see Remove-AzPrivateDnsRecordSet.
Example 7: Remove a TXT record from a record set
$RecordSet = Get-AzPrivateDnsRecordSet -Name "text" -RecordType TXT -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
Remove-AzPrivateDnsRecordConfig -RecordSet $RecordSet -Value "This is a TXT Record"
Set-AzPrivateDnsRecordSet -RecordSet $RecordSet
# The above sequence can also be piped:
Get-AzPrivateDnsRecordSet -Name "text" -RecordType TXT -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" | Remove-AzPrivateDnsRecordConfig -Value "This is a TXT Record" | Set-AzPrivateDnsRecordSet
Id : /subscriptions/xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myresourcegroup/providers/Micros
oft.Network/privateDnsZones/myzone.com/TXT/text
Name : text
ZoneName : myzone.com
ResourceGroupName : MyResourceGroup
Ttl : 3600
Etag : xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
RecordType : TXT
Records : {}
Metadata :
IsAutoRegistered :
This example removes a TXT record from an existing record set. If this is the only record in the record set, the result is an empty record set. To remove a record set entirely, see Remove-AzPrivateDnsRecordSet.
Parameters
-Cname
The canonical name of the CNAME record to remove.
Must not be relative to the name of the zone.
Must not have a terminating dot
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.