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

注意事項

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

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

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

注意事項

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

  • キーセットの作成/更新プロセスでは、クラスター内の各マシンの IP テーブルにジャンプ ホストの IP アドレスが追加されます。 IP テーブルの更新により、これらのジャンプ ホストからのみ SSH アクセスが許可されるように制限されます。
  • ジャンプ ホストのクラスター向け IP アドレスを指定することが重要です。 これらの IP アドレスは、ジャンプ ホストにアクセスするために使われるパブリック IP アドレスとは異なる場合があります。
  • 少なくとも 1 つのキーセットが定義されている場合、任意のキーセット内の任意のジャンプ ホストから ssh アクセスが許可されます。 たとえば、キーセット A がジャンプ ホスト A を指定し、キーセット B がジャンプ ホスト B を指定している場合、いずれかのキーセット内のユーザーはジャンプ ホスト A または B を使用できます。
  • キーセットは定義されていない場合、マシンへのネットワーク接続を持つジャンプ ホストからの ssh アクセスが許可されます。

前提条件

  • 適切な 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 "<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. 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".
  --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.

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

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. The maximum
                                                           expiration date is a year from creation
                                                           date. 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 " グループに新しいユーザーを 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 "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>`.