管理 Microsoft Azure 套件中的加密資料

 

適用于:Windows Azure Pack

Windows適用于 Windows Server 的 Azure Pack 會使用加密演算法、加密金鑰和密碼來保護管理入口網站中資料庫與使用者之間的通訊。 這項資料儲存在兩個或三個位置。

為了保護資料的安全性,您需要定期變更或輪替資料。 當您變更一個位置的資料時,也必須變更其他所有位置的相同資料。

我們提供一個試算表,其中列出所有加密演算法、金鑰、密碼及其儲存位置。 這個試算表也包含有關如何變更每個資料點的資訊。 您可以在Windows Azure Pack 技術檔套件中存取試算表, (https://go.microsoft.com/fwlink/?LinkId=329811 可從 Microsoft 下載中心取得) 。 按一下 [下載],選取 WAPv1_encryption.xsl 檔案,然後按一下 [ 下一步 ] 開始下載檔案。

您也可以使用適用于 Windows Azure Pack 的最佳做法分析器來驗證資料的安全性。 如需最佳做法分析器的相關資訊,請參閱掃描 azure Pack Windows元件

請使用下列資訊來管理您的加密資料:

  • 變更資料庫密碼

  • 輪替與電腦金鑰相關的加密資料

  • 輪替加密演算法和金鑰

  • 變更使用量管理 API 密碼

  • 變更與資源提供者相關的密碼

  • 變更與 Service Reporting 相關的密碼

變更資料庫密碼

Windows Azure Pack 中有數個資料庫,每個資料庫都有資料庫密碼。 請使用下列步驟來輪替資料庫密碼:

輪替資料庫密碼

  1. 取得新密碼。 執行下列 Cmdlet:

    $password = New-MgmtSvcPassword –Length 64
    
  2. 使用試算表中的資料來尋找並輪替第一個位置的資料庫密碼。 例如,如果您要輪替管理 API 的資料庫密碼,第一個位置是密碼組態存放區 (請參閱欄 C 的位置 1)。

    執行下列 Cmdlet 來變更密碼:

    Set-MgmtSvcDatabaseSetting <Service>  <Secret>  $password -Server <Server> -Passphrase <Passphrase> -Database “Microsoft.MgmtSvc.Config” -Force
    
  3. 接下來,尋找第三個位置的資料庫密碼,然後輪替該資料庫密碼。 使用上述範例,對於管理 API 資料庫密碼而言,這是 SQL Server 安全性登入 (請參閱欄 G 的位置 3)。

    執行下列 Cmdlet:

    Set-MgmtSvcDatabaseUser -Server <Server> -Database <Database> -Schema <Schema> -User <User> -UserPassword $password
    
  4. 最後,尋找第二個位置的資料庫密碼,然後輪替該密碼。 同樣地,對於管理 API 資料庫密碼而言,這是 web.config 連接字串 (請參閱欄 E 的位置 2)。

    執行下列 Cmdlet:

    $setting = Get-MgmtSvcDatabaseSetting <Service> <Secret> -Server <Server> -Passphrase <Passphrase>
    $connectionString = Get-MgmtSvcSetting $namespace <ConnectionString>
    $builder = New-Object System.Data.SqlClient.SqlConnectionStringBuilder($connectionString.Value)
    $builder.Password = $setting.Value
    Set-MgmtSvcSetting <Service> <ConnectionString> $builder.ConnectionString
    

管理 API、系統管理員的管理入口網站 (AdminSite)、驗證網站 (AuthSite)、租用戶的管理入口網站 (TenantSite),以及 Windows 驗證網站 (WindowsAuthSite) 之解密和驗證設定和金鑰都是使用電腦金鑰來儲存。 請使用下列步驟來輪替這項資料。

  1. 取得新的電腦金鑰。 下列範例會為管理 API 服務的 machineKey.decrytpion 取得新的電腦金鑰。 您可以使用下列步驟來變更電腦金鑰的其他值。

    執行下列 Cmdlet 取得新的電腦金鑰:

    $machineKey = New-MgmtSvcMachineKey
    $decryption = $machineKey.Attribute('decryption').Value
    
  2. 使用試算表中的資料來尋找 machineKey.decryption 的第一個位置。 對於 管理員 API 服務,這是秘密設定Microsoft Store。

    執行下列 Cmdlet 來變更 machineKey.decryption 設定:

    Set-MgmtSvcDatabaseSetting <Service> "machineKey.decryption" $decryption -Server <Server> -Passphrase <Passphrase> -Force
    
  3. 找出 machineKey.decryption 的第二個位置。 針對 管理員 API 服務,這是 web.config machineKey 區段。

    執行下列 Cmdlet 來變更 machineKey.decryption 設定:

    $decryption = Get-MgmtSvcDatabaseSetting <Service> “machineKey.decryption” –Server <Server> -Passphrase <Passphrase>
    Set-MgmtSvcSetting <Service> "machineKey.decryption" $decryption.Value
    

輪替加密演算法和金鑰

請使用下列步驟來輪替加密演算法和加密金鑰。

輪替加密演算法和加密金鑰

  1. 取得新的電腦金鑰。 下列範例會為通知加密演算法取得新的電腦金鑰,並為管理網站取得金鑰。 您可以使用下列步驟來變更其他加密演算法和金鑰。

    注意

    加密和解密使用相同的金鑰。 這些金鑰可視為加密金鑰或解密金鑰,端視執行的作業而定。 因此,我們使用下方 的解密 值,雖然您輪替的金鑰是 加密金鑰

    執行下列 Cmdlet 取得新的電腦金鑰:

    $machineKey = New-MgmtSvcMachineKey
    $encryption = $machineKey.Attribute('decryption').Value
    $encryptionKey = $machineKey.Attribute('decryptionKey').Value
    
  2. 使用試算表中的資料來尋找第一個位置的加密演算法或金鑰。 對於管理網站的通知加密演算法和金鑰而言,這是密碼組態存放區。

    執行下列 Cmdlet 來變更加密演算法和金鑰:

    Set-MgmtSvcDatabaseSetting <Service> "NotificationEncryptionAlgorithm " $encryption -Server <Server> -Passphrase <Passphrase> -Force
    Set-MgmtSvcDatabaseSetting <Service> "EncryptionKey " $encryptionKey -Server <Server> -Passphrase <Passphrase> -Force
    
  3. 尋找第二個位置的加密演算法或金鑰。 對於管理網站的通知加密演算法和金鑰而言,這是 web.config 應用程式設定區段。

    執行下列 Cmdlet 來變更加密演算法和金鑰:

    $encryption = Get-MgmtSvcDatabaseSetting <Service> “NotificationEncryptionAlgorithm” –Server <Server> -Passphrase <Passphrase>
    Set-MgmtSvcSetting <Service> "NotificationEncryptionAlgorithm" $encryption.Value
    $encryptionKey = Get-MgmtSvcDatabaseSetting <Service> “EncryptionKey” –Server <Server> -Passphrase <Passphrase>
    Set-MgmtSvcSetting <Service> "EncryptionKey" $encryptionKey.Value
    

變更使用量管理 API 密碼

不同於資源提供者所使用的密碼 (下一節將進行說明),使用量管理 API 的密碼會儲存在密碼組態存放區和 web.config 應用程式設定區段中。 請使用下列步驟來變更使用量管理 API 密碼:

輪替使用量管理 API 密碼

  1. 取得新密碼。 執行下列 Cmdlet:

    $password = New-MgmtSvcPassword
    
  2. 變更第一個位置 (密碼組態存放區) 的密碼。 執行下列 Cmdlet:

    Set-MgmtSvcDatabaseSetting <Service>  <Secret>  $password -Server <Server> -Passphrase <Passphrase> -Force
    
  3. 變更第二個位置 (web.config 應用程式設定區段) 的密碼。 執行下列 Cmdlet:

    $setting = Get-MgmtSvcDatabaseSetting <Service> <Secret> -Server <Server> -Passphrase <Passphrase>
    Set-MgmtSvcSetting <Service> <Secret> $setting.Value
    

請使用下列資訊來輪替監視、MySQL、SQL Server 和使用量資源提供者的密碼。

輪替資源提供者密碼

  1. 取得資源提供者的新密碼。 執行下列 Cmdlet:

    $password = New-MgmtSvcPassword
    
  2. 變更第一個位置的密碼。 執行下列 Cmdlet:

    Set-MgmtSvcDatabaseSetting <Service> “Password” $pw -Server <Server> -Passphrase <Passphrase> -Force
    
  3. 變更第三個位置的密碼。

    注意

    監視服務的密碼稱為 "MonitoringRestBasicAuthKnownPassword"。 其他資源提供者的密碼稱為 "Password"。

    執行下列 Cmdlet:

    Set-MgmtSvcSetting <Service>  “Password” $pw -Encode
    
  4. 變更第二個位置的密碼。

    注意

    下列 Cmdlet 會變更所有四個端點的密碼,但並非所有資源提供者都有這四個端點。 查看 $rp 的結果以識別每個資源提供者的端點,然後適當地調整 AuthenticationPassword 值。

    執行下列 Cmdlet:

    $rp = Get-MgmtSvcResourceProviderConfiguration <Resource Provider Name> -DecryptPassword
    $rp.AdminEndpoint.AuthenticationPassword = $pw
    $rp.TenantEndpoint.AuthenticationPassword = $pw
    $rp.UsageEndpoint.AuthenticationPassword = $pw
    $rp.NotificationEndpoint.AuthenticationPassword = $pw
    Add-MgmtSvcResourceProviderConfiguration $rp -Force
    

如果您使用 Service Reporting 搭配 Windows Azure Pack,則當您變更使用量服務的密碼時,必須在 Service Reporting 的 SQL VM 中更新密碼。

請使用下列步驟來重設密碼。

變更 Service Reporting 的 SQL VM 密碼

  1. 在已安裝 SQL 資料庫並支援 Service Reporting 的 VM 上,確保 Service Reporting SQL 代理程式工作並未執行。 請使用下列步驟來檢視工作的狀態:

    1. 連線至 < prefix-DW-SQL > \CPSDW 資料庫實例。

    2. 在物件總管中,展開[SQL Server Agent]。

    3. 按一下 [作業] 。

    4. 在 [檢視]索引標籤上,按一下[物件總管詳細資料]。

      檢查 [ 狀態 ] 資料行,以查看代理程式作業是否正在執行。

  2. Service Reporting 包含可供您執行以變更密碼的指令碼。 請從 PowerShell 命令提示字元執行下列 Cmdlet,以執行這個指令碼。

    \\<Service reporting host>\ServiceReporting\Maintenance\PostDeploymentConfig.ps1 -User UsageClient –Password $newPassword