你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

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

说明

创建堡垒资源。这需要公共 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 的子网。 必须使用 SKU 标准创建 IP 地址。

示例 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 资源 ID。

类型: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 资源 ID。

类型: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