在 Azure Local 中轮换机密

适用于:Azure Local 2311.2 及更高版本

本文介绍如何更改与 Azure 本地部署用户关联的密码。

更改部署用户密码

使用 PowerShell cmdlet Set-AzureStackLCMUserPassword 轮换AzureStackLCMUserCredential 域管理员凭据机密。 此 cmdlet 更改连接到服务器主机的用户的密码。

注意

运行 Set-AzureStackLCMUserPassword时,该 cmdlet 仅更新以前在 Active Directory 中更改的内容。

PowerShell cmdlet 和属性

Set-AzureStackLCMUserPassword cmdlet 采用以下参数:

参数 说明
Identity 要更改其密码的用户的用户名。
OldPassword 用户的当前密码。
NewPassword 用户的新密码。
UpdateAD 用于在 Active Directory 中设置新密码的可选参数。

运行 Set-AzureStackLCMUserPassword cmdlet

设置参数,然后运行 Set-AzureStackLCMUserPassword cmdlet 以更改密码:

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

更改群集见证存储帐户密钥

本部分介绍如何更改群集见证存储帐户的存储帐户密钥。

  1. 使用部署用户凭据登录到其中一个 Azure 本地节点。

  2. 使用辅助存储帐户密钥来配置见证仲裁:

    Set-ClusterQuorum -CloudWitness -AccountName <storage account name> -AccessKey <storage account secondary key>
    
  3. 轮换存储帐户主密钥。

  4. 使用轮换的存储帐户密钥来配置见证仲裁:

    Set-ClusterQuorum -CloudWitness -AccountName <storage account name> -AccessKey <storage account primary key>
    
  5. 轮换存储帐户辅助密钥。

  6. 更新 ECE 存储中的存储帐户主密钥:

    $SecureSecretText = ConvertTo-SecureString -String "<Replace Storage account key>" -AsPlainText -Force
    $WitnessCred = New-Object -Type PSCredential -ArgumentList "WitnessCredential,$SecureSecretText"
    Set-ECEServiceSecret -ContainerName WitnessCredential -Credential $WitnessCred
    

撤销用于 Azure 本地 VM 映像的存储帐户的 SAS 令牌

本节介绍如何撤销在 Azure Arc 启用的本地虚拟机中用于映像的存储帐户的共享访问签名(SAS)令牌。

SAS 策略 SAS 已过期? 撤销的步骤
任何 SAS 是的 无需执行任何操作,因为 SAS 不再有效。
使用帐户密钥签名的临时 SAS 手动轮换或重新生成 用于创建 SAS 的存储帐户密钥。
使用用户委托密钥签名的临时 SAS 若要撤销用户委派密钥或更改角色分配,请参阅 “撤销用户委派 SAS”。
具有存储访问策略的 SAS 若要将过期时间更新为过去的日期或时间,或删除存储的访问策略,请参阅 “修改或撤销存储的访问策略”。

有关详细信息,请参阅 撤销 SAS

更改部署服务主体

本部分介绍如何更改用于部署的服务主体。

注意

此方案仅适用于将 Azure Local 2306 软件升级到 Azure 本地版本 23H2 时。

按照以下步骤更改部署服务主体:

  1. 登录到 Microsoft Entra ID。

  2. 找到部署 Azure 本地实例时使用的服务主体。 为服务主体创建新的客户端密码。

  3. appID 下现有服务主体和新 <client secret>服务主体。

  4. 使用部署用户凭据登录到其中一台 Azure 本地计算机。

  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
    

更改 ARB 服务主体机密

本部分介绍如何更改用于部署期间创建的 Azure 资源网桥的服务主体。

若要更改部署服务主体,请执行以下步骤:

  1. 登录到Microsoft Entra ID。

  2. 找到 Azure 资源网桥的服务主体。 服务主体的名称采用 ClusternameXX.arb 格式。

  3. 为服务主体创建新的客户端密码。

  4. appID 下现有服务主体和新 <client secret>服务主体。

  5. 使用部署用户凭据登录到其中一台 Azure 本地计算机。

  6. 运行以下 PowerShell 命令:

    $SubscriptionId= "<Subscription ID>" 
    $TenantId= "<Tenant ID>"
    $AppId = "<Application ID>" 
    $secretText= "<Client secret>" 
    $NewPassword = ConvertTo-SecureString -String $secretText -AsPlainText -Force 
    Set-AzureStackRPSpCredential -SubscriptionID $SubscriptionId -TenantID $TenantId -AppId $AppId -NewPassword $NewPassword 
    

轮换内部机密

本部分介绍如何轮换内部保密信息。 内部机密包括证书、密码、安全字符串和 Azure 本地基础结构使用的密钥。 仅当你怀疑某个机密已泄露或收到机密过期的警报时,才需要轮换内部机密。

机密轮换的具体步骤因 Azure 本地实例正在运行的软件版本而异。

运行 2411.2 及更高版本的 Azure 本地实例

  1. 使用部署用户凭据登录到其中一个 Azure 本地节点。

  2. 启动密钥轮换。 运行以下 PowerShell 命令:

    Start-SecretRotation
    

运行 2411.1 到 2411.0 的 Azure 本地实例

  1. 使用部署用户凭据登录到其中一个 Azure 本地节点。

  2. 更新 ECE 存储中的 CA 证书密码。 运行以下 PowerShell 命令:

    $SecureSecretText = ConvertTo-SecureString -String "<Replace with a strong password>" -AsPlainText -Force
    $CACertCred = New-Object -Type PSCredential -ArgumentList "CACertUser,$SecureSecretText"
    Set-ECEServiceSecret -ContainerName CACertificateCred -Credential $CACertCred
    
  3. 启动密钥轮换。 运行以下 PowerShell 命令:

    Start-SecretRotation
    

运行 2408.2 或更早版本的 Azure 本地实例

  1. 使用部署用户凭据登录到其中一个 Azure 本地节点。

  2. 更新 ECE 存储中的 CA 证书密码。 运行以下 PowerShell 命令:

    $SecureSecretText = ConvertTo-SecureString -String "<Replace with a strong password>" -AsPlainText -Force
    $CACertCred = New-Object -Type PSCredential -ArgumentList (CACertificateCred),$SecureSecretText
    Set-ECEServiceSecret -ContainerName CACertificateCred -Credential $CACertCred
    
  3. 从所有群集节点中删除 FCA 证书并重启 FCA 服务。 在 Azure 本地实例的每个节点上运行以下命令:

    $cert = Get-ChildItem -Recurse cert:\LocalMachine\My | Where-Object { $_.Subject -like "CN=FileCopyAgentKeyIdentifier*" } 
    $cert | Remove-Item 
    restart-service "AzureStack File Copy Agent*"
    
  4. 启动密钥轮换。 运行以下 PowerShell 命令:

    Start-SecretRotation
    

后续步骤

完成先决条件和清单并安装 Azure 本地