你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
使用
注意
此过程用于紧急情况下,当通过 Azure 的所有其他故障排除选项已耗尽时。 对这些裸机计算机的 SSH 访问仅限于通过此方法从指定的跳板机列表管理的用户。
在极少数情况下,用户需要调查并解决裸金属机器上的问题,而且使用 Azure 的所有其他方法都已用尽。 Azure 运营商关系提供 az networkcloud cluster bmckeyset
命令,使用户可以在这些裸机计算机上管理对基板管理控制器 (BMC) 的 SSH 访问。 创建密钥集时,通过交叉引用为用户提供的用户主体名称与提供的 Azure 组 ID --azure-group-id <Entra Group ID>
,根据 Microsoft Entra ID 对用户进行验证,以进行正确的授权。
密钥集中的用户每四小时验证一次,当任何密钥集有任何更改时也会进行验证。 然后,每个用户的状态设置为“活动”或“无效”。无效用户仍保留在密钥集中,但他们的密钥会从所有主机上删除,而且不允许他们访问。 用户无效的原因包括:
- 未指定用户的用户主体名称
- 用户的用户主体名称不是给定的 Microsoft Entra 组的成员
- 给定的Microsoft Entra 组不存在(在这种情况下,密钥集中的所有用户都无效)
- 密钥集已过期(在这种情况下,密钥集中的所有用户都无效)
注意
由于对所有用户强制执行 Microsoft Entra ID 验证,因此现在密钥集需要“用户主体名称”。 当前未为所有用户指定用户主体名称的密钥集在到期日期之前继续工作。 如果没有用户主体名称的密钥集过期,则需要使用所有用户的用户主体名称更新密钥集才能再次生效。 2024 年 12 月之前没有与所有用户的用户主名称关联的密钥集存在 Invalid
风险。 如果任何用户缺少用户主体名称,则会导致整个密钥集失效。
密钥集和每个单独的用户还具有传达其他信息的详细状态消息:
- 密钥集的 detailedStatusMessage 会告知密钥集是否过期,以及有关在群集中更新密钥集时遇到的问题的其他信息。
- 用户的 statusMessage 会告知该用户是活动状态还是无效状态,以及尚未更新到用户最新活动/无效状态的计算机列表。 在每种情况下,如果知道问题的原因,也会包括在内。
运行该命令时,它会在群集中具有活动 Kubernetes 节点的每台裸机计算机上执行。 有一个定期运行的协调过程,该过程会在执行原始命令时不可用的任何裸机计算机上重试该命令。 此外,任何通过 az networkcloud baremetalmachine actionreimage
或 az networkcloud baremetalmachine actionreplace
命令返回群集的裸机计算机(请参阅 BareMetal 函数)都会发送一个信号,使任何活动密钥集在计算机返回到群集时立即发送到该计算机。 多个命令按接收的顺序执行。
先决条件
- 安装最新版本的相应 CLI 扩展。
- 本地群集必须连接到 Azure。
- 获取
Cluster
资源的资源组名称。 - 此过程将密钥集应用于所有正在运行的裸机计算机。
- 添加的用户必须是 Microsoft Entra 组的一部分。 有关详细信息,请参阅如何管理组。
- 要限制用于管理密钥集的访问权限,请创建自定义角色。 有关详细信息,请参阅 Azure 自定义角色。 在此实例中,添加或排除
Microsoft.NetworkCloud/clusters/bmcKeySets
的权限。 选项为/read
、/write
和/delete
。
注意
通过本文所述的命令创建、修改或删除 BMC 访问权限时,后台进程会将这些更改传递到计算机。 在运营商关系软件升级期间,此过程会暂停。 如果已知正在进行升级,则可以配合使用 --no-wait
选项和命令,以防止命令提示符等待该过程完成。
局限性
BMC 密钥集用户限制
虽然 BMC 最多支持 16 个用户,但保留 6 个用户供系统使用,而 BMC 密钥集用户则保留 10 个。 BMC密钥集用户按群集定义,并应用于每个裸机计算机。 尝试添加超过 10 个用户会导致错误。 在已经存在 10 个用户的情况下,先删除一个用户再添加另一个。
注意
不应手动创建或修改 BMC 用户。 Nexus 完全管理 BMC 用户及其在槽中的位置。 手动更改可能导致裸金属机器停止运行并无法访问。 如果有疑问, 请联系支持人员。
下面是 BMC 槽与用户的映射。
BMC 槽 | 用户 |
---|---|
槽 1-6 | 预留给系统使用 |
插槽 7-16 | 为 BMC 密钥集用户保留 |
Microsoft Entra 组用户限制
不建议使用具有 5,000 个以上的用户的 Microsoft Entra 组 ID。 协调大量用户可能会导致超时、导致访问阻塞,并引发登录问题。
创建 BMC 密钥集
该 bmckeyset create
命令为一组用户创建对集群中裸金属机器的 SSH 访问权限。
命令语法为:
az networkcloud cluster bmckeyset create \
--name <BMC Keyset Name> \
--extended-___location name=<Extended Location ARM ID> \
type="CustomLocation" \
--___location <Azure Region> \
--azure-group-id <Azure AAD Group ID> \
--expiration <Expiration Timestamp> \
--privilege-level <"Administrator" or "ReadOnly"> \
--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 <Resource Group Name>
创建参数
--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.
--bmc-key-set-name --name -n [Required] : The name of the BMC 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 BMCs. The maximum expiration date is a
year from creation date. 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".
--privilege-level [Required] : The access level allowed for the users
in this key set. Allowed values:
"Administrator" or "ReadOnly".
--resource-group -g [Required] : Name of 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: Required. The User Principal Name of the User.
Multiple users can be specified by using more than one --user-list argument.
--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.
注意
BMCKeyset 中每个用户提供的公钥必须是 iDRAC 支持的类型之一。 使用不受支持的类型的键可能会导致错误或未定义的行为。 支持的类型包括:
- rsa-sha2-512
- rsa-sha2-256
- ssh-rsa
- ecdsa-sha2-nistp256
- ssh-ed25519
有关详细信息,请参阅 Dell iDRAC9 安全配置指南。
本示例创建了一个新的密钥集,其中有两个用户,这两个用户具有从两个跳板机进行标准访问的权限。
az networkcloud cluster bmckeyset create \
--name "bmcKeySetName" \
--extended-___location name="/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.ExtendedLocation/customLocations/clusterExtendedLocationName" \
type="CustomLocation" \
--___location "___location" \
--azure-group-id "f110271b-XXXX-4163-9b99-214d91660f0e" \
--expiration "2023-12-31T23:59:59.008Z" \
--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"}},\
{"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"}}]' \
--tags key1="myvalue1" key2="myvalue2" \
--cluster-name "clusterName" \
--resource-group "resourceGroupName"
要获取创建 --user-list
结构的帮助,请参阅 Azure CLI 速记。
删除 BMC 密钥集
通过 bmckeyset delete
命令可删除一组用户对 BMC 的 SSH 访问权限。 组的所有成员都将失去对群集中任何 BMC 的 SSH 访问权限。
命令语法为:
az networkcloud cluster bmckeyset delete \
--name <BMC Keyset Name> \
--cluster-name <Cluster Name> \
--resource-group <Resource Group Name> \
删除参数
--bmc-key-set-name --name -n [Required] : The name of the BMC key set to be deleted.
--cluster-name [Required] : The name of the cluster.
--resource-group -g [Required] : Name of 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”群集中的“bmcKeysetName”密钥集组。
az networkcloud cluster bmckeyset delete \
--name "bmcKeySetName" \
--cluster-name "clusterName" \
--resource-group "resourceGroupName" \
更新 BMC 密钥集
bmckeyset update
命令允许用户对现有密钥集组进行更改。
命令语法为:
az networkcloud cluster bmckeyset update \
--name <BMC Keyset Name> \
--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 <Resource Group Name>
更新参数
--bmc-key-set-name --name -n [Required] : The name of the BMC 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 BMCs. The maximum expiration date is a
year from creation date. Format is
"YYYY-MM-DDTHH:MM:SS.000Z".
--privilege-level : The access level allowed for the users
in this key set. Allowed values:
"Administrator" or "ReadOnly".
--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: Required. 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 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.
此示例将两个新用户添加到“bmcKeySetName”组,并更改该组的到期时间。
az networkcloud cluster bmckeyset update \
--name "bmcKeySetName" \
--expiration "2023-12-31T23:59:59.008Z" \
--user-list '[{"description":"Needs access for troubleshooting as a part of the support team",\
"azureUserName":"userDEF", \
"sshPublicKey":{"keyData":"ssh-rsa AAtsE3njSONzDYRIZv/WLjVuMfrUSByHp+jfaaOLHTIIB4fJvo6dQUZxE20w2iDHV3tEkmnTo84eba97VMueQD6OzJPEyWZMRpz8UYWOd0IXeRqiFu1lawNblZhwNT/ojNZfpB3af/YDzwQCZgTcTRyNNhL4o/blKUmug0daSsSXISTRnIDpcf5qytjs1XoyYyJMvzLL59mhAyb3p/cD+Y3/s3WhAx+l0XOKpzXnblrv9d3q4c2tWmm/SyFqthaqd0= admin@vm"}, \
"userPrincipalName":"example@contoso.com"}] \
--cluster-name "clusterName" \
--resource-group "resourceGroupName"
列出 BMC 密钥集
bmckeyset list
命令允许用户查看群集中的现有密钥集组。
命令语法为:
az networkcloud cluster bmckeyset list \
--cluster-name <Cluster Name> \
--resource-group <Resource Group Name>
列出参数
--cluster-name [Required] : The name of the cluster.
--resource-group -g [Required] : Name of resource group. Optional if
configuring the default group using `az
configure --defaults group=<name>`.
显示 BMC 密钥集详细信息
bmckeyset show
命令允许用户查看群集中现有密钥集组的详细信息。
命令语法为:
az networkcloud cluster bmckeyset show \
--cluster-name <Cluster Name> \
--resource-group <Resource Group Name>
显示参数
--bmc-key-set-name --name -n [Required] : The name of the BMC key set.
--cluster-name [Required] : The name of the cluster.
--resource-group -g [Required] : Name of resource group. You can
configure the default group using `az
configure --defaults group=<name>`.