New-AzDnsZone

Creates a new DNS zone.

Syntax

New-AzDnsZone
   -Name <String>
   -ResourceGroupName <String>
   [-ZoneType <ZoneType>]
   [-ParentZoneId <String>]
   [-Tag <Hashtable>]
   [-RegistrationVirtualNetworkId <System.Collections.Generic.List`1[System.String]>]
   [-ResolutionVirtualNetworkId <System.Collections.Generic.List`1[System.String]>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzDnsZone
   -Name <String>
   -ResourceGroupName <String>
   [-ZoneType <ZoneType>]
   [-ParentZoneName <String>]
   [-Tag <Hashtable>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzDnsZone
   -Name <String>
   -ResourceGroupName <String>
   [-ZoneType <ZoneType>]
   [-ParentZone <DnsZone>]
   [-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>]

Description

The New-AzDnsZone cmdlet creates a new Domain Name System (DNS) zone in the specified resource group. You must specify a unique DNS zone name for the Name parameter or the cmdlet will return an error. After the zone is created, use the New-AzDnsRecordSet cmdlet to create record sets in the zone. You can use the Confirm parameter and $ConfirmPreference Windows PowerShell variable to control whether the cmdlet prompts you for confirmation.

Examples

Example 1: Create a DNS zone

$Zone = New-AzDnsZone -Name "myzone.com" -ResourceGroupName "MyResourceGroup"

This command creates a new DNS zone named myzone.com in the specified resource group, and then stores it in the $Zone variable.

Example 2: Create a Private DNS zone by specifying virtual network IDs

$ResVirtualNetworkId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testresgroup/providers/Microsoft.Network/virtualNetworks/resvnet"
$Zone = New-AzDnsZone -Name "myprivatezone.com" -ResourceGroupName "MyResourceGroup" -ZoneType Private -ResolutionVirtualNetworkId @($ResVirtualNetworkId)

This command creates a new Private DNS zone named myprivatezone.com in the specified resource group with an associated resolution virtual network (specifying its ID), and then stores it in the $Zone variable.

Example 3: Create a Private DNS zone by specifying virtual network objects

$ResVirtualNetwork = Get-AzVirtualNetwork -Name "resvnet" -ResourceGroupName "testresgroup"
$Zone = New-AzDnsZone -Name "myprivatezone.com" -ResourceGroupName "MyResourceGroup" -ZoneType Private -ResolutionVirtualNetwork @($ResVirtualNetwork)

This command creates a new Private DNS zone named myprivatezone.com in the specified resource group with an associated resolution virtual network (referred to by $ResVirtualNetwork variable), and then stores it in the $Zone variable.

Example 4: Create a DNS zone with delegation by specifying parent zone name

$Zone = New-AzDnsZone -Name "mychild.zone.com" -ResourceGroupName "MyResourceGroup" -ParentZoneName "zone.com"

This command creates a new child DNS zone named mychild.zone.com in the specified resource group and stores in the $Zone variable. It also adds delegation in the parent DNS zone named zone.com residing in the same subscription and resource group as child zone.

Example 5: Create a DNS zone with delegation by specifying parent zone id

$Zone = New-AzDnsZone -Name "mychild.zone.com" -ResourceGroupName "MyResourceGroup" -ParentZoneId "/subscriptions/**67e2/resourceGroups/other-rg/providers/Microsoft.Network/dnszones/zone.com"

This command creates a new child DNS zone named mychild.zone.com in the specified resource group and stores in the $Zone variable. It also adds delegation in the parent DNS zone named zone.com in resource group other-rg provided subscription is same as that of child zone created.

Example 6: Create a DNS zone with delegation by specifying parent zone object

$PZone = New-AzDnsZone -Name "zone.com" -ResourceGroupName "MyResourceGroup" 
$Zone = New-AzDnsZone -Name "mychild.zone.com" -ResourceGroupName "MyResourceGroup" -ParentZone @($PZone)

This command creates a new child DNS zone named mychild.zone.com in the specified resource group and stores in the $Zone variable. It also adds delegation in the parent DNS zone named zone.com as passed in the ParentZone object

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

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

-ParentZone

The full name of the parent zone to add delegation (without a terminating dot).

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

-ParentZoneId

The resource id of the parent zone to add delegation (without a terminating dot).

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

-ParentZoneName

The full name of the parent zone to add delegation (without a terminating dot).

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
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 resource group in which to create the zone.

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

-ZoneType

The type of the zone, Public or Private. Zones without a type or with a type of Public are made available on the public DNS serving plane for use in the DNS hierarchy. Zones with a type of Private are only visible from with the set of associated virtual networks (this feature is in preview). This property cannot be changed for a zone.

Type:Nullable<T>[ZoneType]
Accepted values:Public, Private
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

Nullable<T>[[Microsoft.Azure.Management.Dns.Models.ZoneType, Microsoft.Azure.Management.Dns, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]

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

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.