az network bastion

注意

此參考是 Azure CLI 的防禦延伸模組的一部分(2.43.0 版或更高版本)。 擴充功能會在您第一次執行 az network bastion 命令時自動安裝。 深入了解擴充功能。

命令群組 'az network' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

管理 Azure Bastion 主電腦。

命令

名稱 Description 類型 狀態
az network bastion create

建立 Azure Bastion 主機電腦。

副檔名 預覽
az network bastion delete

刪除 Azure Bastion 主機電腦。

副檔名 預覽
az network bastion list

列出所有 Azure Bastion 主機電腦。

副檔名 預覽
az network bastion rdp

使用來自 Azure Bastion 通道的 RDP 以虛擬機器為目標。

副檔名 預覽
az network bastion show

顯示 Azure Bastion 主機電腦。

副檔名 預覽
az network bastion ssh

使用 Azure Bastion 的通道透過 SSH 連線到虛擬機器。

副檔名 預覽
az network bastion tunnel

透過 Azure Bastion 開啟通道至目標虛擬機器。

副檔名 預覽
az network bastion update

更新 Azure Bastion 主機電腦。

副檔名 預覽
az network bastion wait

將 CLI 置於等候狀態,直到符合條件為止。

副檔名 預覽

az network bastion create

預覽

命令群組 'az network' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

建立 Azure Bastion 主機電腦。

