az networkcloud cluster bmckeyset を使用してベアメタル マシンへの緊急アクセスを管理する

注意事項

このプロセスは、Azure 経由の他のすべてのトラブルシューティング オプションを試し尽くした緊急時に使用されるものであることに注意してください。 これらのベアメタル マシンへの SSH アクセスは、指定されたジャンプ ホスト リストから、この方法を介して管理されるユーザーに制限されます。

ユーザーがベアメタル マシンの問題を調査して解決する必要があり、Azure を使用した他のすべての方法を試し尽くした状況になることはまれです。 Operator Nexus は、ユーザーがこれらのベアメタル マシンでベースボード管理コントローラー (BMC) への SSH アクセスを管理できるように、az networkcloud cluster bmckeyset コマンドを提供します。 キーセットの作成時に、ユーザーに提供されたユーザー プリンシパル名を、指定した Azure グループ ID --azure-group-id <Entra Group ID> と相互参照することにより、ユーザーが適切に認可されているかどうかが Microsoft Entra ID に対して検証されます。

キー セット内のユーザーは、4 時間ごとと、キー セットに変更が加えられたときに検証されます。 これにより、各ユーザーの状態が "アクティブ" または "無効" に設定されます。無効なユーザーはキー セットに残りますが、そのキーはすべてのホストから削除され、アクセスは許可されません。 ユーザーが無効になる理由を次に示します。

  • ユーザーのユーザー プリンシパル名が、指定された Entra グループ (指定されている場合) のメンバーではありません
  • 指定された Entra グループ (指定されている場合) が存在しません (その場合、キー セット内のすべてのユーザーが無効になります)
  • キー セットの有効期限が切れています (その場合、キー セット内のすべてのユーザーが無効になります)

Note

現在は、ユーザー プリンシパル名の指定を省略できる移行期間です。 今後のリリースでは、これが必須となり、Microsoft Entra ID の検証がすべてのユーザーに対して適用される予定です。 キーセットが無効にならないように、移行期間が終了する (2024 年 7 月に予定) 前にユーザー プリンシパル名をキーセットに追加することをお勧めします。 ユーザー プリンシパル名をキーセットに追加すると、すべてのユーザーに対して追加されていない場合でも、Microsoft Entra ID の検証が有効になることに注意してください。その結果、指定したグループ ID が無効な場合は、キーセット全体が無効になります。

キー セットと個々のユーザーそれぞれに、他の情報を伝える詳細なステータス メッセージもあります。

  • キー セットの detailedStatusMessage は、キー セットの有効期限が切れているかどうかと、クラスター全体でキー セットの更新中に発生した問題に関するその他の情報を示します。
  • ユーザーの statusMessage は、ユーザーがアクティブか無効かと、ユーザーの最新のアクティブ/無効状態にまだ更新されていないマシンの一覧を示します。 いずれの場合も、問題の原因が含められます (わかっている場合)。

コマンドが実行されると、アクティブ Kubernetes ノードを使用するクラスター内の各ベアメタル マシン上で実行されます。 元のコマンドの時に利用できなかったベアメタル マシンでコマンドを再試行する、定期的に実行される調整プロセスがあります。 また、az networkcloud baremetalmachine actionreimage または az networkcloud baremetalmachine actionreplace コマンド (「BareMetal 関数」を参照) を介してクラスターに戻ったベアメタル マシンは、クラスターに戻るとすぐに、アクティブ キーセットをマシンに送信する信号を送信します。 複数のコマンドは受け取った順番に実行されます。

BMC は、最大ユーザー数 12 をサポートします。 ユーザーはクラスターごとに定義され、各ベアメタル マシンに適用されます。 12 を超えるユーザーを追加しようとすると、エラーが発生します。 12 のユーザーが既に存在する場合は、ユーザーを削除してから別のユーザーを追加してください。

前提条件

  • 適切な CLI 拡張機能の最新バージョンをインストールします。
  • オンプレミス クラスターは Azure に接続できるようにする必要があります。
  • Cluster リソース向けのリソース グループの名前を取得します。
  • このプロセスでは、実行中のすべてのベアメタル マシンにキーセットが適用されます。
  • 追加されたユーザーは、Microsoft Entra グループに属している必要があります。 詳細については、グループを管理する方法に関するページを参照してください。
  • キーセットを管理するためのアクセスを制限するには、カスタム ロールを作成します。 詳細については、「Azure カスタム ロール」を参照してください。 この例では、Microsoft.NetworkCloud/clusters/bmcKeySets のアクセス許可を追加または除外します。 オプションには /read/write/delete があります。

Note

BMC アクセスが、この記事で説明されているコマンド経由で作成、変更、削除されたときは、バックグラウンド プロセスがそれらの変更をマシンに配布します。 このプロセスは、Operator Nexus ソフトウェアのアップグレード中に一時停止されます。 アップグレードが進行中であることが分かっている場合は、--no-wait オプションをコマンドで使用することで、コマンド プロンプトがプロセスの完了まで待機しないようにすることができます。

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: Optional. 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.

この例では、2 つのジャンプ ホストから標準アクセス権を持つ 2 人のユーザーを持つ新しいキーセットを作成します。

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: 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 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" グループに新しいユーザーを 2 人追加し、グループの有効期限を変更しています。

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>`.