I have created azure logic app single tenant project using visual studio code by following this documentation. And then created workflow based on my requirement, this contains the data factory pipeline and send grid actions.
The workflow contains the hardcoded values in the create a pipeline run data factory action.
"Create_a_pipeline_run": {
"inputs": {
"host": {
"connection": {
"referenceName": "azuredatafactory_5"
}
},
"method": "post",
"path": "/subscriptions/@{encodeURIComponent('xxxxxxx-xxxx-xxxx-xxxx-xxxxxx')}/resourcegroups/@{encodeURIComponent('xxxxx')}/providers/Microsoft.DataFactory/factories/@{encodeURIComponent('xxxxxx')}/pipelines/@{encodeURIComponent('xxxxxxx')}/CreateRun",
"queries": {
"x-ms-api-version": "2017-09-01-preview"
}
},
"runAfter": {},
"type": "ApiConnection"
},
And the connections.json
file looks file below:
"managedApiConnections": {
"sendgrid": {
"api": {
"id": "/subscriptions/@appsetting('WORKFLOWS_SUBSCRIPTION_ID')/providers/Microsoft.Web/locations/centralus/managedApis/sendgrid"
},
"authentication": {
"type": "ManagedServiceIdentity"
}
},
"azuredatafactory_5": {
"api": {
"id": "/subscriptions/@appsetting('WORKFLOWS_SUBSCRIPTION_ID')/providers/Microsoft.Web/locations/centralus/managedApis/azuredatafactory"
},
"authentication": {
"type": "ManagedServiceIdentity"
}
}
}
The above managed API connections refers the existing API connections from azure. But I want to create the new managed API connections per environment (means parameterize the values in the connections.json
file based on the environment).
Can anyone suggest me how to parameterize the values in workflow.json
files per environment and parameterize the values in connections.json
file per environment.
A logic app standard is just an app service of kind workflowApp
.
You can heavily make use of appsettings here.
Logic app parameters.
In your workflow.json
, you can use parameters like that:
"Create_a_pipeline_run": {
"inputs": {
"host": {
"connection": {
"referenceName": "azuredatafactory_5"
}
},
"method": "post",
"path": "/subscriptions/@{encodeURIComponent(parameters('subscription_id'))}/resourcegroups/...",
"queries": {
"x-ms-api-version": "2017-09-01-preview"
}
},
"runAfter": {},
"type": "ApiConnection"
}
Then in your parameters.json
file, reference app settings like that:
{
"subscription_id": {
"type": "String",
"value": "@appsetting('WORKFLOWS_SUBSCRIPTION_ID')"
}
}
subscription_id
must be defined as an app setting in the app service.
Logic app connections.
In the same way you can use app settings and parameters for connection information in your connections.json
file:
{
"managedApiConnections": {
"sendgrid": {
"api": {
"id": "/subscriptions/@appsetting('WORKFLOWS_SUBSCRIPTION_ID')/providers/Microsoft.Web/locations/centralus/managedApis/sendgrid"
},
...
"authentication": "@parameters('azure_authentication')"
}
}
}
then in your parameters.json
file:
{
"azure_authentication": {
"type": "object",
"value": {
"type": "ManagedServiceIdentity"
}
}
...
}
This way you can easily offload all environment specific parameters to app settings