共用方式為


New-AzDnsZone

建立新的 DNS 區域。

語法

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

New-AzDnsZone Cmdlet 會在指定的資源群組中建立新的域名系統 (DNS) 區域。 您必須為 Name 參數指定唯一的 DNS 區域名稱,否則 Cmdlet 會傳回錯誤。 建立區域之後,請使用 New-AzDnsRecordSet Cmdlet 在區域中建立記錄集。 您可以使用 Confirm 參數和 $ConfirmPreference Windows PowerShell 變數來控制 Cmdlet 是否提示您確認。

範例

範例 1:建立 DNS 區域

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

此命令會在指定的資源群組中建立名為 myzone.com 的新 DNS 區域,然後將它儲存在$Zone變數中。

範例 2:藉由指定虛擬網路標識碼來建立私人 DNS 區域

$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)

此命令會在指定的資源群組中建立名為 myprivatezone.com 的新私人 DNS 區域,並使用相關聯的解析虛擬網路(指定其標識符),然後將它儲存在$Zone變數中。

範例 3:藉由指定虛擬網路物件來建立私人 DNS 區域

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

此命令會在指定的資源群組中建立名為 myprivatezone.com 的新私人 DNS 區域,並搭配相關聯的解析虛擬網路(由 $ResVirtualNetwork 變數參考),然後將它儲存在$Zone變數中。

範例 4:藉由指定父區域名稱來建立具有委派的 DNS 區域

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

此命令會在指定的資源群組中建立名為 mychild.zone.com 的新子 DNS 區域,並儲存在 $Zone 變數中。 它也會在名為 的父 DNS 區域中新增委派,zone.com 位於與子區域相同的訂用帳戶和資源群組中。

範例 5:藉由指定父區域標識符來建立具有委派的 DNS 區域

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

此命令會在指定的資源群組中建立名為 mychild.zone.com 的新子 DNS 區域,並儲存在 $Zone 變數中。 它也會在資源群組 other-rg 提供的訂用帳戶中,於名為 zone.com 的父 DNS 區域中新增委派,與建立的子區域相同。

範例 6:藉由指定父區域物件來建立具有委派的 DNS 區域

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

此命令會在指定的資源群組中建立名為 mychild.zone.com 的新子 DNS 區域,並儲存在 $Zone 變數中。 它也會在父 DNS 區域中新增委派,名為 zone.com,如在 ParentZone 對象中傳遞

參數

-Confirm

在執行 Cmdlet 之前,提示您進行確認。

類型:SwitchParameter
別名:cf
Position:Named
預設值:False
必要:False
接受管線輸入:False
接受萬用字元:False

-DefaultProfile

用於與 azure 通訊的認證、帳戶、租用戶和訂用帳戶

類型:IAzureContextContainer
別名:AzContext, AzureRmContext, AzureCredential
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Name

指定要建立的 DNS 區域名稱。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-ParentZone

要新增委派之父區域的完整名稱(不含終止點)。

類型:DnsZone
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-ParentZoneId

要新增委派之父區域的資源標識碼(不含終止點)。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-ParentZoneName

要新增委派之父區域的完整名稱(不含終止點)。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-RegistrationVirtualNetwork

將在此 DNS 區域中註冊虛擬機主機名記錄的虛擬網路清單,僅適用於私人區域。

類型:List<T>[IResourceReference]
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-RegistrationVirtualNetworkId

將在此 DNS 區域中註冊虛擬機主機名記錄的虛擬網路識別碼清單,僅適用於私人區域。

類型:List<T>[String]
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-ResolutionVirtualNetwork

能夠解析此 DNS 區域中記錄的虛擬網路清單,僅適用於私人區域。

類型:List<T>[IResourceReference]
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-ResolutionVirtualNetworkId

虛擬網路標識碼清單能夠解析此 DNS 區域中的記錄,僅適用於私人區域。

類型:List<T>[String]
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-ResourceGroupName

指定要在其中建立區域的資源群組。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-Tag

哈希表形式的索引鍵/值組。 例如:@{key0=“value0”;key1=$null;key2=“value2”}

類型:Hashtable
別名:Tags
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

-WhatIf

顯示 Cmdlet 執行時會發生什麼事。 Cmdlet 未執行。顯示 Cmdlet 執行時會發生什麼事。 Cmdlet 未執行。

類型:SwitchParameter
別名:wi
Position:Named
預設值:False
必要:False
接受管線輸入:False
接受萬用字元:False

-ZoneType

區域、公用或私人的類型。 沒有型別或具有公用類型的區域可在公用 DNS 服務平面上使用,以用於 DNS 階層。 只有一組相關聯的虛擬網路才能看到類型為 Private 的區域(此功能為預覽版)。 無法變更區域的這個屬性。

類型:Nullable<T>[ZoneType]
接受的值:Public, Private
Position:Named
預設值:None
必要:False
接受管線輸入:True
接受萬用字元:False

輸入

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

輸出

DnsZone

備註

您可以使用 Confirm 參數來控制此 Cmdlet 是否提示您進行確認。 根據預設,Cmdlet 會提示您確認$ConfirmPreference Windows PowerShell 變數的值是否為 Medium 或更低。 如果您指定 ConfirmConfirm:$True,此 Cmdlet 會在執行之前提示您確認。 如果您指定 Confirm:$False,Cmdlet 不會提示您進行確認。