ramesh reddy
ramesh reddy

Reputation: 597

how can i add multiple workflows to standard logic apps through bicep

I am trying to create standard logic app with multiple workflows through bicep. i have added bicep code for creating AppServicePlan and logicapp. however could not find bicep code to add multiple workflows. we need to try small automation scripts to run as part of workflows.

here is the code

      resource hosting_plan 'Microsoft.Web/serverfarms@2022-09-01' = {
        name: appservicePlanName
        location: location
        sku: {
          name: skuName
           capacity: skuCapacity
        }
        properties: {
        }
        }

     resource logicApp 'Microsoft.Web/sites@2022-09-01' = {
       name: logicAppName
       location: location
       kind: 'functionapp,workflowapp'
       identity: {
         type: 'SystemAssigned'
         }
      properties: {
      httpsOnly: true
      serverFarmId: hosting_plan.id
      clientAffinityEnabled: true
      siteConfig: {
      remoteDebuggingEnabled: false
      ftpsState: 'Disabled'
      minTlsVersion: '1.2'
      scmIpSecurityRestrictionsDefaultAction: 'Deny'     
      ipSecurityRestrictionsDefaultAction: 'Deny'      
      functionsRuntimeScaleMonitoringEnabled: false
       }
      }
     }

how can achieve adding multiple workflows through bicep code. thanks in advance

Upvotes: 0

Views: 280

Answers (1)

Vinay B
Vinay B

Reputation: 2401

Adding multiple workflows to standard logic apps by zipping the different workflows in the single zip file using bicep.

I agree with the Thomas on the insights he mentioned by sharing the MSdoc link while you're using multiple workflows indeed possible as this approach mentioned refer doc leads you the same thing.

you can also try this by the zipping the workflows in single file then uploading the same to the storage account and by fetching the SAS token URL we can access the storage account and files inside it.

main.bicep:

param location string = resourceGroup().location
param appservicePlanName string = 'vksbAppServicePlan'
param logicAppName string = 'vksbLogicApp'
param skuName string = 'WS1'
param skuCapacity int = 1


resource hosting_plan 'Microsoft.Web/serverfarms@2022-09-01' = {
  name: appservicePlanName
  location: location
  sku: {
    name: skuName
    capacity: skuCapacity
  }
  properties: {
  }
}


resource logicApp 'Microsoft.Web/sites@2022-09-01' = {
  name: logicAppName
  location: location
  kind: 'functionapp,workflowapp'
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    httpsOnly: true
    serverFarmId: hosting_plan.id
    clientAffinityEnabled: true
    siteConfig: {
      remoteDebuggingEnabled: false
      ftpsState: 'Disabled'
      minTlsVersion: '1.2'
      scmIpSecurityRestrictionsDefaultAction: 'Deny'
      ipSecurityRestrictionsDefaultAction: 'Deny'
      functionsRuntimeScaleMonitoringEnabled: false
    }
  }
}


resource logicAppZipDeploy 'Microsoft.Web/sites/extensions@2022-03-01' = {
  name: '${logicApp.name}/zipdeploy'
  properties: {
    packageUri: 'https://testsamvinayvksb.blob.core.windows.net/samplevk/file.zip?sp=r&st=2024-07-08T08:00:46xxxxxxxxxxxxx:46Z&spr=https&sv=2022-11-02&sr=b&sig=xxxxxxxxxxxxxxxxxxxxxxx'
  }
}

output logicAppEndpoint string = logicApp.properties.defaultHostName

Deployment Succeded:

enter image description here

enter image description here

refer:

https://learn.microsoft.com/en-us/azure/logic-apps/quickstart-create-deploy-bicep?tabs=CLI

Upvotes: 0

Related Questions