Edit

Share via


Set-AzDnsZone

Updates the properties of a DNS zone.

Syntax

Fields (Default)

Set-AzDnsZone
    -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>]

FieldsObjects

Set-AzDnsZone
    -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>]

Object

Set-AzDnsZone
    -Zone <DnsZone>
    [-Overwrite]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Set-AzDnsZone 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

$Zone = Get-AzDnsZone -Name "myzone.com" -ResourceGroupName "MyResourceGroup"
$Zone.Tags = @(@{"Name"="Dept"; "Value"="Electrical"})
Set-AzDnsZone -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

Set-AzDnsZone -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

$vnet = Get-AzVirtualNetwork -ResourceGroupName "MyResourceGroup" -Name "myvnet"
Set-AzDnsZone -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.

$vnet = Get-AzVirtualNetwork -ResourceGroupName "MyResourceGroup" -Name "myvnet"
Set-AzDnsZone -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-AzDnsZone cmdlet.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
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

-Name

Specifies the name of the DNS zone to update.

Parameter properties

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

Parameter sets

Fields
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
FieldsObjects
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

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

Parameter sets

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

-RegistrationVirtualNetwork

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

Parameter properties

Type:

List<T>[IResourceReference]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-RegistrationVirtualNetworkId

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

Parameter properties

Type:

List<T>[String]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-ResolutionVirtualNetwork

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

Parameter properties

Type:

List<T>[IResourceReference]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

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

-ResolutionVirtualNetworkId

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

Parameter properties

Type:

List<T>[String]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

Fields
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

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

Parameter sets

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

-Tag

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

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Tags

Parameter sets

Fields
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
FieldsObjects
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments: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.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

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

-Zone

Specifies the DNS zone to update. Alternatively, you can specify the zone using the ZoneName and ResourceGroupName parameters.

Parameter properties

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

Parameter sets

Object
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
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

String

Hashtable

List<T>

List<T>

DnsZone

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.