I have a requirement to use the parameters inside the workflow parameters Object similar to below. But I am failing with the Azure Validation.
"parameters": {
"$apprelatedparams": {
"value": {
"testId": "<GUID>",
"testGroupName": "<GroupName>"
}
},
"$connections": {
"value": {
"connectionName": {
"connectionId": /test/@parameters['$apprelatedparams']['testId']/resourceGroups/@parameters['$apprelatedparams']['testGroupName']/providers/connectionName,
"id": /test/@parameters['$apprelatedparams']['testId']/providers/testName
}
}
}
}
Here is the complete workflow with parameters object -
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Response": {
"inputs": {
"body": "\"message\": \"Hello World!\"",
"statusCode": 200
},
"runAfter": {},
"type": "Response"
}
},
"contentVersion": "",
"outputs": {},
"parameters": {},
},
"parameters": {
"$apprelatedparams": {
"value": {
"testId": "TestID",
"testGroupName": "GroupName"
}
},
"$apprelatedparamstest": {
"value": {
"testsId": "@parameters['$apprelatedparams']['testId']",
"testGroupsName": "@parameters['$apprelatedparams']['testGroupName']"
}
}
}
}
CodePudding user response:
This is failing because of the structure of the json. Here is the json code that worked for me.
{
"parameters": {
"$apprelatedparams": {
"value": {
"testId": "<GUID>",
"testGroupName": "<GroupName>"
}
},
"$connections": {
"value": {
"connectionName": {
"connectionId": "test/@parameters['$apprelatedparams']['testId']/resourceGroups/@parameters['$apprelatedparams']['testGroupName']/providers/connectionName",
"id": "/test/@parameters['$apprelatedparams']['testId']/providers/testName"
}
}
}
}
}
CodePudding user response:
Functions in expressions are called using parenthesis and not brackets. Therefore, you should transform your file into :
"parameters": {
"$apprelatedparams": {
"value": {
"testId": "<GUID>",
"testGroupName": "<GroupName>"
}
},
"$connections": {
"value": {
"connectionName": {
"connectionId": "/test/@parameters('apprelatedparams')['testId']/resourceGroups/@parameters('apprelatedparams')['testGroupName']/providers/connectionName",
"id": "/test/@parameters('apprelatedparams')['testId']/providers/testName"
}
}
}
}
See also Expressions for Workflow Definition Language as it explains what outputs you should expect depending on how you construct the call.