Set-AzureRmDnsZone

Updates the properties of a DNS zone.

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

Set-AzureRmDnsZone
   -Name <String>
   -ResourceGroupName <String>
   [-Tag <Hashtable>]
   [-RegistrationVirtualNetworkId <System.Collections.Generic.List`1[System.String]>]
   [-ResolutionVirtualNetworkId <System.Collections.Generic.List`1[System.String]>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzureRmDnsZone
   -Name <String>
   -ResourceGroupName <String>
   [-Tag <Hashtable>]
   [-RegistrationVirtualNetwork <System.Collections.Generic.List`1[Microsoft.Azure.Management.Internal.Network.Common.IResourceReference]>]
   [-ResolutionVirtualNetwork <System.Collections.Generic.List`1[Microsoft.Azure.Management.Internal.Network.Common.IResourceReference]>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AzureRmDnsZone
   -Zone <DnsZone>
   [-Overwrite]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-AzureRmDnsZone cmdlet updates the specified DNS zone in the Azure DNS service. This cmdlet does not update the record sets in the zone. You can pass a DnsZone object as a parameter or by using the pipeline operator, 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 passing a DNS zone as an object (using the Zone object or via the pipeline), it is not updated if it has been changed in Azure DNS since the local DnsZone object was retrieved. This provides protection for concurrent changes. You can suppress this behavior with the Overwrite parameter, which updates the zone regardless of concurrent changes.

Examples

Example 1: Update a DNS zone

PS C:\>$Zone = Get-AzureRmDnsZone -Name "myzone.com" -ResourceGroupName "MyResourceGroup"
PS C:\> $Zone.Tags = @(@{"Name"="Dept"; "Value"="Electrical"})
PS C:\> Set-AzureRmDnsZone -Zone $Zone

The first command gets the zone named myzone.com from the specified resource group, and then stores it in the $Zone variable. The second command updates the tags for $Zone. The final command commits the change.

Example 2: Update tags for a zone

PS C:\>Set-AzureRmDNSZone -ResourceGroupName "MyResourceGroup" -Name "myzone.com" -Tag @(@{"Name"="Dept"; "Value"="Electrical"})

This command updates the tags for the zone named myzone.com without first explicitly getting the zone.

Example 3: Associating a private zone with a virtual network by specifying its ID

PS C:\>$vnet = Get-AzureRmVirualNetwork -ResourceGroupName "MyResourceGroup" -Name "myvnet"
PS C:\>Set-AzureRmDNSZone -ResourceGroupName "MyResourceGroup" -Name "myprivatezone.com" -RegistrationVirtualNetworkId @($vnet.Id)

This command associates the Private DNS zone myprivatezone.com with the virtual network myvnet as a registration network by specifying its ID.

Example 4: Associating a private zone with a virtual network by specifying the network object.

PS C:\>$vnet = Get-AzureRmVirualNetwork -ResourceGroupName "MyResourceGroup" -Name "myvnet"
PS C:\>Set-AzureRmDNSZone -ResourceGroupName "MyResourceGroup" -Name "myprivatezone.com" -RegistrationVirtualNetwork @($vnet)

This command associates the Private DNS zone myprivatezone.com with the virtual network myvnet as a registration network by passing the virtual network object represented by $vnet variable to the Set-AzureRmDnsZone cmdlet.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
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:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Name

Specifies the name of the DNS zone to update.

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

-Overwrite

When passing a DNS zone as an object (using the Zone object or via the pipeline), it is not updated if it has been changed in Azure DNS since the local DnsZone object was retrieved. This provides protection for concurrent changes. You can suppress this behavior with the Overwrite parameter, which updates the zone regardless of concurrent changes.

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

-RegistrationVirtualNetwork

The list of virtual networks that will register virtual machine hostnames records in this DNS zone, only available for private zones.

Type:List<T>[IResourceReference]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-RegistrationVirtualNetworkId

The list of virtual network IDs that will register virtual machine hostnames records in this DNS zone, only available for private zones.

Type:List<T>[String]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ResolutionVirtualNetwork

The list of virtual networks able to resolve records in this DNS zone, only available for private zones.

Type:List<T>[IResourceReference]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ResolutionVirtualNetworkId

The list of virtual network IDs able to resolve records in this DNS zone, only available for private zones.

Type:List<T>[String]
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-ResourceGroupName

Specifies the name of the resource group that contains the zone to update. You must also specify the ZoneName parameter. Alternatively, you can specify the zone using a DnsZone object with the Zone parameter or the pipeline.

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

-Tag

Key-value pairs in the form of a hash table. For example: @{key0="value0";key1=$null;key2="value2"}

Type:Hashtable
Aliases:Tags
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

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

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

-Zone

Specifies the DNS zone to update. 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

Inputs

String

Hashtable

List<T>[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]

List<T>[[Microsoft.Azure.Management.Internal.Network.Common.IResourceReference, Microsoft.Azure.Commands.Common.Network, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]

DnsZone

Parameters: Zone (ByValue)

Outputs

DnsZone

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.