The Add-AzPrivateDnsRecordConfig cmdlet adds a Private Domain Name System (DNS) record to a RecordSet object. 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. SOA records are created when a Private DNS zone is created, and are removed when the Private DNS zone is deleted. You cannot add or remove SOA records, but you can edit them. You can pass the RecordSet object to this cmdlet as a parameter or by using the pipeline operator.
Examples
Example 1: Add an A record to a record set
$RecordSet = Get-AzPrivateDnsRecordSet -Name www -RecordType A -ResourceGroupName MyResourceGroup -ZoneName myzone.com
Add-AzPrivateDnsRecordConfig -RecordSet $RecordSet -Ipv4Address 1.2.3.4
Set-AzPrivateDnsRecordSet -RecordSet $RecordSet
# You can also pipe the above sequence:
Get-AzPrivateDnsRecordSet -Name www -RecordType A -ResourceGroupName MyResourceGroup -ZoneName myzone.com | Add-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 : {1.2.3.4}
Metadata :
IsAutoRegistered :
This example adds an A record to an existing record set.
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 : {[0,5,8080,sipservice.contoso.com]}
Metadata :
IsAutoRegistered :
This example adds a SRV record to an existing record set.
Example 7: Add a TXT record to a record set
$RecordSet = Get-AzPrivateDnsRecordSet -Name text -RecordType TXT -ResourceGroupName MyResourceGroup -ZoneName myzone.com
Add-AzPrivateDnsRecordConfig -RecordSet $RecordSet -Value "This is a TXT Record"
Set-AzPrivateDnsRecordSet -RecordSet $RecordSet
# You can also pipe the above sequence:
Get-AzPrivateDnsRecordSet -Name text -RecordType TXT -ResourceGroupName MyResourceGroup -ZoneName myzone.com | Add-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 : {This is a TXT Record}
Metadata :
IsAutoRegistered :
This example adds a TXT record to an existing record set.
Parameters
-Cname
The canonical name for the CNAME record to add.
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.