Share via


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

注意事項

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

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

ユーザーのユーザー プリンシパル名が指定されたグループのメンバーでない場合、ユーザーの状態は "Invalid" に設定され、そのステータス メッセージに "userPrincipal は AAD グループのメンバーではないので無効です" と表示されます。Azure グループ ID が無効な場合、キーセット内の各ユーザーの状態は "無効" に設定され、状態メッセージに "AAD グループは存在しません" と表示されます。無効なユーザーはキーセットに再メインしますが、そのキーは SSH アクセスに対して有効になりません。

Note

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

コマンドが実行されると、アクティブ 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> \
  --jump-hosts-allowed <List of jump server IP addresses> \
  --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 limit is up to 1 year from creation.
                                                           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> \
  --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 <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                                           : The date and time after which the users
                                                           in this key set are removed from
                                                           the BMCs. 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:
                                                           "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>`.