Search code examples
azure-data-factoryazure-synapse-pipeline

How to parametrize the KeyVault secret field in a Linked Service, using functions and LS parameters?


EDIT: Pipeline executes fine and the behavior is observed only when testing connection...

I am trying to parametrize the Secret Name value in a linked service. When using a LS parameter, this works fine: enter image description here

If, I only use the concat function, concatenating two strings this also works fine: enter image description here

But when I try to use a LS parameter in the function, I get an error: enter image description here

Error thrown:

The parameters and expression cannot be resolved for schema operations. Error Message: { "message": "ErrorCode=InvalidTemplate, ErrorMessage=The template function 'linkedService' is not defined or not valid." } Activity ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxx

Parameter is a string:

enter image description here

Any ideas what did I do wrong?

I have tried changing the .json directly but outcome is the same.

I have also tried packing the parameter in curly brackets, like so: @{concat(linkedService().ServicePrincipalId,'-password')}


Solution

  • In general, the above occurs when we use a linked service parameter in the dynamic expression without creating.

    In this case, I have reproduced the same scenario, and these are my observations.

    • When the same parameters are used for both Service principal ID and Secret name, I got this error. This is also only when using it with concat().

      enter image description here

      You can see the connection is successful when both parameters are different even though the expression is same. The values for both parameters are same.

      enter image description here

      I had tested this with different parameter names, and it resulted same.

    • Also, when concatenating this using string interpolation expression like @{linkedService().ServicePrincipalId}-password, it is working fine.

      enter image description here

    As the pipeline execution is fine, this might be a bug in a parameterized Key vault linked service test connection.

    Using different parameters or string interpolation can act as a temporary workaround for this.