Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot set the workflow.id attribute for a Logic App HTTP request trigger for a Logic App calling another Logic App via Bicep files #1045

Open
sbarkeratos opened this issue Apr 23, 2024 · 6 comments
Labels

Comments

@sbarkeratos
Copy link

sbarkeratos commented Apr 23, 2024

Describe the Bug with repro steps

I'm trying to deploy a parent-child logic app hierarchy via bicep files deployed from an Azure DevOps pipeline.

In the bicep file for the parent Logic App, include this section in the JSON to configure the trigger in the child logic app:

"name_of_trigger_in_child_logic_app": {
"inputs": {
"body": "@Body('name_of_item')",
"host": {
"triggerName": "name_of_trigger",
"workflow": {
"id": "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/rg_name/providers/Microsoft.Logic/workflows/child_logic_app_name"
}
}
}

If I hard code the subscription Id in the string it works fine, but when I try and pass using a variable I get the following error message:

{
"status": "Failed",
"error": {
"code": "DeploymentFailed",
"target": "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/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": "ResourceDeploymentFailure",
"target": "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/rg_name/providers/Microsoft.Resources/deployments/child_logic_app_name",
"message": "The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'.",
"details": [
{
"code": "DeploymentFailed",
"target": "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/rg_name/providers/Microsoft.Resources/deployments/child_logic_app_name",
"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": "LinkedInvalidPropertyId",
"message": "Property id '@encodeURIComponent(parameters('parameter_name'))' at path 'properties.definition.actions.Process_Users.actions.Loop_over_messages.actions.Get_latest_user_work_relationship_item.inputs.host.workflow.id' is invalid. Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'."
}
]
}
]
}
]
}
}

I've tried to deploy this using a parameter but it won't work.

What type of Logic App Is this happening in?

Consumption (Portal)

Are you using new designer or old designer

New Designer

Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg

Yes

Workflow JSON

No response

Screenshots or Videos

No response

Browser

Edge

Additional context

No response

AB#27782888

@hartra344 hartra344 transferred this issue from Azure/LogicAppsUX Apr 23, 2024
@mikko-kunnari
Copy link

mikko-kunnari commented Apr 30, 2024

Hi, I have done this recently so I guess you just have some issue with the template itself. I used:

`resource OtherLogicApp 'Microsoft.Logic/workflows@2019-05-01' existing = {
name: otherLogicAppName
}

resource LogicApp... {
...
workFlow: {
id: OtherLogicApp.id
}
...
`

@sbarkeratos
Copy link
Author

Hi @mikko-kunnari - thanks very much for getting back to me on this.

This looks like it could be the answer, but I'm struggling to understand how you would access the ID of an action in the bicep file. Can you expand on the '...' so I can see how you'd access the particular action and it's properties please.

Thanks,

Steve.

@mikko-kunnari
Copy link

Sure thing. I'm not sure what you mean by ID of an action. You would give resource ID of the Logic App (workflow) and name of the trigger in that Logic App.

resource LogicApp 'Microsoft.Logic/workflows@2019-05-01' = {
name: logicAppName
location: location
properties: {
state: 'Enabled'
definition: {
'$schema': 'https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#'
contentVersion: '1.0.0.0'
outputs: {}
parameters: {}
triggers: {}
actions: {
'call_other_logic_app': {
inputs: {
host: {
triggerName: 'When_a_HTTP_request_is_received'
workFlow: {
id: LogicApp.id
}
}
}
type: 'Workflow'
runAfter: {}
}
...

@sbarkeratos
Copy link
Author

Ah! I see how you've done it - you're hard coding the JSON directly into the bicep file. Our logic apps are a little big for that so we're storing them separately in .json files and reading them in using loadJsonContent('{path}'). The approach you listed won't work in our case. The work around I currently have is to do a find and replace on the JSON files before I add them to the bicep files but it's not ideal. I've got a case open with MS to fix the bug I'm experiencing.

@mikko-kunnari
Copy link

I use bicep CLI to decompile the JSON file to bicep and use it as a bicep file. And I also use Logic Apps only as an orchestrator and Functions for any actual "logic" to keep Logic Apps simple. But yeah I agree working with Logic Apps as "code" (in my opinion JSON is not even code) is far from ideal.

Copy link

This issue is stale because it has been open for 45 days with no activity.

@github-actions github-actions bot added the stale label Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants