Azure数据工厂无法在Blob存储链接服务中参数化Key Vault secretName

时间:2020-08-27 06:26:39

标签: azure azure-data-factory azure-keyvault azure-blob-storage

我正在尝试创建某种AzureBlobStorage链接服务,该服务将通过动态提供的accountKey从Key Vault检索secretName。我正在尝试遵循this guide。 所以为此,我准备了这个json:

{
    "name": "AzureBlobStorageLinkedServiceWithDynamicStorageAccountKeysFromKeyVault",
    "type": "Microsoft.DataFactory/factories/linkedservices",
    "properties": {
        "type": "AzureBlobStorage",
        "typeProperties": {
            "connectionString": "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=@{linkedService().storageAccountName}",
            "accountKey": {
              "type": "AzureKeyVaultSecret",
              "store": {
                  "referenceName": "AzureKeyVaultWithStorageAccountsSecrets",
                  "type": "LinkedServiceReference"
              },
              "secretName": {
                "type": "Expression",
                "value": "@{linkedService().storageAccountName}"
              }
            }
          
        },
        "parameters": {
            "storageAccountName": {
                "type": "String",
                "defaultValue": "fixmeaccountname"
            }
        },
        "annotations": []
    }
}

当我尝试测试时,我得到了错误

Invalid storage connection string provided to 'UnknownLocation'. Check the storage connection string in configuration. Duplicate setting 'AccountName' found.

如果我从AccountName=@{linkedService().storageAccountName}中删除了connectionString,则出现此错误

Invalid storage connection string provided to 'UnknownLocation'. Check the storage connection string in configuration. Duplicate setting 'AccountKey' found.

是否可以通过参数化的密钥库获得这种链接服务?

1 个答案:

答案 0 :(得分:0)

KV上的秘密是连接字符串还是仅仅是密钥?我认为您将连接字符串存储为秘密,请尝试仅使用密钥,它应该可以工作。