azure - Azure 数据工厂:使用 Azure Key Vault 参考获取链接服务中的用户名,这可能吗?
问题描述
我知道您可以在 ADF 中创建一个 Azure Key Vault 链接服务,然后可以在其他链接服务中使用它来获取密码密钥/连接字符串密钥。 这是从 Keyvault 密钥中检索 FILE SYSTEM 链接服务的密码时 JSON 的样子(请参阅 ADF UI 片段的屏幕截图):
{
"name": "FILESERVER_blah",
"properties": {
"annotations": [],
"type": "FileServer",
"typeProperties": {
"host": "\\\\ServerName\\ShareName",
"userId": "ThisIsMyUserName@blah.com",
"password": {
"type": "AzureKeyVaultSecret",
"store": {
"referenceName": "KEYVAULT_maddisandbox",
"type": "LinkedServiceReference"
},
"secretName": "MySecretName"
}
},
"connectVia": {
"referenceName": "shir-madie-sandbox",
"type": "IntegrationRuntimeReference"
}
}}
有了这个逻辑,我想我可以在 KeyVault 中创建一个 UserName 机密并以相同的方式引用它。所以我将链接服务 Json 更新为以下内容:
{
"name": "FILESERVER_akv_dynamic",
"properties": {
"type": "FileServer",
"annotations": [],
"parameters": {
"UserSecretName": {
"type": "string",
"defaultValue": ""
},
"PasswordSecretName": {
"type": "string",
"defaultValue": ""
},
"Host": {
"type": "string",
"defaultValue": ""
}
},
"typeProperties": {
"host": "@linkedService().Host",
"userId": {
"type": "AzureKeyVaultSecret",
"store": {
"referenceName": "KEYVAULT_maddisandbox",
"type": "LinkedServiceReference"
},
"secretName": "@linkedService().UserSecretName"
},
"password": {
"type": "AzureKeyVaultSecret",
"store": {
"referenceName": "KEYVAULT_maddisandbox",
"type": "LinkedServiceReference"
},
"secretName": "@linkedService().PasswordSecretName"
}
},
"connectVia": {
"referenceName": "shir-madie-sandbox",
"type": "IntegrationRuntimeReference"
}
}}
当我这样做并尝试运行测试连接时,它会返回此错误:
Failed to convert the value in 'userid' property to 'System.String' type. Please make sure the payload structure and value are correct.
我知道我可以使用 KeyVault REST API 来获取 Secret 值并将其传递给我的活动/数据集/链接服务,但我更愿意使用本机功能并通过直接在链接服务 Json 中引用来节省一步,特别是因为我在我的工厂设置了 KeyVault 链接服务。
如果可能的话,有人可以解释如何使这项工作吗?如果不可能,为什么不可能?密码机密的处理方式与我尝试检索的用户名机密有何不同?
谢谢
解决方案
目前设计上只有秘密或连接字符串(对于在 SQL Server、Blob 存储等链接服务中使用连接字符串的连接器,您可以选择仅在 AKV 中存储秘密字段,例如密码,或存储AKV 中的整个连接字符串。您可以在 UI 上找到这两个选项。)允许通过 ADF 链接服务从 AKV 检索。
因此,无法通过 ADF 链接服务从 AKV 检索用户名。这是一个设计限制。
相关 MS 文档:在 Azure Key Vault 中存储凭据
但如果您对此有任何具体反馈,请随时在 ADF 用户语音论坛中分享您的建议/想法:https ://feedback.azure.com/forums/270578-azure-data-factory 。
推荐阅读
- apache-flink - 官方文档中“元组数据集投影”的正确示例是什么?
- python - 在 6.5G csv 数据帧上运行 df.shape 会引发错误
- github-actions - 对 Github 操作运行端到端测试
- python - 如何在处理 HTTP 请求时使用 GetOldTweets3 获取给定主题的所有推文:HTTP 错误 429:请求过多
- flutter - 如何防止复选框在 Flutter 中过早调用 onChange?
- xml - 如何在 xslt 定义中转义大括号
- python - 如何从网站上抓取没有类或 id 的元素
- tfs - 我无法在集合或项目级别向任何 TFS 2018 安全组添加新成员
- apache-spark - 使用 pyspark 直接从 hdfs 加载带有 pandas 的大数据
- apache-kafka - 聚合和存储来自多个来源的数据