Edit

Share via


Remove-AzDnsRecordConfig

Removes a DNS record from a local record set object.

Syntax

A

Remove-AzDnsRecordConfig
    -RecordSet <DnsRecordSet>
    -Ipv4Address <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

AAAA

Remove-AzDnsRecordConfig
    -RecordSet <DnsRecordSet>
    -Ipv6Address <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

NS

Remove-AzDnsRecordConfig
    -RecordSet <DnsRecordSet>
    -Nsdname <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

MX

Remove-AzDnsRecordConfig
    -RecordSet <DnsRecordSet>
    -Exchange <String>
    -Preference <UInt16>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

NAPTR

Remove-AzDnsRecordConfig
    -RecordSet <DnsRecordSet>
    -Preference <UInt16>
    -Order <UInt16>
    -Flags <String>
    -Services <String>
    -Regexp <String>
    -Replacement <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

PTR

Remove-AzDnsRecordConfig
    -RecordSet <DnsRecordSet>
    -Ptrdname <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

TXT

Remove-AzDnsRecordConfig
    -RecordSet <DnsRecordSet>
    -Value <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

SRV

Remove-AzDnsRecordConfig
    -RecordSet <DnsRecordSet>
    -Priority <UInt16>
    -Target <String>
    -Port <UInt16>
    -Weight <UInt16>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

CNAME

Remove-AzDnsRecordConfig
    -RecordSet <DnsRecordSet>
    -Cname <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Caa

Remove-AzDnsRecordConfig
    -RecordSet <DnsRecordSet>
    -CaaFlags <Byte>
    -CaaTag <String>
    -CaaValue <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

DS

Remove-AzDnsRecordConfig
    -RecordSet <DnsRecordSet>
    -KeyTag <Int32>
    -Algorithm <Int32>
    -DigestType <Int32>
    -Digest <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

TLSA

Remove-AzDnsRecordConfig
    -RecordSet <DnsRecordSet>
    -Usage <Int32>
    -Selector <Int32>
    -MatchingType <Int32>
    -CertificateAssociationData <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Remove-AzDnsRecordConfig cmdlet removes a Domain Name System (DNS) record from a record set. The RecordSet object is an offline object, and changes to it do not change the DNS responses until after you run the Set-AzDnsRecordSet cmdlet to persist the change to the Microsoft Azure DNS service. To remove a record, all the fields for that record type must match exactly. You cannot add or remove SOA records. SOA records are automatically created when a DNS zone is created and automatically deleted when the DNS zone is deleted. You can pass the RecordSet object to this cmdlet as a parameter or by using the pipeline operator.

Examples

Example 1: Remove an A record from a record set

$RecordSet = Get-AzDnsRecordSet -Name "www" -RecordType A -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
Remove-AzDnsRecordConfig -RecordSet $RecordSet -Ipv4Address 1.2.3.4
Set-AzDnsRecordSet -RecordSet $RecordSet

# The above sequence can also be piped:

Get-AzDnsRecordSet -Name "www" -RecordType A -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" | Remove-AzDnsRecordConfig -Ipv4Address 1.2.3.4 | Set-AzDnsRecordSet

This example removes an A record from an existing record set. If this is the only record in the record set, the result will be an empty record set. To remove a record set entirely, see Remove-AzDnsRecordSet.

Example 2: Remove an AAAA record from a record set

$RecordSet = Get-AzDnsRecordSet -Name "www" -RecordType AAAA -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
Remove-AzDnsRecordConfig -RecordSet $RecordSet -Ipv6Address 2001:DB80:4009:1803::1005
Set-AzDnsRecordSet -RecordSet $RecordSet

# The above sequence can also be piped:

Get-AzDnsRecordSet -Name "www" -RecordType AAAA -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" | Remove-AzDnsRecordConfig -Ipv6Address 2001:DB80:4009:1803::1005 | Set-AzDnsRecordSet

This example removes an AAAA record from an existing record set. If this is the only record in the record set, the result will be an empty record set. To remove a record set entirely, see Remove-AzDnsRecordSet.

Example 3: Remove a CNAME record from a record set

$RecordSet = Get-AzDnsRecordSet -Name "www" -RecordType CNAME -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
Remove-AzDnsRecordConfig -RecordSet $RecordSet -Cname contoso.com
Set-AzDnsRecordSet -RecordSet $RecordSet

# The above sequence can also be piped:

Get-AzDnsRecordSet -Name "www" -RecordType CNAME -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" | Remove-AzDnsRecordConfig -Cname contoso.com | Set-AzDnsRecordSet

This example removes a CNAME record from an existing record set. Because a CNAME record set can contain at most one record, the result is an empty record set.

Example 4: Remove an MX record from a record set

