【问题标题】:Is it possible to read a parameter at runtime from inside Azure Function Linked Service in Data Factory?是否可以在运行时从数据工厂中的 Azure 函数链接服务中读取参数?
【发布时间】:2020-03-03 01:52:42
【问题描述】:

我需要从我的 ADF 管道中动态调用 Azure 函数。

目前我可以通过 Azure Function Activity 对 functionName 进行参数化,但我无法对 functionKey 和 URL 进行参数化。

URL 没问题,因为我可以将所有函数存储在同一个 URL 下,但 functionKey 确实是必须的。

你现在有什么选择吗?

我尝试过的

json 中的参数与 DataStoreLinkedServices 一样:

{
    "properties": {
        "type": "AzureFunction",
        "annotations": [],
        "parameters": {
            "functionSecret": {
                "type": "String"
            }
        },
        "typeProperties": {
            "functionAppUrl": "https://<myurl>.azurewebsites.net",
            "functionKey": {
                "type": "AzureKeyVaultSecret",
                "store": {
                    "referenceName": "KeyVaultLinkedService",
                    "type": "LinkedServiceReference"
                },
                "secretName": "@{linkedService().functionSecret}"
            }
        }
    }
}

错误消息:

"code":"BadRequest","message":"No value provided for Parameter 'functionSecret'"

有没有办法做到这一点?这似乎并不明显,我在网上冲浪时也没有发现任何东西。最相似的是this

【问题讨论】:

    标签: azure azure-functions azure-data-factory


    【解决方案1】:

    我会回答自己以防万一有人遇到同样的问题,我们为解决这个问题所做的就是参数化来自管道本身的所需信息。

    所以我们有一个只调用通用 Azure 函数的管道。在调用者管道中,有一个过程从 KeyVault 中获取所需的参数并将其传递给 AF 管道。

    LS 保持如下:

    {
        "properties": {
            "annotations": [],
            "type": "AzureFunction",
            "typeProperties": {
                "functionAppUrl": "https://@{linkedService().functionAppUrl}.azurewebsites.net",
                "functionKey": {
                    "type": "AzureKeyVaultSecret",
                    "store": {
                        "referenceName": "KeyVaultLinkedService",
                        "type": "LinkedServiceReference"
                    },
                    "secretName": "@{linkedService().functionKey}"
                }
            },
            "parameters": {
                "functionAppUrl": {
                    "type": "String",
                    "defaultValue": "@pipeline().parameters.functionAppUrl"
                },
                "functionKey": {
                    "type": "String",
                    "defaultValue": "@pipeline().parameters.functionKey"
                }
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-23
      • 2019-12-15
      • 1970-01-01
      相关资源
      最近更新 更多