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

Set-AzBastion

更新 Bastion 资源。

语法

Set-AzBastion
   -InputObject <PSBastion>
   [-Sku <String>]
   [-ScaleUnit <Int32>]
   [-EnableKerberos <Boolean>]
   [-DisableCopyPaste <Boolean>]
   [-EnableTunneling <Boolean>]
   [-EnableIpConnect <Boolean>]
   [-EnableShareableLink <Boolean>]
   [-EnableSessionRecording <Boolean>]
   [-Tag <Hashtable>]
   [-Force]
   [-AsJob]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

说明

Set-AzBastion cmdlet 可用于更新现有 BastionHost 资源的 SKU、缩放单位或标记。

示例

示例 1

Set-AzBastion -InputObject $bastionObj -Sku "Standard" -ScaleUnit 10 -Force

Name                 : MyBastion
Id                   : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyRg/providers/Microsoft.Network/bastionHosts/MyBastion
Etag                 : W/"000"
Type                 : Microsoft.Network/bastionHosts
Location             : westus2
Tag                  :
TagsTable            :
ResourceGroupName    : MyRg
DnsName              : bst-00000000-0000-0000-0000-000000000001.test.bastion.azure.com
ResourceGuid         :
ProvisioningState    : Succeeded
IpConfigurationsText : [
                         {
                           "Subnet": {
                             "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyRg/providers/Microsoft.Network/virtualNetworks/MyVnet/subnets/AzureBastionSubnet"
                           },
                           "PublicIpAddress": {
                             "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyRg/providers/Microsoft.Network/publicIPAddresses/PublicIp1"
                           },
                           "ProvisioningState": "Succeeded",
                           "PrivateIpAllocationMethod": "Dynamic",
                           "Name": "IpConf",
                           "Etag": "W/\"000\"",
                           "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyRg/providers/Microsoft.Network/bastionHosts/MyBastion/bastionHostIpConfigurations/IpConf"
                         }
                       ]
Sku                  : {
                         "Name": "Standard"
                       }
Scale Units          : 10

使用基本 SKU 和 2 个缩放单元将 BastionHost 资源更新为标准 SKU 和 10 个缩放单元

示例 2

$bastionObj = Get-AzBastion -ResourceGroupName "MyRg" -Name "MyBastion"
$bastionObj

Name                 : MyBastion
Id                   : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyRg/providers/Microsoft.Network/bastionHosts/MyBastion
Etag                 : W/"000"
Type                 : Microsoft.Network/bastionHosts
Location             : westus2
Tag                  :
TagsTable            :
ResourceGroupName    : MyRg
DnsName              : bst-00000000-0000-0000-0000-000000000001.test.bastion.azure.com
ResourceGuid         :
ProvisioningState    : Succeeded
IpConfigurationsText : [
                         {
                           "Subnet": {
                             "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyRg/providers/Microsoft.Network/virtualNetworks/MyVnet/subnets/AzureBastionSubnet"
                           },
                           "PublicIpAddress": {
                             "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyRg/providers/Microsoft.Network/publicIPAddresses/PublicIp1"
                           },
                           "ProvisioningState": "Succeeded",
                           "PrivateIpAllocationMethod": "Dynamic",
                           "Name": "IpConf",
                           "Etag": "W/\"000\"",
                           "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyRg/providers/Microsoft.Network/bastionHosts/MyBastion/bastionHostIpConfigurations/IpConf"
                         }
                       ]
Sku                  : {
                         "Name": "Basic"
                       }
Scale Units          : 2

$bastionObj.Sku.Name = "Standard"
$bastionObj.ScaleUnit = 50
Set-AzBastion -InputObject $bastionObj -Force
Name                 : MyBastion
Id                   : /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyRg/providers/Microsoft.Network/bastionHosts/MyBastion
Etag                 : W/"000"
Type                 : Microsoft.Network/bastionHosts
Location             : westus2
Tag                  :
TagsTable            :
ResourceGroupName    : MyRg
DnsName              : bst-00000000-0000-0000-0000-000000000001.test.bastion.azure.com
ResourceGuid         :
ProvisioningState    : Succeeded
IpConfigurationsText : [
                         {
                           "Subnet": {
                             "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyRg/providers/Microsoft.Network/virtualNetworks/MyVnet/subnets/AzureBastionSubnet"
                           },
                           "PublicIpAddress": {
                             "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyRg/providers/Microsoft.Network/publicIPAddresses/PublicIp1"
                           },
                           "ProvisioningState": "Succeeded",
                           "PrivateIpAllocationMethod": "Dynamic",
                           "Name": "IpConf",
                           "Etag": "W/\"000\"",
                           "Id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyRg/providers/Microsoft.Network/bastionHosts/MyBastion/bastionHostIpConfigurations/IpConf"
                         }
                       ]
Sku                  : {
                         "Name": "Standard"
                       }
Scale Units          : 50

使用基本 SKU 和 2 个缩放单元将 BastionHost 资源更新为标准 SKU 和 50 个缩放单元

参数

-AsJob

在后台运行 cmdlet

类型:SwitchParameter
Position:Named
默认值:None
必需:False
接受管道输入:True
接受通配符: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

-Force

请求确认是否要覆盖资源

类型:SwitchParameter
Position:Named
默认值:None
必需:False
接受管道输入:True
接受通配符:False

-InputObject

BastionHost 对象

类型:PSBastion
Position:Named
默认值:None
必需:True
接受管道输入:True
接受通配符:False

-ScaleUnit

Bastion 缩放单位

类型: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
接受管道输入:True
接受通配符:False

-WhatIf

显示运行该 cmdlet 时会发生什么情况。 cmdlet 未运行。

类型:SwitchParameter
别名:wi
Position:Named
默认值:None
必需:False
接受管道输入:False
接受通配符:False

输入

PSBastion

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

Hashtable

SwitchParameter

输出

PSBastion