Azure 数据工厂:使用 Azure Key Vault Reference 在链接服务中获取用户名,这可能吗?
Azure Data Factory: Get UserName in Linked Service using Azure Key Vault Reference, is it possible?
我知道您可以在 ADF 中创建一个 Azure Key Vault 链接服务,然后可以在其他链接服务中使用它来获取密码 Secret/Connection 字符串机密。
这就是当您从文件系统链接服务的 Keyvault 秘密检索密码时 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 值并将其传递给我的 Activities/Datasets/Linked 服务,但我更愿意使用本机功能并通过引用节省一步直接在链接服务中 Json,特别是因为我在工厂中设置了 KeyVault 链接服务。
如果可能,谁能解释一下如何进行这项工作?如果不可能,为什么不可能?密码机密的处理方式与我尝试检索的用户名机密的处理方式有何不同?
谢谢
目前的设计是只有机密或连接字符串(对于在链接服务中使用连接字符串的连接器,如 SQL 服务器、Blob 存储等,您可以选择仅存储秘密字段,例如 AKV 中的密码,或将整个连接字符串存储在 AKV 中。您可以在 UI. 上找到这两个选项)允许通过 ADF 链接服务从 AKV 检索.
因此,无法通过 ADF 链接服务从 AKV 检索用户名。这是一个设计限制。
相关 MS 文档:Store credential in Azure Key Vault
但如果您对此有任何具体反馈,请随时在 ADF 用户语音论坛中分享您的 suggestion/idea:https://feedback.azure.com/forums/270578-azure-data-factory.
我知道您可以在 ADF 中创建一个 Azure Key Vault 链接服务,然后可以在其他链接服务中使用它来获取密码 Secret/Connection 字符串机密。
{
"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 值并将其传递给我的 Activities/Datasets/Linked 服务,但我更愿意使用本机功能并通过引用节省一步直接在链接服务中 Json,特别是因为我在工厂中设置了 KeyVault 链接服务。
如果可能,谁能解释一下如何进行这项工作?如果不可能,为什么不可能?密码机密的处理方式与我尝试检索的用户名机密的处理方式有何不同?
谢谢
目前的设计是只有机密或连接字符串(对于在链接服务中使用连接字符串的连接器,如 SQL 服务器、Blob 存储等,您可以选择仅存储秘密字段,例如 AKV 中的密码,或将整个连接字符串存储在 AKV 中。您可以在 UI. 上找到这两个选项)允许通过 ADF 链接服务从 AKV 检索.
因此,无法通过 ADF 链接服务从 AKV 检索用户名。这是一个设计限制。
相关 MS 文档:Store credential in Azure Key Vault
但如果您对此有任何具体反馈,请随时在 ADF 用户语音论坛中分享您的 suggestion/idea:https://feedback.azure.com/forums/270578-azure-data-factory.