Azure Stack HCI バージョン 23H2 でシークレットをローテーションする

適用対象: Azure Stack HCI バージョン 23H2

この記事では、Azure Stack HCI のデプロイ ユーザーに関連付けられているパスワードを変更する方法について説明します。

デプロイ ユーザーのパスワードを変更する

PowerShell コマンドレット Set-AzureStackLCMUserPassword を使用して、ドメイン管理者の資格情報シークレットAzureStackLCMUserCredential ローテーションします。 このコマンドレットは、サーバー ホストに接続するユーザーのパスワードを変更します。

Note

Set-AzureStackLCMUserPasswordを実行すると、コマンドレットは Active Directory で以前に変更されたもののみを更新します。

PowerShell コマンドレットとプロパティ

Set-AzureStackLCMUserPassword コマンドレットは、次のパラメーターを受け取ります。

パラメーター 説明
Identity パスワードを変更するユーザーのユーザー名。
OldPassword ユーザーの現在のパスワード。
NewPassword ユーザーの新しいパスワード。
UpdateAD Active Directory で新しいパスワードを設定するために使用する省略可能なパラメーター。

Set-AzureStackLCMUserPassword コマンドレットを実行する

パラメーターを設定し、 Set-AzureStackLCMUserPassword コマンドレットを実行してパスワードを変更します。

$old_pass = convertto-securestring "<Old password>" -asplaintext -force
$new_pass = convertto-securestring "<New password>" -asplaintext -force

Set-AzureStackLCMUserPassword -Identity mgmt -OldPassword $old_pass -NewPassword $new_pass -UpdateAD 

パスワードが変更されると、セッションは終了します。 その後、更新されたパスワードでサインインする必要があります。

Set-AzureStackLCMUserPasswordを使用する場合の出力例を次に示します。

PS C:\Users\MGMT> $old_pass = convertto-securestring "Passwordl23!" -asplaintext -force 
PS C:\Users\MGMT> $new_pass = convertto-securestring "Passwordl23!1" -asplaintext -force
PS C:\Users\MGMT> Set-AzureStackLCMUserPassword -Identity mgmt -OldPassword $old_pass -NewPassword $new_pass -UpdateAD 
WARNING: !WARNING!
The current session will be unresponsive once this command completes. You will have to login again with updated credentials. Do you want to continue?
Updating password in AD.
WARNING: Please close this session and log in again.
PS C:\Users\MGMT> 

デプロイ サービス プリンシパルの変更

このセクションでは、デプロイに使用するサービス プリンシパルを変更する方法について説明します。

Note

このシナリオは、Azure Stack HCI 2306 ソフトウェアを Azure Stack HCI バージョン 23H2 にアップグレードした場合にのみ適用されます。

デプロイ サービス プリンシパルを変更するには、次の手順に従います。

  1. Microsoft Entra ID にサインオンします。

  2. Azure Stack HCI クラスターのデプロイ時に使用したサービス プリンシパルを見つけます。 サービス プリンシパルの新しいクライアント シークレットを作成します。

  3. 既存のサービス プリンシパルと新しい<client secret>appIDをメモしておきます。

  4. デプロイ ユーザーの資格情報を使用して、いずれかの Azure Stack HCI サーバー ノードにサインオンします。

  5. Azureにログインします。 次の PowerShell コマンドを実行します。

    Connect-AzAccount
    
  6. サブスクリプションのコンテキストを設定します。 次の PowerShell コマンドを実行します。

    Set-AzContext -Subscription <Subscription ID>
    
  7. サービス プリンシパル名を更新します。 次の PowerShell コマンドを実行します。

    cd "C:\Program Files\WindowsPowerShell\Modules\Microsoft.AS.ArcIntegration"
    Import-Module Microsoft.AS.ArcIntegration.psm1 -Force
    $secretText=ConvertTo-SecureString -String <client secret> -AsPlainText -Force
    Update-ServicePrincipalName -AppId <appID> -SecureSecretText $secretText
    

次のステップ