Editar

Compartir a través de


Set-AzDnsZone

Updates the properties of a DNS zone.

Syntax

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>]
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>]
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.

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:AzContext, 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, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]

List<T>[[Microsoft.Azure.Management.Internal.Network.Common.IResourceReference, Microsoft.Azure.PowerShell.Clients.Network, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]

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.