共用方式為


az sshkey

使用 vm 管理 ssh 公鑰。

命令

名稱 Description 類型 狀態
az sshkey create

建立新的 SSH 公鑰資源。

核心 GA
az sshkey delete

刪除 SSH 公鑰。

核心 GA
az sshkey list

列出所有 SSH 公鑰。

核心 GA
az sshkey show

擷取 SSH 公鑰的相關信息。

核心 GA
az sshkey update

更新 SSH 公鑰資源。

核心 GA

az sshkey create

建立新的 SSH 公鑰資源。

az sshkey create --name --ssh-public-key-name
                 --resource-group
                 [--encryption-type {Ed25519, RSA}]
                 [--location]
                 [--public-key]
                 [--tags]

範例

建立新的 SSH 公鑰資源。

az sshkey create --location "westus" --public-key "{ssh-rsa public key}" --resource-group "myResourceGroup" --name "mySshPublicKeyName"

在檔案中使用公鑰建立新的 SSH 公鑰資源。

az sshkey create --location "westus" --public-key "@filename" --resource-group "myResourceGroup" --name "mySshPublicKeyName"

建立具有自動產生值的新SSH 公鑰資源。

az sshkey create --location "westus" --resource-group "myResourceGroup" --name "mySshPublicKeyName"

使用 Ed25519 加密建立新的 SSH 公鑰資源。

az sshkey create --location "westus" --resource-group "myResourceGroup" --name "mySshPublicKeyName" --encryption-type "Ed25519"

必要參數

--name --ssh-public-key-name -n

SSH 公鑰的名稱。

--resource-group -g

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

選擇性參數

--encryption-type

要產生的 SSH 金鑰加密類型。

接受的值: Ed25519, RSA
預設值: RSA
--location -l

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

--public-key

用來透過 ssh 向虛擬機驗證的 SSH 公鑰。 如果最初未在建立資源時提供這個屬性,則會在呼叫 generateKeyPair 時填入 publicKey 屬性。 如果在資源建立時提供公鑰,則提供的公鑰必須至少為 2048 位且 ssh-rsa 格式。

--tags

以空格分隔的標記:key[=value] [key[=value] ...]。使用 「清除現有的標記」。

全域參數
--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 sshkey delete

刪除 SSH 公鑰。

az sshkey delete [--ids]
                 [--name --ssh-public-key-name]
                 [--resource-group]
                 [--subscription]
                 [--yes]

選擇性參數

--ids

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

--name --ssh-public-key-name -n

SSH 公鑰的名稱。

--resource-group -g

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

--subscription

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

--yes -y

請勿提示確認。

預設值: 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。

az sshkey list

列出所有 SSH 公鑰。

az sshkey list [--resource-group]

選擇性參數

--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 sshkey show

擷取 SSH 公鑰的相關信息。

az sshkey show [--ids]
               [--name --ssh-public-key-name]
               [--resource-group]
               [--subscription]

範例

取得 SSH 公鑰。

az sshkey show --resource-group "myResourceGroup" --name "mySshPublicKeyName"

選擇性參數

--ids

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

--name --ssh-public-key-name -n

SSH 公鑰的名稱。

--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 sshkey update

更新 SSH 公鑰資源。

az sshkey update [--ids]
                 [--name --ssh-public-key-name]
                 [--public-key]
                 [--resource-group]
                 [--subscription]
                 [--tags]

選擇性參數

--ids

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

--name --ssh-public-key-name -n

SSH 公鑰的名稱。

--public-key

用來透過 ssh 向虛擬機驗證的 SSH 公鑰。 如果最初未在建立資源時提供這個屬性,則會在呼叫 generateKeyPair 時填入 publicKey 屬性。 如果在資源建立時提供公鑰,則提供的公鑰必須至少為 2048 位且 ssh-rsa 格式。

--resource-group -g

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

--subscription

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

--tags

以空格分隔的標記:key[=value] [key[=value] ...]。使用 「清除現有的標記」。

全域參數
--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。