在 Azure Key Vault 中儲存認證

適用於:Azure Data Factory Azure Synapse Analytics

提示

試用 Microsoft Fabric 中的 Data Factory,這是適用於企業的全方位分析解決方案。 Microsoft Fabric 涵蓋從資料移動到資料科學、即時分析、商業智慧和報告的所有項目。 了解如何免費開始新的試用

您可以在 Azure Key Vault 中儲存供資料存放區和計算使用的認證。 執行活動 (該活動使用資料存放區/計算) 時,Azure Data Factory 會擷取認證。

目前,自訂活動以外的所有活動類型都支援這項功能。 特別針對連接器設定,查看每個連接器主題中的<連結服務屬性>一節以取得詳細資訊。

必要條件

此功能依賴於資料處理站受控識別。 了解其如何從 Data Factory 的受控識別運作,並確定您的資料處理站有一個相關聯的受控識別。

步驟

若要參考儲存在 Azure Key Vault 中的認證,您需要:

  1. 複製隨著資料處理站一起產生的「受控識別物件識別碼」的值,以擷取資料處理站受控識別。 如果您使用 ADF 編寫 UI,受控識別物件識別碼將會顯示在 Azure Key Vault 連結服務建立視窗上;您也可以從 Azure 入口網站將其擷取,請參閱擷取資料處理站服務識別
  2. 將受控識別存取權授與您的 Azure Key Vault。 在您的金鑰保存庫中 -> 存取原則 -> 新增存取原則,搜尋此受控識別以授與 [秘密許可權] 下拉式清單中的取得清單權限。 這樣可以讓這個指定的處理站存取金鑰保存庫中的密碼。
  3. 建立指向您的 Azure Key Vault 的已連結服務。 請參閱 Azure Key Vault 已連結服務
  4. 建立資料存放區連結服務。 在其設定中,參考儲存在 Azure Key Vault 中的對應秘密。 請參見參考 Azure Key Vault 中儲存的認證

Azure Key Vault 已連結服務

以下是針對 Azure Key Vault 已連結服務支援的屬性:

屬性 描述 必要
type type 屬性必須設為:AzureKeyVault Yes
baseUrl 指定 Azure Key Vault URL。 Yes

使用編寫 UI:

選取 [連線] -> [連結服務] -> [新增]。 在 [新增連結服務] 中,搜尋並選取 [Azure Key Vault]:

Search Azure Key Vault

選取儲存認證的已佈建 Azure Key Vault。 您可以 [測試連線],確保您的 AKV 連線有效。

Configure Azure Key Vault

JSON 範例:

{
    "name": "AzureKeyVaultLinkedService",
    "properties": {
        "type": "AzureKeyVault",
        "typeProperties": {
            "baseUrl": "https://<azureKeyVaultName>.vault.azure.net"
        }
    }
}

參考儲存在金鑰保存庫中的祕密

當您在參考金鑰保存庫密碼的已連結服務中設定欄位時,支援下列屬性:

屬性 描述 必要
type 欄位的 type 屬性必須設定為:AzureKeyVaultSecret Yes
secretName Azure Key Vault 中祕密的名稱。 Yes
secretVersion Azure Key Vault 中祕密的版本。
如果未指定,它會一律使用最新版本的密碼。
如果指定,則它會遵循指定的版本。
No
存放區 代表您用來儲存認證的 Azure Key Vault 已連結服務。 Yes

使用編寫 UI:

在建立資料存放區/計算的連線時,請針對祕密欄位選取 [Azure Key Vault]。 選取已佈建的 Azure Key Vault 連結服務,並提供 [祕密名稱]。 您也可以選擇性地提供祕密版本。

提示

對於在連結服務中使用連接字串的連接器 (例如 SQL Server、Blob 儲存體等),您可以選擇只儲存祕密欄位,例如 AKV 中的密碼,或將整個連接字串儲存在 AKV 中。 您可以在 UI 上找到這兩個選項。

Configure Azure Key Vault secret

JSON 範例:(請參閱「密碼」一節)

{
    "name": "DynamicsLinkedService",
    "properties": {
        "type": "Dynamics",
        "typeProperties": {
            "deploymentType": "<>",
            "organizationName": "<>",
            "authenticationType": "<>",
            "username": "<>",
            "password": {
                "type": "AzureKeyVaultSecret",
                "secretName": "<secret name in AKV>",
                "store":{
                    "referenceName": "<Azure Key Vault linked service>",
                    "type": "LinkedServiceReference"
                }
            }
        }
    }
}

如需 Azure Data Factory 中的複製活動所支援作為來源和接收器的資料存放區清單,請參閱支援的資料存放區