Hello,
I'm trying to create a Bicep template to deploy a simple Logic App infrastructure containing an HTTP request trigger and 2 actions: an inline Javascript code execution and an insertion into a CosmosDB instance.
This is the Bicep template I have at the moment:
@description('The name of the logic app to create.')
param logicAppName string
@description('Location for all resources.')
param location string = resourceGroup().location
resource logicApp 'Microsoft.Logic/workflows@2019-05-01' = {
name: logicAppName
location: location
tags: {
displayName: logicAppName
}
properties: {
definition: {
'$schema': 'https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#'
actions: {
Execute_JavaScript_Code: {
type: 'JavaScriptCode'
inputs: {
code: 'let jsonObj = workflowContext.trigger.outputs.body;\r\njsonObj.id = String(jsonObj.id);\r\nreturn jsonObj;'
}
runAfter: {}
trackedProperties: {}
}
Create_or_update_item: {
type: 'ServiceProvider'
inputs: {
parameters: {
databaseId: 'stateless-example-db-id'
containerId: 'stateless-example-db-container'
item: '@outputs(\'Execute_JavaScript_Code\')'
isUpsert: false
}
serviceProviderConfiguration: {
connectionName: 'AzureCosmosDB'
operationId: 'CreateOrUpdateDocument'
serviceProviderId: '/serviceProviders/AzureCosmosDB'
}
}
runAfter: {
Execute_JavaScript_Code: [
'Succeeded'
]
}
trackedProperties: {}
}
}
contentVersion: '1.0.0.0'
outputs: {}
triggers: {
When_a_HTTP_request_is_received: {
type: 'Request'
kind: 'Http'
inputs: {
method: 'POST'
}
}
}
}
}
}
And this is the Azure CLI command I'm using:
az deployment group create --resource-group logic-app-stateless-workflow-portal-RG --template-file .\deployment\main.bicep --parameters logicAppName=StatelessExampleDeployment
I'm getting two different errors. The first one is related to the inline Javascript code execution:
{
"status": "Failed",
"error": {
"code": "DeploymentFailed",
"target": "/subscriptions/fa2331f2-0bbd-4a74-96a6-2ee23cf7ba25/resourceGroups/logic-app-stateless-workflow-portal-RG/providers/Microsoft.Resources/deployments/main",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.",
"details": [
{
"code": "IntegrationAccountAssociationRequired",
"message": "The workflow must be associated with an integration account to use the workflow run action 'Execute_JavaScript_Code' of type 'JavaScriptCode'."
}
]
}
}
The second one is related to the CosmosDB action:
{
"status": "Failed",
"error": {
"code": "DeploymentFailed",
"target": "/subscriptions/fa2331f2-0bbd-4a74-96a6-2ee23cf7ba25/resourceGroups/logic-app-stateless-workflow-portal-RG/providers/Microsoft.Resources/deployments/main",
"message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details.",
"details": [
{
"code": "WorkflowRunActionTypeUnsupported",
"message": "The workflow run action 'Create_or_update_item' has type 'ServiceProvider' that is not supported."
}
]
}
}
Do you have any advice on how to solve these issues?
Thanks in advance for your help,
Angelo