$RecordSet = Get-AzDnsRecordSet -Name "@" -RecordType MX -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
Remove-AzDnsRecordConfig -Exchange mail.microsoft.com -Preference 5 -RecordSet $RecordSet
Set-AzDnsRecordSet -RecordSet $RecordSet

# The above sequence can also be piped:

Get-AzDnsRecordSet -Name "@" -RecordType MX -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" | Remove-AzDnsRecordConfig -Exchange mail.microsoft.com -Preference 5 | Set-AzDnsRecordSet

This example removes an MX record from an existing record set. The record name "@" indicates a record set at the zone apex. If this is the only record in the record set, the result is an empty record set. To remove a record set entirely, see Remove-AzDnsRecordSet.

Example 5: Remove an NS record from a record set

$RecordSet = Get-AzDnsRecordSet -Name "abc" -RecordType NS -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
Remove-AzDnsRecordConfig -Nsdname ns1.myzone.com -RecordSet $RecordSet
Set-AzDnsRecordSet -RecordSet $RecordSet

# The above sequence can also be piped:

Get-AzDnsRecordSet -Name "abc" -RecordType NS -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" | Remove-AzDnsRecordConfig -Nsdname "ns1.myzone.com" | Set-AzDnsRecordSet

This example removes an NS record from an existing record set. If this is the only record in the record set, the result is an empty record set. To remove a record set entirely, see Remove-AzDnsRecordSet.

Example 6: Remove a PTR record from a record set

$RecordSet = Get-AzDnsRecordSet -Name "4" -RecordType PTR -ResourceGroupName "MyResourceGroup" -ZoneName 3.2.1.in-addr.arpa
Remove-AzDnsRecordConfig -Ptrdname www.contoso.com -RecordSet $RecordSet
Set-AzDnsRecordSet -RecordSet $RecordSet

# The above sequence can also be piped:

Get-AzDnsRecordSet -Name "4" -RecordType PTR -ResourceGroupName "MyResourceGroup" -ZoneName "3.2.1.in-addr.arpa" | Remove-AzDnsRecordConfig -Ptrdname www.contoso.com | Set-AzDnsRecordSet

This example removes a PTR record from an existing record set. If this is the only record in the record set, the result is an empty record set. To remove a record set entirely, see Remove-AzDnsRecordSet.

Example 7: Remove an SRV record from a record set

$RecordSet = Get-AzDnsRecordSet -Name "_sip._tcp" -RecordType SRV -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
Remove-AzDnsRecordConfig -RecordSet $RecordSet -Priority 0 -Weight 5 -Port 8080 -Target target.example.com
Set-AzDnsRecordSet -RecordSet $RecordSet

# The above sequence can also be piped:

Get-AzDnsRecordSet -Name "_sip._tcp" -RecordType SRV -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" | Remove-AzDnsRecordConfig -Priority 0 -Weight 5 -Port 8080 -Target target.example.com  | Set-AzDnsRecordSet

This example removes an SRV record from an existing record set. If this is the only record in the record set, the result is an empty record set. To remove a record set entirely, see Remove-AzDnsRecordSet.

Example 8: Remove a TXT record from a record set

$RecordSet = Get-AzDnsRecordSet -Name "text" -RecordType TXT -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
Remove-AzDnsRecordConfig -RecordSet $RecordSet -Value "This is a TXT Record"
Set-AzDnsRecordSet -RecordSet $RecordSet

# The above sequence can also be piped:

Get-AzDnsRecordSet -Name "text" -RecordType TXT -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" | Remove-AzDnsRecordConfig -Value "This is a TXT Record"  | Set-AzDnsRecordSet

This example removes a TXT record from an existing record set. If this is the only record in the record set, the result is an empty record set. To remove a record set entirely, see Remove-AzDnsRecordSet.

Example 9: Remove a DS record from a record set

$RecordSet = Get-AzDnsRecordSet -Name "www" -RecordType DS -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
Remove-AzDnsRecordConfig -KeyTag 12345 -Algorithm 3 -DigestType 1 -Digest "49FD46E6C4B45C55D4AC"
Set-AzDnsRecordSet -RecordSet $RecordSet

# The above sequence can also be piped:

Get-AzDnsRecordSet -Name "www" -RecordType DS -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" | Remove-AzDnsRecordConfig -KeyTag 12345 -Algorithm 3 -DigestType 1 -Digest "49FD46E6C4B45C55D4AC"  | Set-AzDnsRecordSet

This example removes a DS record from an existing record set. If this is the only record in the record set, the result is an empty record set. To remove a record set entirely, see Remove-AzDnsRecordSet.

Example 10: Remove a TLSA record from a record set

