Edit

Share via


New-AzDnsZone

Creates a new DNS zone.

Syntax

Ids (Default)

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

Names

New-AzDnsZone
    -Name <String>
    -ResourceGroupName <String>
    [-ZoneType <ZoneType>]
    [-ParentZoneName <String>]
    [-Tag <Hashtable>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Objects

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.

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

Parameter properties

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

Parameter sets

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

-ParentZone

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

Parameter properties

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

Parameter sets

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

-ParentZoneId

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

Parameter properties

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

Parameter sets

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

-ParentZoneName

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

Parameter properties

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

Parameter sets

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

Objects
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

Ids
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

Objects
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

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

-ResourceGroupName

Specifies the resource group in which to create the zone.

Parameter properties

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

Parameter sets

(All)
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

(All)
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

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

Parameter properties

Type:

Nullable<T>[ZoneType]

Default value:None
Accepted values:Public, Private
Supports wildcards:False
DontShow:False

Parameter sets

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

Nullable<T>

Hashtable

List<T>

List<T>

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.