New-SqlAzureKeyVaultColumnMasterKeySettings

建立 SqlColumnMasterKeySettings 物件,描述儲存在 Azure 金鑰保存庫中的非對稱金鑰。

Syntax

New-SqlAzureKeyVaultColumnMasterKeySettings
   [-KeyUrl] <String>
   [[-Signature] <String>]
   [-KeyVaultAccessToken <String>]
   [-ManagedHsmAccessToken <String>]
   [-AllowEnclaveComputations]
   [<CommonParameters>]

Description

建立 SqlColumnMasterKeySettings 物件,描述儲存在金鑰保存庫中的資料行主要金鑰,或在 Azure 金鑰保存庫的受控 HSM 中。

如果您使用 Cmdlet 來簽署金鑰中繼資料,您必須為金鑰保存庫或受控 HSM 指定有效的驗證權杖。 或者,您可以在呼叫此 Cmdlet 之前,先使用 Add-SqlAzureAuthenticationContext 向 Azure 進行驗證。

Module requirements: version 21+ on PowerShell 5.1; version 22+ on PowerShell 7.x.

範例

範例 1:建立簡單的 SqlColumnMasterKeySettings 物件

$CMKSettings = New-SqlAzureKeyVaultColumnMasterKeySettings -KeyUrl 'https://myvault.vault.contoso.net/keys/CMK/4c05f1a41b12488f9cba2ea964b6a700'

此命令會建立SqlColumnMasterKeySettings物件,該物件會參考 Azure 金鑰保存庫中的金鑰,並將結果儲存在名為$CMKSettings 的變數中

範例 2:建立具有自動簽署屬性的 SqlColumnMasterKeySettings,允許記憶體保護區計算

# Obtain an access token for key vaults.
$keyVaultAccessToken = (Get-AzAccessToken -ResourceUrl https://vault.azure.net).Token

# Pass the token to the cmdlet. It will use the token to communicate with the key vault containing the column master key to sign the column master key metadata properties.
$cmkSettings = New-SqlAzureKeyVaultColumnMasterKeySettings -KeyUrl 'https://myvault.vault.azure.net/keys/CMK/4c05f1a41b12488f9cba2ea964b6a700' -AllowEnclaveComputations -keyVaultAccessToken $keyVaultAccessToken

此命令會建立 SqlColumnMasterKeySettings 物件,該物件會參考金鑰保存庫中的金鑰,並將結果儲存在名為 $cmkSettings 的變數中。 索引鍵允許記憶體保護區計算。 由於未指定簽章參數,所以 Cmdlet 會自動計算簽章,並填入 SqlColumnMasterKeySettings 物件的 Signature 屬性。

此範例說明在 Azure 金鑰保存庫中取得金鑰保存庫的驗證權杖,並將它傳遞至 Cmdlet。

範例 3:建立允許記憶體保護區計算的 SqlColumnMasterKeySettings 物件

# Note: actual signature truncated for brevity
$signature = "0x19BEB4F27F582F...89D5433CE9266C6F867334654BE12"
$cmkSettings = New-SqlAzureKeyVaultColumnMasterKeySettings -KeyUrl 'https://myvault.vault.contoso.net/keys/CMK/4c05f1a41b12488f9cba2ea964b6a700' -AllowEnclaveComputations -Signature $signature

此命令會建立 SqlColumnMasterKeySettings 物件,該物件會參考金鑰保存庫中的金鑰,並將結果儲存在名為 $cmkSettings 的變數中。 索引鍵允許記憶體保護區計算。 Key 屬性的簽 章是在 Signature 參數中指定。

參數

-AllowEnclaveComputations

指定資料行主要金鑰是否允許記憶體保護區計算。 如果指定參數,則允許伺服器端安全記憶體保護區對使用資料行主要金鑰保護的資料執行計算。 不適用於 SQL Server 2017 和舊版本。

Type:SwitchParameter
Position:1
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-KeyUrl

將 Azure 金鑰保存庫 或受控 HSM 中的金鑰連結指定為 URL。

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-KeyVaultAccessToken

指定 Azure 金鑰保存庫中金鑰保存庫的存取權杖。 如果指定的資料行主要金鑰儲存在 Azure 金鑰保存庫中的金鑰保存庫中,而且 Cmdlet 預期會簽署金鑰中繼資料,請使用此參數。

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ManagedHsmAccessToken

指定 Azure 金鑰保存庫中受控 HSM 的存取權杖。 如果指定的資料行主要金鑰儲存在 Azure 金鑰保存庫的受控 HSM 中,而且 Cmdlet 預期會簽署金鑰中繼資料,請使用此參數。

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Signature

指定十六進位字串,這是資料行主要金鑰屬性的數位簽章。 用戶端驅動程式可以驗證簽章,以確保資料行主要金鑰屬性尚未遭到竄改。

只有在指定 AllowEnclaveComputations 時,才允許此參數。 如果指定 AllowEnclaveComputations ,但 未指定 Signature ,Cmdlet 會自動計算簽章,並填入新 SqlColumnMasterKeySettings 物件的 Signature 屬性。

Type:String
Position:2
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

輸出

SqlColumnMasterKeySettings