Share via


Gestire l'accesso di emergenza a una macchina bare metal utilizzando il az networkcloud cluster bmckeyset

Attenzione

Si noti che questo processo viene usato in situazioni di emergenza quando tutte le altre opzioni di risoluzione dei problemi tramite Azure sono state esaurite. L'accesso SSH a questi computer bare metal è limitato agli utenti gestiti tramite questo metodo dalla jump host list specificata.

Ci sono rare situazioni in cui un utente deve analizzare e risolvere i problemi con un computer bare metal e tutti gli altri modi in cui l'uso di Azure è stato esaurito. Operator Nexus fornisce il az networkcloud cluster bmckeyset comando in modo che gli utenti possano gestire l'accesso SSH al controller di gestione della lavagna base (BMC) in questi computer bare metal. Durante la creazione del keyset, gli utenti vengono convalidati in base all'ID Microsoft Entra per ottenere un'autorizzazione appropriata facendo riferimento al nome dell'entità utente fornito per un utente rispetto all'ID --azure-group-id <Entra Group ID>gruppo di Azure fornito.

Se il nome dell'entità utente per un utente non è membro del gruppo fornito, lo stato dell'utente è impostato su "Non valido" e il messaggio di stato indica "Non valido perché userPrincipal non è membro del gruppo AAD". Se l'ID gruppo di Azure non è valido, ogni utente nel keyset ha lo stato impostato su "Non valido" e il messaggio di stato indica che il gruppo AAD non esiste. Gli utenti non validi rimangono nel keyset, ma la chiave non verrà abilitata per l'accesso SSH.

Nota

Attualmente è previsto un periodo transitorio in cui specificare i nomi delle entità utente è facoltativo. In una versione futura diventerà obbligatorio e la convalida dell'ID Entra di Microsoft verrà applicata per tutti gli utenti. Gli utenti sono invitati ad aggiungere nomi di entità utente ai propri set di chiavi prima della fine del periodo transitorio (previsto per luglio 2024) per evitare che i set di chiavi vengano invalidati. Si noti che se vengono aggiunti nomi di entità utente a un keyset, anche se non vengono aggiunti per tutti gli utenti, verrà abilitata la convalida dell'ID Entra di Microsoft e ciò comporterà l'invalidazione dell'intero keyset se l'ID gruppo specificato non è valido.

Quando il comando viene eseguito, viene eseguito in ogni computer bare metal nel cluster con un nodo Kubernetes attivo. Esiste un processo di riconciliazione che viene eseguito periodicamente che ritenta il comando su qualsiasi computer bare metal non disponibile al momento del comando originale. Inoltre, qualsiasi computer bare metal che torna al cluster tramite un az networkcloud baremetalmachine actionreimage comando o az networkcloud baremetalmachine actionreplace (vedere Funzioni BareMetal) invia un segnale che causa l'invio di set di chiavi attivi al computer non appena torna al cluster. Più comandi vengono eseguiti nell'ordine ricevuto.

I bare metal supportano un numero massimo di 12 utenti. Gli utenti vengono definiti per ogni cluster e applicati a ogni computer bare metal. I tentativi di aggiungere più di 12 utenti generano un errore. Eliminare un utente prima di aggiungerne un altro quando 12 esiste già.

Prerequisiti

  • Installare la versione più recente delle estensioni dell'interfaccia della riga di comando appropriate.
  • Il cluster locale deve avere connettività ad Azure.
  • Ottenere il nome del gruppo di risorse per la Cluster risorsa.
  • Il processo applica i set di chiavi a tutti i computer bare metal in esecuzione.
  • Gli utenti aggiunti devono far parte di un gruppo Microsoft Entra. Per altre informazioni, vedere Come gestire i gruppi.
  • Per limitare l'accesso per la gestione dei set di chiavi, creare un ruolo personalizzato. Per altre informazioni, vedere Ruoli personalizzati di Azure. In questa istanza aggiungere o escludere autorizzazioni per Microsoft.NetworkCloud/clusters/bmcKeySets. Le opzioni sono /read, /write e /delete.

Nota

Quando l'accesso BMC viene creato, modificato o eliminato tramite i comandi descritti in questo articolo, un processo in background recapita tali modifiche ai computer. Questo processo viene sospeso durante gli aggiornamenti software Operator Nexus. Se è noto che un aggiornamento è in corso, è possibile usare l'opzione --no-wait con il comando per impedire al prompt dei comandi di attendere il completamento del processo.

Creazione di un keyset BMC

Il bmckeyset create comando crea l'accesso SSH al computer bare metal in un cluster per un gruppo di utenti.

La sintassi del comando è:

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>

Creare argomenti

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

Argomenti globali dell'interfaccia della riga di comando di Azure (applicabili a tutti i comandi)

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

In questo esempio viene creato un nuovo keyset con due utenti con accesso standard da due jump host.

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"

Per assistenza nella creazione della struttura, vedere Abbreviato dell'interfaccia della --user-list riga di comando di Azure.

Eliminazione di un keyset BMC

Il bmckeyset delete comando rimuove l'accesso SSH al BMC per un gruppo di utenti. Tutti i membri del gruppo perdono l'accesso SSH a uno qualsiasi dei bare metal nel cluster.

La sintassi del comando è:

az networkcloud cluster bmckeyset delete \
  --name <BMC Keyset Name> \
  --cluster-name <Cluster Name> \
  --resource-group <Resource Group Name> \

Elimina argomenti

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

In questo esempio viene rimosso il gruppo di keyset "bmcKeysetName" nel cluster "clusterName".

az networkcloud cluster bmckeyset delete \
  --name "bmcKeySetName" \
  --cluster-name "clusterName" \
  --resource-group "resourceGroupName" \

Aggiornamento di un keyset BMC

Il bmckeyset update comando consente agli utenti di apportare modifiche a un gruppo di keyset esistente.

La sintassi del comando è:

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>

Aggiornare gli argomenti

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

In questo esempio vengono aggiunti due nuovi utenti al gruppo "bmcKeySetName" e viene modificata l'ora di scadenza per il gruppo.

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"

Elenco di set di chiavi BMC

Il bmckeyset list comando consente agli utenti di visualizzare i gruppi di keyset esistenti in un cluster.

La sintassi del comando è:

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

Argomenti elenco

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

Mostra dettagli keyset BMC

Il bmckeyset show comando consente agli utenti di visualizzare i dettagli di un gruppo di keyset esistente in un cluster.

La sintassi del comando è:

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

Mostra argomenti

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