1
votes

How do I pass in parameters at runtime to a Linked Service in Data Factory?

I have a parameter defined and consumed in my Azure Function linked service definition, but am unsure how I set that during invocation in my pipeline action. In this case I would like to set functionAlias in a trigger to set the Azure Function hostname. Currently an exception is returned on (blob create) trigger stating that functionAlias is not specified.

Pipeline

        {
            "name": "myActivity",
            "type": "AzureFunctionActivity",
            "typeProperties": {
                "functionName": "myFunctionName",
                "method": "POST"
            }
            "linkedServiceName": {
                "referenceName": "myFunctionLinkedService",
                "type": "LinkedServiceReference"
            }
        }

Linked service

{
    "name": "myFunctionLinkedService",
    "type": "Microsoft.DataFactory/factories/linkedservices",
    "properties": {
        "type": "AzureFunction",
        "typeProperties": {
            "functionAppUrl": "https://@{linkedService().functionAlias}.azurewebsites.net",
            "encryptedCredential": ""
        },
        "parameters": {
            "functionAlias": {
                "type": "String"
            }
        }
    }
}
2

2 Answers

1
votes

I tried to parameterize Azure Function Linked Service in the Data Factory UI and get the same error as same as you because the parameter input box did not show up ever.

Then I follow the official document to try to parameterize Azure SQL Database Linked Service.

enter image description here

Then I test it and the input box showed up just as I expected.

enter image description here

I check the document and find the below statement.

enter image description here

It seems that only data stores are supported by parameterize feature in ADF so far, however Azure Function is belong to Compute,not data stores.(Maybe it will be supported in the furture)

enter image description here

You could submit feedback or contact ADF team directly to verify that.

0
votes

Just UI doesn't support it natively. But you can use advanced JSON. https://docs.microsoft.com/en-us/azure/data-factory/parameterize-linked-services enter image description here