Remove-​Azure​Rm​Dns​Record​Set

Deletes a record set.

Syntax

Remove-AzureRmDnsRecordSet
      [-Force]
      -Name <String>
      [-PassThru]
      -RecordType <RecordType>
      -ResourceGroupName <String>
      -ZoneName <String>
      [-Confirm]
      [-WhatIf]
      [<CommonParameters>]
Remove-AzureRmDnsRecordSet
      [-Force]
      -Name <String>
      [-PassThru]
      -RecordType <RecordType>
      -Zone <DnsZone>
      [-Confirm]
      [-WhatIf]
      [<CommonParameters>]
Remove-AzureRmDnsRecordSet
      [-Force]
      [-Overwrite]
      [-PassThru]
      -RecordSet <DnsRecordSet>
      [-Confirm]
      [-WhatIf]
      [<CommonParameters>]

Description

The Remove-AzureRmDnsRecordSet cmdlet deletes the specified record set from the specified zone. You cannot delete SOA or name server (NS) records that are automatically created at the zone apex.

You can pass a RecordSet object to this cmdlet by using the pipeline operator or as a parameter. To identify a record set by name and type without using a RecordSet object, you must pass the zone as a DnsZone object to this cmdlet by using the pipeline operator or as a parameter, or alternatively you can specify the ZoneName and ResourceGroupName parameters.

You can use the Confirm parameter and $ConfirmPreference Windows PowerShell variable to control whether the cmdlet prompts you for confirmation.

When specifying the record set using a RecordSet object, the record set is not deleted if it has been changed in Azure DNS since the local RecordSet object was retrieved. This provides protection for concurrent changes. You can suppress this by using the Overwrite parameter, which deletes the record set regardless of concurrent changes.

Examples

Example 1: Remove a record set

PS C:\> $RecordSet = Get-AzureRmDnsRecordSet -Name "www" -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
PS C:\> Remove-AzureRmDnsRecordSet -RecordSet $RecordSet

The first command gets the specified record set, and then stores it in the $RecordSet variable.The second command removes the record set in $RecordSet.

Example 2: Remove a record set and suppress all confirmation

PS C:\> $RecordSet = Get-AzureRmDnsRecordSet -Name "www" -ZoneName "myzone.com" -ResourceGroupName "MyResourceGroup"
PS C:\> Remove-AzureRmDnsRecordSet -RecordSet $RecordSet -Confirm:$False -Overwrite

# Alternatively, the record set can be removed as follows.  In this case,
# because the record set is specified by name rather than by object, the
# Overwrite parameter is not applicable.

PS C:\> Remove-AzureRmDnsRecordSet -Name "www" -ZoneName "myzone.com" -ResourceGroupName "MyResourceGroup" -Confirm:$False

The first command gets the specified record set.

The second command deletes the record set, even if it has changed in the meantime. Confirmation prompts are suppressed.

Required Parameters

-Name

Specifies the name of the RecordSet to remove. When specifying the record set by name, the DNS zone must be specified using either the Zone parameter or the ZoneName and ResourceGroupName parameters.

Alternatively, the record set can be specified using a RecordSet object, passed using the RecordSet parameter.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RecordSet

Specifies the RecordSet object to remove.

Alternatively, the record set can be specified using the Name and Zone parameters, or using the Name, ZoneName, and ResourceGroupName parameters.

Type:DnsRecordSet
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-RecordType

Specifies the type of DNS record.

Valid values are:

  • A
  • AAAA
  • CNAME
  • MX
  • NS
  • PTR
  • SRV
  • TXT

SOA records are deleted automatically when the zone is deleted. You cannot manually delete SOA records.

Type:RecordType
Parameter Sets:A, AAAA, CNAME, MX, NS, PTR, SOA, SRV, TXT
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ResourceGroupName

Specifies the resource group that contains the DNS zone that contains the RecordSet to delete. This parameter is applicable only when the record set and DNS zone are specified using the Name and ZoneName parameters.

Alternatively, you can specify the record set using either the RecordSet parameter, or the Name and Zone parameters.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-Zone

Specifies the DNS zone that contains the RecordSet to delete. This parameter is applicable only when specifying the record set using the Name parameter.

Alternatively, you can specify the record set using either the RecordSet parameter, or the Name, ZoneName, and ResourceGroupName parameters.

Type:DnsZone
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-ZoneName

Specifies the name of the zone that contains the RecordSet to delete. You must also specify the Name and ResourceGroupName parameters.

Alternatively, the record set can be specified using either the RecordSet parameter, or the Name and Zone parameters.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-Force

This parameter is deprecated for this cmdlet. It will be removed in a future release.

To control whether this cmdlet prompts you for confirmation, use the Confirm parameter.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Overwrite

When specifying the record set using a RecordSet object, the record set is not deleted if it has been changed in Azure DNS since the local RecordSet object was retrieved. This provides protection for concurrent changes. This can be suppressed using the Overwrite parameter, which deletes the record set regardless of concurrent changes.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PassThru

passthru

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.Azure.Commands.Dns.DnsRecordSet

You can pipe a RecordSet object to this cmdlet.

Outputs

None

This cmdlet does not generate any output.

Notes

You can use the Confirm parameter to control whether this cmdlet prompts you for confirmation. By default, the cmdlet prompts you for confirmation if the $ConfirmPreference Windows PowerShell variable has a value of Medium or lower.

If you specify Confirm or Confirm:$True, this cmdlet prompts you for confirmation before it runs. If you specify Confirm:$False, the cmdlet does not prompt you for confirmation.