Edit

Share via


Get-AzDnsRecordSet

Gets a DNS record set.

Syntax

Fields

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

Object

Get-AzDnsRecordSet
    -Zone <DnsZone>
    [-Name <String>]
    [-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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Fields
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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).

Parameter properties

Type:

Nullable<T>[RecordType]

Default value:None
Accepted values:A, Aaaa, CAA, Cname, MX, NS, PTR, SOA, SRV, TXT, Tlsa, DS, Naptr
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Fields
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:DnsZone
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Object
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Fields
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

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.

Inputs

String

DnsZone

Nullable<T>

Outputs

DnsRecordSet