在Azure数据工厂中检索Web活动中的关键文件库

时间:2020-06-29 13:01:06

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

我是Azure Data Factory的新手,现在我被困在最后一步以完成当前任务。

我几乎不需要使用Web Activity从ADF调用的REST API,但是在进行REST API POST调用之前,在此POST调用中,我需要传递要从密钥库中获取并传递到BODY部分的用户凭据。发出此POST请求后,我需要从该服务器获取身份验证令牌,因此它以硬编码方式工作。 但是现在我想从Azure Key Vault中获取userId和密码,然后将其传递给Web Activity。

注意:我不想使用MSI选项。

请帮助您从用于Web活动的Azure Key Vault检索userId和密码以将其作为身份验证的一部分传递吗?

1 个答案:

答案 0 :(得分:1)

您可以按照以下步骤来实现所需的目标:

  1. 将用户名和密码保存在天蓝色的密钥库中。然后授予您的蔚蓝数据工厂访问密钥库的权限:

我认为您知道如何添加密钥库值,所以我仅说明如何授予访问权限。 enter image description here

enter image description here

enter image description here

然后选择“添加”。而且不要忘记保存修改。

  1. 第二步是关于ADF中的网络活动。您应该先创建一个网络活动。

enter image description here

enter image description here

enter image description here

然后,您可以使用Set变量活动获取值。

enter image description here

活动的值为@activity('yourwebactivityname').output.value

这是我的管道:

enter image description here

我可以得到值:

enter image description here

有关更多信息,请查看以下文档:

https://docs.microsoft.com/en-us/azure/data-factory/how-to-use-azure-key-vault-secrets-pipeline-activities