Share via


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

注意事項

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

ユーザーがベア メタル マシンに関する問題を調査して解決する必要があり、その他すべての方法が Azure 経由で使い果たされている場合はまれです。 Azure Operator Nexus は、ユーザーがこれらのベアメタル マシンへの SSH アクセスを管理できるように、az networkcloud cluster baremetalmachinekeyset コマンドを提供します。 キーセットの作成時に、ユーザーは、指定された Microsoft Entra 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 関数」を参照) を介してクラスターに戻ったベアメタル マシンは、クラスターに戻るとすぐに、アクティブ キーセットをマシンに送信する信号を送信します。 複数のコマンドは受け取った順番に実行されます。

グループ内のユーザー数に制限はありません。

注意事項

ジャンプ ホストの IP アドレスに関する注意事項

  • キーセットの作成/更新プロセスでは、クラスター内の各マシンの IP テーブルにジャンプ ホストの IP アドレスが追加されます。 これにより、これらのジャンプ ホストからのみ SSH アクセスが許可されるように制限されます。
  • ジャンプ ホストのクラスター向け IP アドレスを指定することが重要です。 これらの IP アドレスは、ジャンプ ホストへのアクセスに使用される公開 IP アドレスとは異なる場合があります。
  • 一度追加されると、ユーザーは、別のベアメタル マシン キーセット グループで定義されたジャンプ ホスト IP など、指定されたジャンプ ホスト IP からベアメタル マシンにアクセスできます。
  • 最初のベアメタル マシンのキーセットを追加した場合でも、既存の SSH アクセスは保持されます。 ただし、キーセット コマンドは、既存のユーザーの SSH アクセスをキーセット コマンドで指定したジャンプ ホスト IP に制限します。

前提条件

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

Note

ベアメタル マシンへのアクセスが、この記事で説明するコマンドを介して作成、変更、削除されると、バックグラウンド プロセスでそれらの変更がマシンに配信されます。 このプロセスは、Operator 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 <Resource Group>

引数の作成

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

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

az networkcloud cluster baremetalmachinekeyset create \
  --name "bareMetalMachineKeySetName" \
  --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 "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 "resourceGroupName"

--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 <Resource Group Name>

引数の削除

    --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 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 "resourceGroupName"

ベアメタル マシン キーセットの更新

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 <Resource Group>

引数の更新

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

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 "resourceGroupName"

ベアメタル マシン キーセットの一覧表示

baremetalmachinekeyset list コマンドを使用すると、クラスターの既存のキーセット グループを確認できます。

コマンド構文は次のとおりです。

az networkcloud cluster baremetalmachinekeyset list \
  --cluster-name <Cluster Name> \
  --resource-group <Resource Group>

リストの一覧表示

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

ベアメタル マシン キーセットの詳細の表示

baremetalmachinekeyset show コマンドを使用すると、クラスターの既存のキーセット グループの詳細を確認できます。

コマンド構文は次のとおりです。

az networkcloud cluster baremetalmachinekeyset show \
  --cluster-name <Cluster Name> \
  --resource-group <Resource Group>

引数の表示

  --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 resource group. You can
                                                           configure the default group using `az
                                                           configure --defaults group=<name>`.