linked service (HTTP), Link to Key Vault Authorization Secret. Error (The template function 'linkedService' is not defined or not valid)

Badr Elfarri 6 Reputation points

I have suddenly got an issue with my HTTP Linked Service as it fails to get the token from the Key vault. The following error i receive.

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: c0fc7c4f-9aa4-4e9b-8c4b-db52999c6848

The issue is only in the HTTP Linked service and all the other linked service getting secrets via the Key Vault are working fine.
This was working before but suddenly stoped working. The error is received when try to test the connection


When removing the key vault from the value in the Authorization header and manually entering the key everything works fine.

The key vault template looks like this:

"name": "MontekServiceApp",
"properties": {
"parameters": {
"enironment": {
"type": "String",
"defaultValue": "dev"
"annotations": [],
"type": "HttpServer",
"typeProperties": {
"url": "XXXX",
"enableServerCertificateValidation": true,
"authenticationType": "Anonymous",
"authHeaders": {
"Authorization": {
"type": "AzureKeyVaultSecret",
"store": {
"referenceName": "AzureKeyVault",
"type": "LinkedServiceReference",
"parameters": {
"environment": {
"value": "@linkedService().enironment",
"type": "Expression"
"secretName": "XXX"

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.
1,054 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,159 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Badr Elfarri 6 Reputation points

    I found the issue,

    I am using parameterize linked services in Azure Data Factory, The Linked Service of the Key Vault has a parameter called environment. This must be added to the parameters of the HTTP Linked service to get it to work as shown on the picture below.

    This is my linked service for key vault


    This is how the HTTP must look like, if the parameter defined in Key Vault linked service is missing then the HTTP Linked service will fail.


    1 person found this answer helpful.