I need to use different Keyvaults for different environments (Dev/Test/UAT/Prod).
So, the name of the keyvault to be used is stored the Global Parameters, and is propagated from pipelines to other resources by means of parametrizing those resources. It works for cases like Pipeline->Linked Service, Pipeline->Dataset->Linked service,
But, I can't get it to work, when I have to access the Key vault from Linked service. That is, for example, when a REST type of linked service needs to read the API Key form KeyVault secret.
I have defined the Linked service to the keyvault
This way, the user will be able to obtain a secret from the Keyvault by making a web request to https://kevaultName.vault.azure.net/..
They 'kevaultName' name will be in the Global parameters and pipeline needing it would pass it as an argument for parameter.
But, what if I need a Linked Service to a database that needs to read the database password from the Key vault ? I define a Linked service in the following manner and it also works as expected. The Keyvault name will be provided as a parameter to this SQL DB linked service, propagated from the Pipeline. Where it is taken from Global parameter sections.
But, here is where I am stuck.
I need a linked service to a REST api, where API Key would be taken from the Key vault secret.
So, when defining Linked Service, I provide that 'Authorization' header to be read from Key Vault accessed by linked service defined in the first picture above (The one that works correct in case of Pipeline linking to it by web activity).
Here is the definition of the Linked Service:
In order for it to work, I need to HARDCODE the key vault name in the "KeyVaultLink" linked service - like this
But, I have no control over the name of a Keyvault in other environments. So, I wanted to do pass a Linked Service Parameter to itlike this:
@linkedService().AZKeyVaultName
However, doing so - I get the the error message
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."
}
Azure data factory Error : InvalidTemplate, ErrorMessage=The template function 'linkedService' is not defined or not valid.
The issue in might be causing because of incorrect referencing and add the vale within the curl braces { }
so it will take it as string interpretation.
Rest API lined service:
key vault linked service:
If you are still facing the same issue please raise a support ticket for the deeper investigation.