Linked Service Can't connect to parametrized KeyVault linked service

Dmitriy Ryabin 6 Reputation points
2023-04-20T21:02:30.5133333+00:00

Hello,
I need help. Sorry, somewhat long description, but it to the point.

Here is the scenario:
I may have serval Key vaults under my Azure subscription. They are copy of each others except the values of some secrets differ (production vs. Test vs. Dev data etc...)
In the Azure Data Factory, I have a Linked Service defined that connects to the key vault. This linked service is parametrized, taking vault name as an argument.
User's image

Then, I have 2 more linked services.

  • One to a REST endpoint taking ApiKey from key vault
    and
  • Another one is to the Azure SQL Database, taking database password from the Key vault.
    FOR SQLDB linked service, is defined this way:
    User's image

Here, AZKeyVaultName parameter is used to connect to a keyvault by name. I can use either parameter here or hard code the key vault name (not using linked service parameter). When using parameter, its value gets propagated from particular pipeline, at the run time, which can be a value taken from Global parameters defined for each Data factory environments.
However, the problem is with the REST Linked service. Defined this way
User's image

where they Keyvault link is like this:
User's image

When in the last picture keyvault name is hardcoded as dmkeyvault1 - everything works correctly. However,
they way I want it is to pass a value to it dynamically, so like above it will accept changing key vault name at run time.
User's image

If i have it as in the last picture, I am getting error in trying to connect with the REST Linked service
The error is:

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." } I do not understand how this is different from what is taking place in the SQLDB Linked Service, where it is working correctly. Having to hard code keyvault name defies the purpose of continuous integration for me.

Azure Key Vault
Azure Key Vault
An Azure service that is used to manage and protect cryptographic keys and other secrets used by cloud apps and services.
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
{count} vote

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.