az network bastion create --name
                          --public-ip-address
                          --resource-group
                          --vnet-name
                          [--disable-copy-paste {0, 1, f, false, n, no, t, true, y, yes}]
                          [--enable-ip-connect {0, 1, f, false, n, no, t, true, y, yes}]
                          [--enable-tunneling {0, 1, f, false, n, no, t, true, y, yes}]
                          [--location]
                          [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                          [--scale-units]
                          [--sku {Basic, Standard}]
                          [--tags]

範例

建立 Azure Bastion 主機電腦。

az network bastion create --location westus2 --name MyBastionHost --public-ip-address MyPublicIpAddress --resource-group MyResourceGroup --vnet-name MyVnet

必要參數

--name -n

防禦主機的名稱。

--public-ip-address

Azure 公用 IP 的名稱或識別碼。 公用 IP 的 SKU 必須是標準。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--vnet-name

虛擬網路的名稱。 它必須有名為 AzureBastionSubnet 的子網。

選擇性參數

--disable-copy-paste

停用此 Azure Bastion 資源上所有會話的複製並貼上。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
預設值: False
--enable-ip-connect

在此 Azure Bastion 資源上啟用以 IP 為基礎的連線。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
預設值: False
--enable-tunneling

在此 Azure Bastion 資源上啟用 Native Client 支援。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
預設值: False
--location -l

位置。​​ 來自的值: az account list-locations 。 您可以使用 az configure --defaults location=<location> 設定預設位置。

--no-wait

請勿等候長時間執行的作業完成。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--scale-units

Bastion Host 資源的縮放單位,範圍為 [2, 50]。

--sku

此 Bastion 主機的 SKU。

接受的值: Basic, Standard
預設值: Standard
--tags

以空格分隔的標記:key[=value] [key[=value] ...]。支援速記語法、json-file 和 yaml-file。 請嘗試 「??」 以顯示更多。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az network bastion delete

預覽

命令群組 'az network' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

刪除 Azure Bastion 主機電腦。

az network bastion delete [--ids]
                          [--name]
                          [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                          [--resource-group]
                          [--subscription]

範例

刪除 Azure Bastion 主機電腦。

az network bastion delete --name MyBastionHost --resource-group MyResourceGroup

選擇性參數

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源識別碼」引數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」引數。

--name -n

防禦主機的名稱。

--no-wait

請勿等候長時間執行的作業完成。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az network bastion list

預覽

命令群組 'az network' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

列出所有 Azure Bastion 主機電腦。

az network bastion list [--resource-group]

範例

列出所有 Azure Bastion 主機電腦。

az network bastion list -g MyResourceGroup

選擇性參數

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az network bastion rdp

預覽

命令群組 'az network' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

使用來自 Azure Bastion 通道的 RDP 以虛擬機器為目標。

az network bastion rdp [--auth-type]
                       [--configure]
                       [--disable-gateway {false, true}]
                       [--enable-mfa {false, true}]
                       [--ids]
                       [--name]
                       [--resource-group]
                       [--resource-port]
                       [--subscription]
                       [--target-ip-address]
                       [--target-resource-id]

範例

使用 Azure Bastion 對虛擬機器進行 RDP。

az network bastion rdp --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId

使用可連線 IP 位址對機器的 RDP。

az network bastion rdp --name MyBastionHost --resource-group MyResourceGroup --target-ip-address 10.0.0.1

選擇性參數

--auth-type

要用於 RDP 連線的驗證類型。

--configure

設定 RDP 會話的旗標。

預設值: False
--disable-gateway

旗標以停用透過 RD 閘道的存取。

接受的值: false, true
預設值: False
--enable-mfa

如果目的電腦支援,請啟用 MFA 的 RDS 驗證。

接受的值: false, true
預設值: False
--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源識別碼」引數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」引數。

--name -n

防禦主機的名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--resource-port

防禦所連線的目標 VM 資源埠。

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

--target-ip-address

目標虛擬機器的 IP 位址。

--target-resource-id

目標虛擬機器的 ResourceId。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az network bastion show

預覽

命令群組 'az network' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

顯示 Azure Bastion 主機電腦。

az network bastion show [--ids]
                        [--name]
                        [--resource-group]
                        [--subscription]

範例

顯示 Azure Bastion 主機電腦。

az network bastion show --name MyBastionHost --resource-group MyResourceGroup

選擇性參數

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源識別碼」引數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」引數。

--name -n

防禦主機的名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--subscription

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID 帳戶。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az network bastion ssh

預覽

命令群組 'az network' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

使用 Azure Bastion 的通道透過 SSH 連線到虛擬機。

az network bastion ssh --auth-type
                       [--ids]
                       [--name]
                       [--resource-group]
                       [--resource-port]
                       [--ssh-key]
                       [--subscription]
                       [--target-ip-address]
                       [--target-resource-id]
                       [--username]

範例

使用密碼透過 Azure Bastion 透過 SSH 連線到虛擬機器。

az network bastion ssh --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId --auth-type password --username xyz

使用 ssh 金鑰檔案透過 Azure Bastion 透過 SSH 連線到虛擬機器。

az network bastion ssh --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId --auth-type ssh-key --username xyz --ssh-key C:/filepath/sshkey.pem

使用 AAD 透過 Azure Bastion 透過 SSH 連線到虛擬機器。

az network bastion ssh --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId --auth-type AAD

使用 AAD 透過 Azure Bastion 透過 SSH 連線到虛擬機器。

az network bastion ssh --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId --auth-type AAD

必要參數

--auth-type

要用於 SSH 連線的驗證類型。

選擇性參數

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源識別碼」引數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」引數。

--name -n

防禦主機的名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--resource-port

防禦所連線的目標 VM 資源埠。

--ssh-key

SSH 連線的 SSH 金鑰檔案位置。

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--target-ip-address

目標虛擬機的IP位址。

--target-resource-id

目標虛擬機的 ResourceId。

--username

SSH 連線的用戶名稱。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az network bastion tunnel

預覽

命令群組 'az network' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

透過 Azure Bastion 開啟通道至目標虛擬機。

az network bastion tunnel --port
                          --resource-port
                          [--ids]
                          [--name]
                          [--resource-group]
                          [--subscription]
                          [--target-ip-address]
                          [--target-resource-id]
                          [--timeout]

範例

使用 resourceId 透過 Azure Bastion 開啟通道至目標虛擬機。

az network bastion tunnel --name MyBastionHost --resource-group MyResourceGroup --target-resource-id vmResourceId --resource-port 22 --port 50022

使用 Azure Bastion 的 IP 位址,透過 Azure Bastion 開啟通道至目標虛擬機。

az network bastion tunnel --name MyBastionHost --resource-group MyResourceGroup --target-ip-address 10.0.0.1 --resource-port 22 --port 50022

必要參數

--port

用於通道的本機埠。

--resource-port

防禦所連線的目標 VM 資源埠。

選擇性參數

--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

--name -n

防禦主機的名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--target-ip-address

目標虛擬機的IP位址。

--target-resource-id

目標虛擬機的 ResourceId。

--timeout

線上到防禦主機通道的逾時。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az network bastion update

預覽

命令群組 'az network' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

更新 Azure Bastion 主電腦。

az network bastion update [--add]
                          [--disable-copy-paste {0, 1, f, false, n, no, t, true, y, yes}]
                          [--enable-ip-connect {0, 1, f, false, n, no, t, true, y, yes}]
                          [--enable-tunneling {0, 1, f, false, n, no, t, true, y, yes}]
                          [--force-string {0, 1, f, false, n, no, t, true, y, yes}]
                          [--ids]
                          [--name]
                          [--no-wait {0, 1, f, false, n, no, t, true, y, yes}]
                          [--remove]
                          [--resource-group]
                          [--scale-units]
                          [--set]
                          [--sku {Basic, Standard}]
                          [--subscription]

範例

更新 Azure Bastion 主電腦以啟用原生客戶端支援。

az network bastion update --name MyBastionHost --resource-group MyResourceGroup --enable-tunneling

選擇性參數

--add

藉由指定路徑和索引鍵值組,將物件加入物件清單。 範例:--add property.listProperty <key=value、string 或 JSON 字串>。

--disable-copy-paste

停用此 Azure Bastion 資源上所有工作階段的複製並貼上。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--enable-ip-connect

在此 Azure Bastion 資源上啟用以 IP 為基礎的 連線。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--enable-tunneling

在此 Azure Bastion 資源上啟用 Native Client 支援。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--force-string

使用 'set' 或 'add' 時,請保留字串常值,而不是嘗試轉換成 JSON。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

--name -n

防禦主機的名稱。

--no-wait

請勿等候長時間執行的作業完成。

接受的值: 0, 1, f, false, n, no, t, true, y, yes
--remove

從清單中移除屬性或專案。 範例:--remove property.list OR --remove 屬性ToRemove。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--scale-units

Bastion Host 資源的縮放單位,範圍為 [2, 50]。

--set

指定要設定的屬性路徑和值,以更新物件。 範例:--set property1.property2=。

--sku

此 Bastion 主機的 SKU。

接受的值: Basic, Standard
--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。

az network bastion wait

預覽

命令群組 'az network' 處於預覽狀態,且正在開發中。 參考和支援層級: https://aka.ms/CLI_refstatus

將 CLI 置於等候狀態,直到符合條件為止。

az network bastion wait [--created]
                        [--custom]
                        [--deleted]
                        [--exists]
                        [--ids]
                        [--interval]
                        [--name]
                        [--resource-group]
                        [--subscription]
                        [--timeout]
                        [--updated]

選擇性參數

--created

請等候在 'Succeeded' 使用 'provisioningState' 建立。

預設值: False
--custom

等到條件符合自定義 JMESPath 查詢為止。 例如 provisioningState!='InProgress', instanceView.statuses[?code=='PowerState/running']。

--deleted

等到刪除為止。

預設值: False
--exists

等候資源存在。

預設值: False
--ids

一或多個資源識別碼 (以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

--interval

輪詢間隔以秒為單位。

預設值: 30
--name -n

防禦主機的名稱。

--resource-group -g

資源組名。 您可以使用 來設定預設群組 az configure --defaults group=<name>

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--timeout

以秒為單位的等候上限。

預設值: 3600
--updated

等到 provisioningState 更新為 'Succeeded'。

預設值: False
全域參數
--debug

增加記錄詳細資訊,以顯示所有偵錯記錄。

--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

--output -o

輸出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
預設值: json
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。