$RecordSet = Get-AzDnsRecordSet -Name "_443._tcp.www" -RecordType TLSA -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
Remove-AzDnsRecordConfig -Usage 3 -Selector 1 -MatchingType 1 -CertificateAssociationData "49FD46E6C4B45C55D4AC"
Set-AzDnsRecordSet -RecordSet $RecordSet

# The above sequence can also be piped:

Get-AzDnsRecordSet -Name "_443._tcp.www" -RecordType TLSA -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" | Remove-AzDnsRecordConfig -Usage 3 -Selector 1 -MatchingType 1 -CertificateAssociationData "49FD46E6C4B45C55D4AC"  | Set-AzDnsRecordSet

This example removes a TLSA record from an existing record set. If this is the only record in the record set, the result is an empty record set. To remove a record set entirely, see Remove-AzDnsRecordSet.

Example 11: Remove an NAPTR record from a record set

$RecordSet = Get-AzDnsRecordSet -Name "www" -RecordType NAPTR -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
Remove-AzDnsRecordConfig -Order 100 -Preference 100 -Flags "s" -Services "http" -Regexp "" -Replacement "www.contoso.com"
Set-AzDnsRecordSet -RecordSet $RecordSet

# The above sequence can also be piped:

Get-AzDnsRecordSet -Name "www" -RecordType NAPTR -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com" | Remove-AzDnsRecordConfig -Order 100 -Preference 100 -Flags "s" -Services "http" -Regexp "" -Replacement "www.contoso.com"  | Set-AzDnsRecordSet

Parameters

-Algorithm

The algorithm field of the DS record to remove.

Parameter properties

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

Parameter sets

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

-CaaFlags

The flags for the CAA record to add. Must be a number between 0 and 255.

Parameter properties

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

Parameter sets

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

-CaaTag

The tag field of the CAA record to add.

Parameter properties

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

Parameter sets

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

-CaaValue

The value field for the CAA record to add.

Parameter properties

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

Parameter sets

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

-CertificateAssociationData

The certificate association data field of the TLSA record to remove.

Parameter properties

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

Parameter sets

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

-Cname

Specifies the domain name for a canonical name (CNAME) record.

Parameter properties

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

Parameter sets

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

-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

-Digest

The digest field of the DS record to remove.

Parameter properties

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

Parameter sets

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

-DigestType

The digest type field of the DS record to remove.

Parameter properties

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

Parameter sets

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

-Exchange

Specifies the mail exchange server name for a mail exchange (MX) record.

Parameter properties

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

Parameter sets

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

-Flags

The flags value of the NAPTR record to remove.

Parameter properties

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

Parameter sets

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

-Ipv4Address

Specifies an IPv4 address for an A record.

Parameter properties

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

Parameter sets

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

-Ipv6Address

Specifies an IPv6 address for an AAAA record.

Parameter properties

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

Parameter sets

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

-KeyTag

The key tag field of the DS record to remove.

Parameter properties

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

Parameter sets

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

-MatchingType

The matching type field of the TLSA record to remove.

Parameter properties

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

Parameter sets

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

-Nsdname

Specifies the name server for a name server (NS) record.

Parameter properties

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

Parameter sets

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

-Order

Specifies the order for a named authority pointer (NAPTR) record.

Parameter properties

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

Parameter sets

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

-Port

Specifies the port for a service (SRV) record.

Parameter properties

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

Parameter sets

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

-Preference

Specifies the preference for an MX/NAPTR record.

Parameter properties

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

Parameter sets

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

-Priority

Specifies the priority for an SRV record.

Parameter properties

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

Parameter sets

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

-Ptrdname

Specifies the target domain name of a pointer (PTR) record.

Parameter properties

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

Parameter sets

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

-RecordSet

Specifies the RecordSet object that contains the record to remove.

Parameter properties

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

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-Regexp

Specifies the regexp of the named authority pointer (NAPTR) record.

Parameter properties

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

Parameter sets

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

-Replacement

Specifies the replacement for a named authority pointer (NAPTR) record.

Parameter properties

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

Parameter sets

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

-Selector

The selector field of the TLSA record to remove.

Parameter properties

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

Parameter sets

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

-Services

Specifies the services of the named authority pointer (NAPTR) record.

Parameter properties

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

Parameter sets

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

-Target

Specifies the target for an SRV record.

Parameter properties

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

Parameter sets

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

-Usage

The usage field of the TLSA record to remove.

Parameter properties

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

Parameter sets

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

-Value

Specifies the value for a TXT record.

Parameter properties

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

Parameter sets

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

-Weight

Specifies the weight for an SRV record.

Parameter properties

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

Parameter sets

SRV
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

DnsRecordSet

String

UInt16

Byte

Outputs

DnsRecordSet