Editar

Partilhar via


Remove-AzPrivateDnsRecordSet

Deletes a record set from a Private DNS zone.

Syntax

Remove-AzPrivateDnsRecordSet
      -ResourceGroupName <String>
      -ZoneName <String>
      -Name <String>
      -RecordType <RecordType>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzPrivateDnsRecordSet
      -Zone <PSPrivateDnsZone>
      -Name <String>
      -RecordType <RecordType>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzPrivateDnsRecordSet
      -RecordSet <PSPrivateDnsRecordSet>
      [-Overwrite]
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzPrivateDnsRecordSet
      -ResourceId <String>
      [-PassThru]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-AzPrivateDnsRecordSet cmdlet deletes the specified record set from the specified zone. You cannot delete SOA records that are automatically created at the private zone apex. You can pass a RecordSet object to this cmdlet by using the pipeline operator or as a parameter or as a ResourceId. To identify a record set by name and type without using a RecordSet object, you must pass the zone as a PSPrivateDnsZone 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 Private 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

$RecordSet = Get-AzPrivateDnsRecordSet -Name "www" -ResourceGroupName "MyResourceGroup" -ZoneName "myzone.com"
Remove-AzPrivateDnsRecordSet -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

$RecordSet = Get-AzPrivateDnsRecordSet -Name "www" -ZoneName "myzone.com" -ResourceGroupName "MyResourceGroup"
Remove-AzPrivateDnsRecordSet -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.

Remove-AzPrivateDnsRecordSet -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.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-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

The name of the records in the record set (relative to the name of the zone and without a terminating dot).

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

-Overwrite

Do not use the ETag field of the RecordSet parameter for optimistic concurrency checks.

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

-PassThru

Used for passing the result (boolean) of the operation delete private zone further down the pipeline.

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

-RecordSet

The record set in which to add the record.

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

-RecordType

The type of Private DNS records in the record set.

Type:RecordType
Accepted values:A, AAAA, CNAME, MX, PTR, SOA, SRV, TXT
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

The resource group to which the zone belongs.

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

-ResourceId

Private DNS RecordSet ResourceID.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
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:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Zone

The PrivateDnsZone object representing the zone in which to create the record set.

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

-ZoneName

The zone in which the record set exists (without a terminating dot).

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

Inputs

PSPrivateDnsZone

PSPrivateDnsRecordSet

String

Outputs

Boolean