1

I have tried numerous methods and the workflow is still deployed enabled. My latest attempt was to use the resource in my bicep:

resource workflow 'Microsoft.Web/sites/workflows@2015-08-01' = {
  name: workflowName
  dependsOn: [ logicContainer ]
  location: location
  kind: 'Stateful'
  properties: {
    flowstate: 2
  }
}

However, the workflow never appears in the Logic App function. I cannot even deploy the container in the 'Stopped' state, since for Microsoft.Web/sites@2022-03-01, state is readonly.

MintyOwl
  • 71
  • 1
  • 10
  • Found this now as a basis: https://stackoverflow.com/questions/70022292/single-tenant-logic-app-how-to-set-an-initial-state-for-each-workflow - I'll update with a bicep solution – MintyOwl Jan 25 '23 at 08:25

1 Answers1

1

In my yaml I send a the workflows in a pipe separated string e.g. "wf-one|wf-two|wf-three|wf-four"

Then, in my bicep I populate an array of Workflow states app settings:

var wfAppSettingStatuses            = [ for wf in split(workflows,'|'):  { 
  name: 'Workflows.${wf}.FlowState' 
  value: 'Disabled'
}]

To add to the Logic App container configuration settings use the union function:

resource logicContainer 'Microsoft.Web/sites@2022-03-01' = {
  name: appName
  location: location
  kind: 'functionapp,workflowapp'
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    httpsOnly: true
    siteConfig: {
      appSettings: union(wfAppSettingStatuses, [
        {
          name: 'APPINSIGHTS_INSTRUMENTATIONKEY'
          value: applicationInsights.properties.InstrumentationKey
        }
        ...
])
      use32BitWorkerProcess: true
    }
    serverFarmId: planId 
    clientAffinityEnabled: false
    vnetRouteAllEnabled: true
    storageAccountRequired: false
    keyVaultReferenceIdentity: 'SystemAssigned'
  }
}

Each workflow in the list is now disabled, therefore if you require one to be enabled on deployment, remove it from the pipe delimited string.

MintyOwl
  • 71
  • 1
  • 10