question

SukumarVinnakota-8083 avatar image
0 Votes"
SukumarVinnakota-8083 asked MartinJaffer-MSFT commented

Unable to use Global Parameters inside JSON of a SAP Open Hub Linked Service

I have a SAP BW Open Hub Linked service created in Azure Data Factory. I have defined my SNC details in Global parameters and want to use these parameters under Advanced section where i can define a dynamic JSON. When i tried to invoke the global parameter by calling it with "@{globalParameters().<parameterName>}" , I am getting the following error

The parameters and expression cannot be resolved for schema operations. Error Message: { "Message": "ErrorCode=InvalidTemplate, ErrorMessage=The template function 'globalParameters' is not defined or not valid.

Below is the JSON that i have defined in Linked Service

{
"properties": {
"typeProperties": {
"sncMyName": "@{globalParameters().<<ParameterName>>}"
}
}
}

Can we use Global Parameters inside a Linked service.

azure-data-factory
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @SukumarVinnakota-8083 and welcome to Microsoft Q&A.

I think you need to first parameterize the linked service, then use the global parameter in the linked service's parameter value.


0 Votes 0 ·

I have tried to create a linked service parameters and invoke global parameters in it using the below JSON but i am still getting the same error.

{
"properties": {
"parameters": {
"sncName": {
"type": "String",
"defaultValue": "@{globalParameters().<<ParameterName>>}"
}
},
"typeProperties": {
"sncMyName": "@{LinkedService().sncName}"
}
}

}

0 Votes 0 ·
MartinJaffer-MSFT avatar image
0 Votes"
MartinJaffer-MSFT answered MartinJaffer-MSFT commented

Ahh I think I found the issue, @SukumarVinnakota-8083 .

When specifying the JSON, the entire payload, not just the portion you want to modify, needs to be included. (Below picture for clarification.)

99974-image.png

Below I include template from my example. I created this by filling out the Linked Service normally and saving. Then I went and edited the JSON until it would save.

 {
     "name": "SapOpenHub1",
     "type": "Microsoft.DataFactory/factories/linkedservices",
     "properties": {
         "parameters": {
             "sncName": {
                 "type": "string",
                 "defaultValue": "@{globalParameters().genericGlobal}"
             }
         },
         "annotations": [],
         "type": "SapOpenHub",
         "typeProperties": {
             "clientId": "fakeid",
             "language": "english",
             "userName": "fakeusername",
             "server": "fakeservername",
             "systemNumber": "fakenumber",
             "encryptedCredential":"XXXXXXXXXXXXX"
         },
         "connectVia": {
             "referenceName": "XXXXXX",
             "type": "IntegrationRuntimeReference"
         }
     }
 }



image.png (188.5 KiB)
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


We have made the changes provided as you have mentioned but yet we are getting the same error. Below is the JSON snippet for your reference.

{
"properties": {
"type": "SapOpenHub",
"parameters": {
"sncName": {
"type": "string",
"defaultValue": "@{globalParameters().gp_SncName}"
}
},
"annotations": [],
"typeProperties": {
"sncMyName": "@{linkedService().sncName}"
},
"connectVia": {
"referenceName": "IR",
"type": "IntegrationRuntimeReference"
},
"description": " BW Openhub"
}
}

0 Votes 0 ·

100169-error.jpg



0 Votes 0 ·
error.jpg (15.0 KiB)

Ahh I see now. @SukumarVinnakota-8083 . This is in the "test connection" or "preview data" stage, not in the save linked service stage.

I have reproduced the error message now. A few things are working differently than I expected (I don't usually put global parameter directly in linked service/dataset), so I have a few things to test before I have conclusive answer.

In order of most to least likely.
- Maybe the global parameter needs to be published before it can be used? (this makes a bit of sideways sense in regards to linked service, as linked service often publish directly, and may not recognize a piece living only in git).
- Maybe global parameters are only accessible in the context of pipelines, and must be passed through activity to dataset to linked service? ( the documentation for global parameters seems to only talk about usage in pipelines)

0 Votes 0 ·
MartinJaffer-MSFT avatar image
0 Votes"
MartinJaffer-MSFT answered MartinJaffer-MSFT commented

It seems that global parameters must be invoked from the pipeline level (as a parameter to dataset like picture below). Then passed from activity to dataset to linked service.

103144-image.png

You cannot use GlobalParameter as a default value in Linked Service or Dataset.



image.png (59.6 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

I have submitted an internal feedback / feature request about this.

1 Vote 1 ·