1

I am trying to configure an Azure Action Group to call a workflow in a standard Logic App using Bicep.

When I configure the Action Group in the portal, it appears like enter image description here

ie the value contains {logic app name} / {workflow name} and in the portal JSON, the resourceId is given as /subscriptions/{subscription id}/resourceGroups/{resourcegroup name}/providers/Microsoft.Web/sites/{logic app name}/workflows/{workflow}

I want to use this in the resourceId of a logicAppReceiver in the action group

logicAppReceivers: [
  {
    name: 'LogicAppReceiverAlerting'
    resourceId: resourceId // <- set this 
    callbackUrl: logicAppCallbackUrl
    useCommonAlertSchema: true
  }]

How do I construct the resource ID of the workflow in this format?

Using

resourceId('Microsoft.Logic/workflows', workflowName)

gives just the workflow ID /subscriptions/{subscription id}/resourceGroups/{resourcegroup name}/providers/Microsoft.Logic/workflows/{workflow name}

Using

resourceId('Microsoft.Web/sites', logicAppName)

gives just the logic app ID /subscriptions/{subscription id}/resourceGroups/{resourcegroup name}/providers/Microsoft.Web/sites/{logic app name}

Using

resourceId('Microsoft.Web/sites', logicAppName, workflowName)

is invalid.

2 Answers 2

1

Looking at the documentation, you need to specify the sub-resource type:

resourceId('Microsoft.Web/sites/workflows', logicAppName, workflowName)
Sign up to request clarification or add additional context in comments.

Comments

0

CallbackUrl and Logicapp resourceId are both important here. Sometimes you should treat logicapp trigger as a child resource.


Passing resourceId be recommended to use resource handle, such as logicApp.id instead of concating the resourceId string

param location string
param logicAppName string

@description('logicapp alert trigger name. this value be used in logicapp callbackUrl')
param logicappTriggerName string

param actionGroupName string

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'
      parameters: {
        '$connections': {
          defaultValue: {}
          type: 'Object'
        }
      }
      triggers: {
        '${logicappTriggerName}': {
          type: 'Request'
          kind: 'Http'
          inputs: {
            ...
          }
        }
      }
      actions: {
        ...
      }
      outputs: {}
    }
    parameters: {
      ...
  }
 }
}

resource actionGroupNew 'Microsoft.Insights/actionGroups@2023-01-01' =  {
  name: actionGroupName
  location: 'Global'
  properties: {
    enabled: true
    groupShortName: 'ag'
    logicAppReceivers: [
      {
        name: 'logicapp'
        useCommonAlertSchema: true
        resourceId: logicApp.id
        callbackUrl: listCallbackURL(('${logicApp.id}/triggers/${logicappTriggerName}'), '2019-05-01').value
      }
    ]
  }
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.