使用管理裸機計算機的緊急存取 az networkcloud cluster baremetalmachinekeyset
警告
請注意,當所有其他使用 Azure 的疑難解答選項已用盡時,此程式會在緊急情況下使用。 這些裸機電腦的 SSH 存取僅限於從指定的跳躍主機清單透過此方法管理的使用者。
使用者需要調查並解決裸機機器的問題,而所有其他方式都已透過 Azure 耗盡的情況。 Azure 操作員 Nexus 提供 az networkcloud cluster baremetalmachinekeyset
命令,讓用戶能夠管理對這些裸機計算機的 SSH 存取。 在密鑰集建立時,會針對 Microsoft Entra ID 驗證使用者,以取得適當的授權,方法是交叉參考針對提供的 Microsoft Entra ID --azure-group-id <Entra Group ID>
提供給使用者的用戶主體名稱。
如果使用者的用戶主體名稱不是所提供群組的成員,則使用者的狀態會設定為 「無效」,而其狀態消息會指出「無效,因為 userPrincipal 不是 AAD 群組的成員」。如果 Azure 群組識別碼無效,金鑰集中的每位使用者都會將其狀態設定為 「無效」,而其狀態消息會指出「AAD 群組不存在」。無效的使用者會保留在金鑰集中,但不會啟用其金鑰以進行 SSH 存取。
注意
目前有一個過渡期,其中指定用戶主體名稱是選擇性的。 在未來版本中,它將會變成強制,而且所有使用者都將強制執行 Microsoft Entra ID 驗證。 鼓勵使用者在過渡期間結束之前將用戶主體名稱新增至其密鑰集(計劃於 2024 年 7 月),以避免金鑰集失效。 請注意,如果將任何用戶主體名稱新增至密鑰集,即使未針對所有使用者新增名稱,也會啟用 Microsoft Entra ID 驗證,如果指定的群組標識符無效,這會導致整個密鑰集失效。
當命令執行時,它會在叢集中具有作用中 Kubernetes 節點的每個裸機電腦上執行。 有一個對帳程式會定期執行,以在原始命令時無法使用的任何裸機計算機上重試命令。 此外,任何透過 az networkcloud baremetalmachine reimage
或 az networkcloud baremetalmachine replace
命令傳回叢集的裸機電腦(請參閱 BareMetal函式)都會傳送訊號,讓任何作用中索引鍵集在返回叢集時立即傳送至計算機。 多個命令會依收到的順序執行。
群組中的用戶數目沒有限制。
警告
跳躍主機 IP 位址的注意事項
- 金鑰集建立/更新程式會將跳躍主機 IP 位址新增至叢集中每部計算機的 IP 數據表。 這會限制只能從這些跳躍主機允許 SSH 存取。
- 請務必指定跳躍主機的叢集對應IP位址。 這些IP位址可能與用來存取跳躍主機的公用對應IP位址不同。
- 新增之後,使用者就能夠從任何指定的跳躍主機 IP 存取裸機計算機,包括在另一個裸機計算機密鑰集群組中定義的跳躍主機 IP。
- 新增第一個裸機計算機密鑰集時,現有的 SSH 存取會維持不變。 不過,keyset 命令會限制現有使用者的 SSH 存取金鑰集命令中指定的跳躍主機 IP。
必要條件
- 安裝最新版本的適當 CLI 擴充功能。
- 內部部署叢集必須能夠連線到 Azure。
- 取得資源的資源組名
Cluster
。 - 此程式會將金鑰集套用至所有執行中的裸機機器。
- 新增的用戶必須是 Microsoft Entra 群組的一部分。 如需詳細資訊,請參閱 如何管理群組。
- 若要限制管理金鑰集的存取權,請建立自定義角色。 如需詳細資訊,請參閱 Azure 自定義角色。 在此實例中,新增或排除 的許可權
Microsoft.NetworkCloud/clusters/bareMetalMachineKeySets
。 選項有/read
、/write
和/delete
。
注意
透過本文所述的命令建立、修改或刪除裸機計算機存取時,背景程式會將這些變更傳遞給機器。 此程式會在操作員 Nexus 軟體升級期間暫停。 如果已知正在進行升級,您可以搭配 命令使用 --no-wait
選項,以防止命令提示字元等待程式完成。
建立裸機計算機金鑰集
命令 baremetalmachinekeyset create
會為一組使用者建立叢集中裸機計算機的 SSH 存取權。
命令語法為:
az networkcloud cluster baremetalmachinekeyset create \
--name "<bare metal machine Keyset Name>" \
--extended-location name="<Extended Location ARM ID>" \
type="CustomLocation" \
--location "<Azure Region>" \
--azure-group-id "<Azure Group ID>" \
--expiration "<Expiration Timestamp>" \
--jump-hosts-allowed "<List of jump server IP addresses>" \
--os-group-name "<Name of the Operating System Group>" \
--privilege-level "<"Standard" or "Superuser">" \
--user-list '[{"description":"<User List Description>","azureUserName":"<User Name>",\
"sshPublicKey":{"keyData":"<SSH Public Key>"}, \
"userPrincipalName":""}]', \
--tags key1="<Key Value>" key2="<Key Value>" \
--cluster-name "<Cluster Name>" \
--resource-group "<cluster_RG>"
建立自變數
--azure-group-id [Required] : The object ID of Azure Active Directory
group that all users in the list must
be in for access to be granted. Users
that are not in the group do not have
access.
--bare-metal-machine-key-set-name --name -n [Required] : The name of the bare metal machine key
set.
--cluster-name [Required] : The name of the cluster.
--expiration [Required] : The date and time after which the users
in this key set are removed from
the bare metal machines. Format is:
"YYYY-MM-DDTHH:MM:SS.000Z"
--extended-location [Required] : The extended location of the cluster
associated with the resource.
Usage: --extended-location name=XX type=XX
name: Required. The resource ID of the extended location on which the resource is created.
type: Required. The extended location type: "CustomLocation".
--jump-hosts-allowed [Required] : The list of IP addresses of jump hosts
with management network access from
which a login is be allowed for the
users. Supports IPv4 or IPv6 addresses.
--privilege-level [Required] : The access level allowed for the users
in this key set. Allowed values:
"Standard" or "Superuser".
--resource-group -g [Required] : Name of cluster resource group. Optional if
configuring the default group using `az
configure --defaults group=<name>`.
--user-list [Required] : The unique list of permitted users.
Usage: --user-list azure-user-name=XX description=XX key-data=XX
azure-user-name: Required. User name used to login to the server.
description: The free-form description for this user.
key-data: Required. The public ssh key of the user.
userPrincipalName: Optional. The User Principal Name of the User.
Multiple users can be specified by using more than one --user-list argument.
--os-group-name : The name of the group that users are assigned
to on the operating system of the machines.
--tags : Space-separated tags: key[=value]
[key[=value] ...]. Use '' to clear
existing tags.
--location -l : Azure Region. Values from: `az account
list-locations`. You can configure the
default location using `az configure
--defaults location=<location>`.
--no-wait : Do not wait for the long-running
operation to finish.
全域 Azure CLI 自變數 (適用於所有命令)
--debug : Increase logging verbosity to show all
debug logs.
--help -h : Show this help message and exit.
--only-show-errors : Only show errors, suppressing warnings.
--output -o : Output format. Allowed values: json,
jsonc, none, table, tsv, yaml, yamlc.
Default: json.
--query : JMESPath query string. See
http://jmespath.org/ for more
information and examples.
--subscription [Required] : Name or ID of subscription. Optional if
configuring the default subscription
using `az account set -s NAME_OR_ID`.
--verbose : Increase logging verbosity. Use --debug
for full debug logs.
此範例會建立具有兩個使用者的新索引鍵集,且使用者具有兩個跳躍主機的標準存取權。
az networkcloud cluster baremetalmachinekeyset create \
--name "bareMetalMachineKeySetName" \
--extended-location name="/subscriptions/subscriptionId/resourceGroups/cluster_RG/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" \
type="CustomLocation" \
--location "eastus" \
--azure-group-id "f110271b-XXXX-4163-9b99-214d91660f0e" \
--expiration "2022-12-31T23:59:59.008Z" \
--jump-hosts-allowed "192.0.2.1" "192.0.2.5" \
--os-group-name "standardAccessGroup" \
--privilege-level "Standard" \
--user-list '[{"description":"Needs access for troubleshooting as a part of the support team","azureUserName":"userABC", "sshPublicKey":{"keyData":"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1XoyYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm"},"userPrincipalName":"example@contoso.com"},\
{"description":"Needs access for troubleshooting as a part of the support team","azureUserName":"userXYZ","sshPublicKey":{"keyData":"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXTSTRnIDpcf5qytjs1XoyYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm"}, "userPrincipalName":"example@contoso.com"}]' \
--tags key1="myvalue1" key2="myvalue2" \
--cluster-name "clusterName"
--resource-group "cluster_RG"
如需建立 --user-list
結構的協助,請參閱 Azure CLI 速記。
刪除裸機計算機金鑰集
命令 baremetalmachinekeyset delete
會移除一組使用者的裸機計算機的 SSH 存取權。 群組的所有成員都不再具有叢集中任何裸機計算機的 SSH 存取權。
命令語法為:
az networkcloud cluster baremetalmachinekeyset delete \
--name "<bare metal machine Keyset Name>" \
--cluster-name "<Cluster Name>" \
--resource-group "<cluster_RG>"
刪除自變數
--bare-metal-machine-key-set-name --name -n [Required] : The name of the bare metal machine key set to be
deleted.
--cluster-name [Required] : The name of the cluster.
--resource-group -g [Required] : Name of cluster resource group. Optional if configuring the
default group using `az configure --defaults
group=<name>`.
--no-wait : Do not wait for the long-running operation to
finish.
--yes -y : Do not prompt for confirmation.
此範例會移除 「clusterName」 叢集中的 「bareMetalMachineKeysetName」 機碼集群組。
az networkcloud cluster baremetalmachinekeyset delete \
--name "bareMetalMachineKeySetName" \
--cluster-name "clusterName" \
--resource-group "cluster_RG"
更新裸機計算機金鑰集
baremetalmachinekeyset update
命令可讓使用者對現有的索引鍵集群組進行變更。
命令語法為:
az networkcloud cluster baremetalmachinekeyset update \
--name "<bare metal machine Keyset Name>" \
--jump-hosts-allowed "<List of jump server IP addresses>" \
--privilege-level "<"Standard" or "Superuser">" \
--user-list '[{"description":"<User List Description>","azureUserName":"<User Name>",\
"sshPublicKey":{"keyData":"<SSH Public Key>"}, \
"userPrincipalName":""}]', \
--tags key1="<Key Value>" key2="<Key Value> "\
--cluster-name "<Cluster Name>" \
--resource-group "<cluster_RG>"
更新自變數
--bare-metal-machine-key-set-name --name -n [Required] : The name of the bare metal machine key set.
--cluster-name [Required] : The name of the cluster.
--expiration : The date and time after which the users
in this key set are removed from
the bare metal machines. Format is:
"YYYY-MM-DDTHH:MM:SS.000Z"
--jump-hosts-allowed : The list of IP addresses of jump hosts
with management network access from
which a login is allowed for the
users. Supports IPv4 or IPv6 addresses.
--privilege-level : The access level allowed for the users
in this key set. Allowed values:
"Standard" or "Superuser".
--user-list : The unique list of permitted users.
Usage: --user-list azure-user-name=XX description=XX key-data=XX
azure-user-name: Required. User name used to login to the server.
description: The free-form description for this user.
key-data: Required. The public SSH key of the user.
userPrincipalName: Optional. The User Principal Name of the User.
Multiple users can be specified by using more than one --user-list argument.
--resource-group -g [Required] : Name of cluster resource group. Optional if
configuring the default group using `az
configure --defaults group=<name>`.
--tags : Space-separated tags: key[=value]
[key[=value] ...]. Use '' to clear
existing tags.
--no-wait : Do not wait for the long-running
operation to finish.
本範例會將兩個新使用者新增至 「baremetalMachineKeySetName」 群組,並變更群組的到期時間。
az networkcloud cluster baremetalmachinekeyset update \
--name "bareMetalMachineKeySetName" \
--expiration "2023-12-31T23:59:59.008Z" \
--user-list '[{"description":"Needs access for troubleshooting as a part of the support team",\
"azureUserName":"userABC", \
"sshPublicKey":{"keyData":"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1XoyYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm"}, \
"userPrincipalName":"example@contoso.com"},\
{"description":"Needs access for troubleshooting as a part of the support team",\
"azureUserName":"userXYZ", \
"sshPublicKey":{"keyData":"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXTSTRnIDpcf5qytjs1XoyYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm"}, \
"userPrincipalName":"example@contoso.com"}]' \
--cluster-name "clusterName" \
--resource-group "cluster_RG"
列出裸機計算機金鑰集
命令 baremetalmachinekeyset list
可讓使用者在叢集中查看現有的索引鍵集群組。
命令語法為:
az networkcloud cluster baremetalmachinekeyset list \
--cluster-name "<Cluster Name>" \
--resource-group "<cluster_RG>"
列出自變數
--cluster-name [Required] : The name of the cluster.
--resource-group -g [Required] : Name of cluster resource group. Optional if
configuring the default group using `az
configure --defaults group=<name>`.
顯示裸機計算機金鑰集詳細數據
命令 baremetalmachinekeyset show
可讓使用者查看叢集中現有索引鍵集群組的詳細數據。
命令語法為:
az networkcloud cluster baremetalmachinekeyset show \
--cluster-name "<Cluster Name>" \
--resource-group "<cluster_RG>"
顯示自變數
--bare-metal-machine-key-set-name --name -n [Required] : The name of the bare metal machine key
set.
--cluster-name [Required] : The name of the cluster.
--resource-group -g [Required] : Name of cluster resource group. You can
configure the default group using `az
configure --defaults group=<name>`.