Get-AzDnsRecordSet

Gets a DNS record set.

Syntax

Get-AzDnsRecordSet
   [-Name <String>]
   -ZoneName <String>
   -ResourceGroupName <String>
   [-RecordType <RecordType>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzDnsRecordSet
   [-Name <String>]
   -Zone <DnsZone>
   [-RecordType <RecordType>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Get-AzDnsRecordSet cmdlet gets the Domain Name System (DNS) record set with the specified name and type, in the specified zone. If you do not specify the Name or RecordType parameters, this cmdlet returns all record sets of the specified type in the zone. If you specify the RecordType parameter but not the Name parameter, this cmdlet returns all record sets of the specified record type. You can use the pipeline operator to pass a DnsZone object to this cmdlet, or you can pass a DnsZone object as the Zone parameter, or alternatively you can specify the zone and resource group by name.

Examples

Example 1: Get record sets with a specified name and type

$RecordSet = Get-AzDnsRecordSet -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" -Name "www" -RecordType A

This command gets the record set of record type A named www in the specified resource group and zone, and then stores it in the $RecordSet variable. Because the Name and RecordType parameters are specified, only one RecordSet object is returned.

Example 2: Get record sets of a specified type

$RecordSets = Get-AzDnsRecordSet -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" -RecordType A

This command gets an array of all record sets of record type A in the zone named myzone.com in the resource group named MyResourceGroup, and then stores them in the $RecordSets variable.

Example 3: Get all record sets in a zone

$RecordSets = Get-AzDnsRecordSet -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"

This command gets an array of all record sets in the zone named myzone.com in the resource group named MyResourceGroup, and then stores them in the $RecordSets variable.

Example 4: Get all record sets in a zone, using a DnsZone object

$Zone = Get-AzDnsZone -Name "myzone.com" -ResourceGroupName "MyResourceGroup"
$RecordSets = Get-AzDnsRecordSet -Zone $Zone

This example is equivalent to Example 3 above. This time, the zone is specified using a zone object.

Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specifies the name of the RecordSet to get. If you do not specify the Name parameter, all record sets of the specified type are returned.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-RecordType

Specifies the type of DNS record that this cmdlet gets. Valid values are:

  • A
  • AAAA
  • CNAME
  • MX
  • NAPTR
  • NS
  • PTR
  • SOA
  • SRV
  • TXT If you do not specify the RecordType parameter, you must also omit the Name parameter. This cmdlet then returns all record sets in the zone (of all names and types).
Type:Nullable<T>[RecordType]
Accepted values:A, Aaaa, CAA, Cname, MX, NS, PTR, SOA, SRV, TXT, Tlsa, DS, Naptr
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

Specifies the resource group that contains the DNS zone. The zone name must also be specified, using the ZoneName parameter. Alternatively, you can specify the zone and resource group by passing in a DnsZone object using the Zone parameter.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-Zone

Specifies the DNS zone that contains the record set that this cmdlet gets. Alternatively, you can specify the zone using the ZoneName and ResourceGroupName parameters.

Type:DnsZone
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-ZoneName

Specifies the name of the DNS zone that contains the record set to get. The resource group containing the zone must also be specified, using the ResourceGroupName parameter. Alternatively, you can specify the zone and resource group by passing in a DNS Zone object using the Zone parameter.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

DnsZone

Nullable<T>[[Microsoft.Azure.Management.Dns.Models.RecordType, Microsoft.Azure.Management.Dns, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]

Outputs

DnsRecordSet