共用方式為


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

Description

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