The New-AzDnsRecordConfig cmdlet creates a local DnsRecord object.
An array of these objects is passed to the New-AzDnsRecordSet cmdlet using the DnsRecords parameter to specify the records to create in the record set.
Examples
Example 1: Create a RecordSet of type A
$Records = @()
$Records += New-AzDnsRecordConfig -IPv4Address 1.2.3.4
$RecordSet = New-AzDnsRecordSet -Name "www" -RecordType A -ResourceGroupName "MyResourceGroup" -TTL 3600 -ZoneName "myzone.com" -DnsRecords $Records
# When creating a RecordSet containing a single record, the above sequence can also be condensed into a single line:
$RecordSet = New-AzDnsRecordSet -Name "www" -RecordType A -ResourceGroupName "MyResourceGroup" -TTL 3600 -ZoneName "myzone.com" -DnsRecords (New-AzDnsRecordConfig -IPv4Address 1.2.3.4)
# To create a record set containing multiple records, use New-AzDnsRecordConfig to add each record to the $Records array,
# then call New-AzDnsRecordSet, as follows:
$Records = @()
$Records += New-AzDnsRecordConfig -IPv4Address 1.2.3.4
$Records += New-AzDnsRecordConfig -IPv4Address 5.6.7.8
$RecordSet = New-AzDnsRecordSet -Name "www" -RecordType A -ResourceGroupName "MyResourceGroup" -TTL 3600 -ZoneName "myzone.com" -DnsRecords $Records
This example creates a RecordSet named www in the zone myzone.com.
The record set is of type A and has a TTL of 1 hour (3600 seconds).
It contains a single DNS record.
This example creates a RecordSet named www in the zone myzone.com.
The record set is of type AAAA and has a TTL of 1 hour (3600 seconds).
It contains a single DNS record.
To create a RecordSet using only one line of pn_PowerShell_short, or to create a record set with multiple records, see Example 1.
This example creates a RecordSet named www in the zone myzone.com.
The record set is of type CNAME and has a TTL of 1 hour (3600 seconds).
It contains a single DNS record.
To create a RecordSet using only one line of pn_PowerShell_short, or to create a record set with multiple records, see Example 1.
This command creates a RecordSet named www in the zone myzone.com.
The record set is of type MX and has a TTL of 1 hour (3600 seconds).
It contains a single DNS record.
To create a RecordSet using only one line of pn_PowerShell_short, or to create a record set with multiple records, see Example 1.
This command creates a RecordSet named ns1 in the zone myzone.com.
The record set is of type NS and has a TTL of 1 hour (3600 seconds).
It contains a single DNS record.
To create a RecordSet using only one line of pn_PowerShell_short, or to create a record set with multiple records, see Example 1.
This command creates a RecordSet named 4 in the zone 3.2.1.in-addr.arpa.
The record set is of type PTR and has a TTL of 1 hour (3600 seconds).
It contains a single DNS record.
To create a RecordSet using only one line of pn_PowerShell_short, or to create a record set with multiple records, see Example 1.
This command creates a RecordSet named _sip._tcp in the zone myzone.com.
The record set is of type SRV and has a TTL of 1 hour (3600 seconds).
It contains a single DNS record, pointing to the IP address 2001.2.3.4.
The service (sip) and the protocol (tcp) are specified as part of the record set name, not as part of the record data.
To create a RecordSet using only one line of pn_PowerShell_short, or to create a record set with multiple records, see Example 1.
This command creates a RecordSet named text in the zone myzone.com.
The record set is of type TXT and has a TTL of 1 hour (3600 seconds).
It contains a single DNS record.
To create a RecordSet using only one line of pn_PowerShell_short, or to create a record set with multiple records, see Example 1.
This command creates a RecordSet named childds in the zone myzone.com.
The record set is of type DS and has a TTL of 1 hour (3600 seconds).
It contains a single DNS record.
The record data contains the key tag, algorithm, digest type, and digest of the child zone's DNSKEY record.
To create a RecordSet using only one line of pn_PowerShell_short, or to create a record set with multiple records, see Example 1.
This command creates a RecordSet named _443._tcp.www in the zone myzone.com.
The record set is of type TLSA and has a TTL of 1 hour (3600 seconds).
It contains a single DNS record.
The record data contains the usage, selector, and matching type of the certificate association data.
To create a RecordSet using only one line of pn_PowerShell_short, or to create a record set with multiple records, see Example 1.
This command creates a RecordSet named naptr123 in the zone myzone.com.
The record set is of type NAPTR and has a TTL of 1 hour (3600 seconds).
It contains a single DNS record.
The record data contains the order, preference, flags, services, regexp, and replacement fields.
To create a RecordSet using only one line of pn_PowerShell_short, or to create a record set with multiple records, see Example 1.
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.