ADF : linked service template not defined while using conditions

Shreya Khanna 21 Reputation points Microsoft Employee
2022-11-24T07:01:25.35+00:00

Hi Team,

In ADF, I have created a linked service wherein I am trying to use the linked service parameters the following way:

"azureCloudType": "@if( contains(linkedService().TenantID ,'some-tenant-id') ,'AzurePublic', 'AzureChina')"  

The linkedservice.TenantID is also used like this below:

"tenant": "@{linkedService().TenantID}",  

which has no issues

However, when I try to use it along with the if statement, it gives this error:

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."  
}   

The error code is : FailToResolveParametersInExploratoryController

I found that this is an existing bug in ADF using following resources:
* https://stackoverflow.com/questions/73466849/adf-linkedservice-template-function-not-defined
* https://learn.microsoft.com/en-us/answers/questions/666654/linked-service-http-link-to-key-vault-authorizatio.html

If this is an existing bug, Is there a way to solve this problem or a workaround for this which could help us get unblocked?

Azure Data Explorer
Azure Data Explorer
An Azure data analytics service for real-time analysis on large volumes of data streaming from sources including applications, websites, and internet of things devices.
508 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,149 questions
{count} votes

Accepted answer
  1. AnnuKumari-MSFT 32,011 Reputation points Microsoft Employee
    2022-11-28T13:31:51.363+00:00

    Hi @Shreya Khanna ,

    Thankyou for sharing additional details on the query.

    Azure cloud type option can not be parameterized. The reason being : There is no add dynamic content option in that field. Also, if you check the official documentation of Azure SQL DB connector, linked service JSON using service principal doesn't have any property for Azure cloud type. So , even updating the JSON directly like this approach would also not work here.

    The workaround you can go for is to create two linked services: One with Azure Public cloud type and the other with Azure China cloud type.
    Use an If block in ADF pipeline and define the condition there as : @contains(pipeline().parameters.TenantID,'<some tenant ID>') . In true block, use the dataset having linked service pointing to 'AzurePublic' and in false block , use the dataset having linked service pointing to 'AzureChina' cloud.

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you.
      Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful