Get-AzureRmDnsRecordSet

Gets a DNS record set.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

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

Description

The Get-AzureRmDnsRecordSet 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

PS C:\>$RecordSet = Get-AzureRmDnsRecordSet -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

PS C:\>$RecordSets = Get-AzureRmDnsRecordSet -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

PS C:\>$RecordSets = Get-AzureRmDnsRecordSet -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

PS C:\> $Zone = Get-AzureRmDnsZone -Name "myzone.com" -ResourceGroupName "MyResourceGroup"
PS C:\> $RecordSets = Get-AzureRmDnsRecordSet -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: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
  • 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
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

Parameters: Zone (ByValue)

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

Outputs

DnsRecordSet