共用方式為


New-AzBastion

建立防禦資源。

語法

New-AzBastion
   -ResourceGroupName <String>
   -Name <String>
   -PublicIpAddress <PSPublicIpAddress>
   -VirtualNetwork <PSVirtualNetwork>
   [-Sku <String>]
   [-ScaleUnit <Int32>]
   [-EnableKerberos <Boolean>]
   [-DisableCopyPaste <Boolean>]
   [-EnableTunneling <Boolean>]
   [-EnableIpConnect <Boolean>]
   [-EnableShareableLink <Boolean>]
   [-EnableSessionRecording <Boolean>]
   [-AsJob]
   [-Tag <Hashtable>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzBastion
   -ResourceGroupName <String>
   -Name <String>
   -PublicIpAddress <PSPublicIpAddress>
   -VirtualNetworkRgName <String>
   -VirtualNetworkName <String>
   [-Sku <String>]
   [-ScaleUnit <Int32>]
   [-EnableKerberos <Boolean>]
   [-DisableCopyPaste <Boolean>]
   [-EnableTunneling <Boolean>]
   [-EnableIpConnect <Boolean>]
   [-EnableShareableLink <Boolean>]
   [-EnableSessionRecording <Boolean>]
   [-AsJob]
   [-Tag <Hashtable>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzBastion
   -ResourceGroupName <String>
   -Name <String>
   -PublicIpAddress <PSPublicIpAddress>
   -VirtualNetworkId <String>
   [-Sku <String>]
   [-ScaleUnit <Int32>]
   [-EnableKerberos <Boolean>]
   [-DisableCopyPaste <Boolean>]
   [-EnableTunneling <Boolean>]
   [-EnableIpConnect <Boolean>]
   [-EnableShareableLink <Boolean>]
   [-EnableSessionRecording <Boolean>]
   [-AsJob]
   [-Tag <Hashtable>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzBastion
   -ResourceGroupName <String>
   -Name <String>
   -PublicIpAddressId <String>
   -VirtualNetwork <PSVirtualNetwork>
   [-Sku <String>]
   [-ScaleUnit <Int32>]
   [-EnableKerberos <Boolean>]
   [-DisableCopyPaste <Boolean>]
   [-EnableTunneling <Boolean>]
   [-EnableIpConnect <Boolean>]
   [-EnableShareableLink <Boolean>]
   [-EnableSessionRecording <Boolean>]
   [-AsJob]
   [-Tag <Hashtable>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzBastion
   -ResourceGroupName <String>
   -Name <String>
   -PublicIpAddressId <String>
   -VirtualNetworkRgName <String>
   -VirtualNetworkName <String>
   [-Sku <String>]
   [-ScaleUnit <Int32>]
   [-EnableKerberos <Boolean>]
   [-DisableCopyPaste <Boolean>]
   [-EnableTunneling <Boolean>]
   [-EnableIpConnect <Boolean>]
   [-EnableShareableLink <Boolean>]
   [-EnableSessionRecording <Boolean>]
   [-AsJob]
   [-Tag <Hashtable>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzBastion
   -ResourceGroupName <String>
   -Name <String>
   -PublicIpAddressId <String>
   -VirtualNetworkId <String>
   [-Sku <String>]
   [-ScaleUnit <Int32>]
   [-EnableKerberos <Boolean>]
   [-DisableCopyPaste <Boolean>]
   [-EnableTunneling <Boolean>]
   [-EnableIpConnect <Boolean>]
   [-EnableShareableLink <Boolean>]
   [-EnableSessionRecording <Boolean>]
   [-AsJob]
   [-Tag <Hashtable>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzBastion
   -ResourceGroupName <String>
   -Name <String>
   -PublicIpAddressRgName <String>
   -PublicIpAddressName <String>
   -VirtualNetwork <PSVirtualNetwork>
   [-Sku <String>]
   [-ScaleUnit <Int32>]
   [-EnableKerberos <Boolean>]
   [-DisableCopyPaste <Boolean>]
   [-EnableTunneling <Boolean>]
   [-EnableIpConnect <Boolean>]
   [-EnableShareableLink <Boolean>]
   [-EnableSessionRecording <Boolean>]
   [-AsJob]
   [-Tag <Hashtable>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzBastion
   -ResourceGroupName <String>
   -Name <String>
   -PublicIpAddressRgName <String>
   -PublicIpAddressName <String>
   -VirtualNetworkRgName <String>
   -VirtualNetworkName <String>
   [-Sku <String>]
   [-ScaleUnit <Int32>]
   [-EnableKerberos <Boolean>]
   [-DisableCopyPaste <Boolean>]
   [-EnableTunneling <Boolean>]
   [-EnableIpConnect <Boolean>]
   [-EnableShareableLink <Boolean>]
   [-EnableSessionRecording <Boolean>]
   [-AsJob]
   [-Tag <Hashtable>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzBastion
   -ResourceGroupName <String>
   -Name <String>
   -PublicIpAddressRgName <String>
   -PublicIpAddressName <String>
   -VirtualNetworkId <String>
   [-Sku <String>]
   [-ScaleUnit <Int32>]
   [-EnableKerberos <Boolean>]
   [-DisableCopyPaste <Boolean>]
   [-EnableTunneling <Boolean>]
   [-EnableIpConnect <Boolean>]
   [-EnableShareableLink <Boolean>]
   [-EnableSessionRecording <Boolean>]
   [-AsJob]
   [-Tag <Hashtable>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

建立防禦資源。這需要公用IP位址和 VirtualNetwork。 此 VirtualNetwork 中必須有名稱為 AzureBastionSubnet 的子網。必須以 Sku Standard 建立 Pubic Ip 位址。

範例

範例 1

$subnetName = "AzureBastionSubnet"
$subnet = New-AzVirtualNetworkSubnetConfig -Name $subnetName -AddressPrefix 10.0.0.0/24
$vnet = New-AzVirtualNetwork -Name "TestVnet" -ResourceGroupName "BastionPowershellTest" -Location "westeurope" -AddressPrefix 10.0.0.0/16 -Subnet $subnet
$publicip = New-AzPublicIpAddress -ResourceGroupName "BastionPowershellTest" -Name "Test-Ip" -location "westeurope" -AllocationMethod Dynamic -Sku Standard
$bastion = New-AzBastion -ResourceGroupName "BastionPowershellTest" -Name "test-Bastion2" -PublicIpAddress $publicip -VirtualNetwork $vnet

IpConfigurations     : {IpConf}
DnsName              : bst-a9ca868f-ddab-4a50-9f45-a443ea8a0187.bastion.azure.com
ProvisioningState    : Succeeded
IpConfigurationsText : [
                         {
                           "Subnet": {
                             "Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/virtualNetworks/TestVnet/subnets/AzureBastionSubnet"
                           },
                           "PublicIpAddress": {
                             "Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/publicIPAddresses/Test-Ip"
                           },
                           "ProvisioningState": "Succeeded",
                           "PrivateIpAllocationMethod": "Dynamic",
                           "Name": "IpConf",
                           "Etag": "W/\"ed810ccd-b3f6-4e22-891e-b0ed0a26d6dd\"",
                           "Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/bastionHosts/test-Bastion2/bastionHostIpConfigurations/IpConf"
                         }
                       ]
ResourceGroupName    : BastionPowershellTest
Location             : westeurope
ResourceGuid         :
Type                 : Microsoft.Network/bastionHosts
Tag                  :
TagsTable            :
Name                 : test-Bastion2
Etag                 : W/"ed810ccd-b3f6-4e22-891e-b0ed0a26d6dd"
Id                   : /subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/bastionHosts/test-Bastion2
Sku                  : {
                         "Name": "Basic"
                       }
Scale Units          : 2

此範例會在與防禦相同的資源群組中建立連結至虛擬網路 「vnet」 的防禦。 此 vnet 中必須有名稱為 AzureBastionSubnet 的子網。 Ip 位址必須使用 Sku 標準建立。

範例 2

$vnet = Get-AzVirtualNetwork -ResourceGroupName "BastionPowershellTest" -Name "testVnet2"
Add-AzVirtualNetworkSubnetConfig -Name "AzureBastionSubnet" -VirtualNetwork $vnet -AddressPrefix "10.0.0.0/24"
$vnet| Set-AzVirtualNetwork
New-AzBastion -ResourceGroupName "BastionPowershellTest" -Name "testBastion2" -PublicIpAddressRgName "BastionPowershellTest" -PublicIpAddressName "testIp2" -VirtualNetworkRgName "BastionPowershellTest" -VirtualNetworkName "testVnet2"

IpConfigurations     : {IpConf}
DnsName              : bst-53757658-c4fd-4908-b1a7-0849e555d489.bastion.azure.com
ProvisioningState    : Succeeded
IpConfigurationsText : [
                         {
                           "Name": "IpConf",
                           "Etag": "W/\"7460e5f6-ad41-438b-a595-a63346ed8f16\"",
                           "Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/bastionHosts/testBastion2/bastionHostIpConfigurations/IpConf",
                           "Subnet": {
                             "Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/virtualNetworks/testVnet2/subnets/AzureBastionSubnet"
                           },
                           "PublicIpAddress": {
                             "Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/publicIPAddresses/testIp2"
                           },
                           "ProvisioningState": "Succeeded",
                           "PrivateIpAllocationMethod": "Dynamic"
                         }
                       ]
ResourceGroupName    : BastionPowershellTest
Location             : westeurope
ResourceGuid         :
Type                 : Microsoft.Network/bastionHosts
Tag                  :
TagsTable            :
Name                 : testBastion2
Etag                 : W/"7460e5f6-ad41-438b-a595-a63346ed8f16"
Id                   : /subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/bastionHosts/testBastion2
Sku                  : {
                         "Name": "Basic"
                       }
Scale Units          : 2

範例 3

$vnet = Get-AzVirtualNetwork -ResourceGroupName "BastionPowershellTest" -Name "testVnet2"
Add-AzVirtualNetworkSubnetConfig -Name "AzureBastionSubnet" -VirtualNetwork $vnet -AddressPrefix "10.0.0.0/24"
$vnet| Set-AzVirtualNetwork
New-AzBastion -ResourceGroupName "BastionPowershellTest" -Name "testBastion2" -PublicIpAddressRgName "BastionPowershellTest" -PublicIpAddressName "testIp2" -VirtualNetworkRgName "BastionPowershellTest" -VirtualNetworkName "testVnet2" -Sku "Standard" -ScaleUnit 3

IpConfigurations     : {IpConf}
DnsName              : bst-53757658-c4fd-4908-b1a7-0849e555d489.bastion.azure.com
ProvisioningState    : Succeeded
IpConfigurationsText : [
                         {
                           "Name": "IpConf",
                           "Etag": "W/\"7460e5f6-ad41-438b-a595-a63346ed8f16\"",
                           "Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/bastionHosts/testBastion2/bastionHostIpConfigurations/IpConf",
                           "Subnet": {
                             "Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/virtualNetworks/testVnet2/subnets/AzureBastionSubnet"
                           },
                           "PublicIpAddress": {
                             "Id": "/subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/publicIPAddresses/testIp2"
                           },
                           "ProvisioningState": "Succeeded",
                           "PrivateIpAllocationMethod": "Dynamic"
                         }
                       ]
ResourceGroupName    : BastionPowershellTest
Location             : westeurope
ResourceGuid         :
Type                 : Microsoft.Network/bastionHosts
Tag                  :
TagsTable            :
Name                 : testBastion2
Etag                 : W/"7460e5f6-ad41-438b-a595-a63346ed8f16"
Id                   : /subscriptions/359a08a9-ff1b-463c-92d7-6df8d946f25c/resourceGroups/BastionPowershellTest/providers/Microsoft.Network/bastionHosts/testBastion2
Sku                  : {
                         "Name": "Standard"
                       }
Scale Units          : 3

此範例會建立具有標準 Sku 和 3 個縮放單位的 BastionHost 資源。

參數

-AsJob

在背景執行 Cmdlet

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

-Confirm

執行 Cmdlet 之前先提示您確認。

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

-DefaultProfile

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

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

-DisableCopyPaste

複製與貼上

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

-EnableIpConnect

IP Connect

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

-EnableKerberos

Kerberos

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

-EnableSessionRecording

工作階段記錄

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

可共用連結

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

-EnableTunneling

Native Client

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

-Name

防禦資源名稱。

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

-PublicIpAddress

防禦的公用IP位址物件。

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

-PublicIpAddressId

防禦的公用 Ip 位址 Azure 資源識別碼。

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

-PublicIpAddressName

防禦的公用 Ip 位址資源名稱。

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

-PublicIpAddressRgName

防禦的公用 Ip 位址資源組名。

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

-ResourceGroupName

您需要在其中建立防禦的資源組名。

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

-ScaleUnit

BastionHost 的縮放單位

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

-Sku

Bastion Sku 層

類型:String
接受的值:Basic, Standard, Premium
Position:Named
預設值:Basic
必要:False
接受管線輸入:True
接受萬用字元:False

-Tag

表示資源標記的哈希表。

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

-VirtualNetwork

防禦的虛擬網路物件。

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

-VirtualNetworkId

防禦的虛擬網路 Azure 資源識別碼。

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

-VirtualNetworkName

防禦的虛擬網路資源名稱。

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

-VirtualNetworkRgName

防禦的虛擬網路資源組名。

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

-WhatIf

顯示執行 Cmdlet 後會發生的情況。 未執行 Cmdlet。

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

輸入

String

Nullable<T>[[System.Int32, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]

Nullable<T>[[System.Boolean, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]

輸出

PSBastion