通过 Bicep 模板/脚本为标准逻辑应用程序配置工作流程和 API 连接

问题描述 投票:0回答:1

我正在尝试为我的标准逻辑应用程序配置工作流程和 API 连接。

这是我的逻辑应用程序二头肌脚本。

resource logicAppResource 'Microsoft.Web/sites@2023-01-01' = {
  name: logicAppName
  location: 'South India'
  kind: 'functionapp,workflowapp'
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    siteConfig: {
      appSettings: [
        {
          name: 'FUNCTIONS_EXTENSION_VERSION'
          value: '~4'
        }
        {
          name: 'FUNCTIONS_WORKER_RUNTIME'
          value: 'node'
        }
        {
          name: 'WEBSITE_NODE_DEFAULT_VERSION'
          value: '~18'
        }
        {
          name: 'AzureWebJobsStorage'
          value: storageConnectionString
        }
        {
          name: 'WEBSITE_CONTENTAZUREFILECONNECTIONSTRING'
          value: storageConnectionString
        }
        {
          name: 'WEBSITE_CONTENTSHARE'
          value: toLower(logicAppName)
        }
        {
          name: 'AzureFunctionsJobHost__extensionBundle__id'
          value: 'Microsoft.Azure.Functions.ExtensionBundle.Workflows'
        }
        {
          name: 'AzureFunctionsJobHost__extensionBundle__version'
          value: '[1.*, 2.0.0)'
        }
        {
          name: 'APP_KIND'
          value: 'workflowApp'
        }
      ]
    }
    enabled: true
    hostNameSslStates: [
      {
        name: '${logicAppName}.azurewebsites.net'
        sslState: 'Disabled'
        hostType: 'Standard'
      }
      {
        name: '${logicAppName}.scm.azurewebsites.net'
        sslState: 'Disabled'
        hostType: 'Repository'
      }
    ]
    serverFarmId: logicAppServicePaln.id
    reserved: false
    isXenon: false
    hyperV: false
    vnetRouteAllEnabled: true
    vnetImagePullEnabled: false
    vnetContentShareEnabled: false
    // siteConfig: {
    //   numberOfWorkers: 1
    //   acrUseManagedIdentityCreds: false
    //   alwaysOn: false
    //   http20Enabled: false
    //   functionAppScaleLimit: 0
    //   minimumElasticInstanceCount: 1
    // }
    scmSiteAlsoStopped: false
    clientAffinityEnabled: false
    clientCertEnabled: false
    clientCertMode: 'Required'
    hostNamesDisabled: false
    customDomainVerificationId: '0182BAC7C537A4874AED7705B0D4D788E2909F91FBE82947CB8133FDBDD204EA'
    containerSize: 1536
    dailyMemoryTimeQuota: 0
    httpsOnly: true
    redundancyMode: 'None'
    publicNetworkAccess: 'Enabled'
    storageAccountRequired: false
    virtualNetworkSubnetId: '${vnetResourceLogicApp.id}/subnets/${subnetResource.name}'
    keyVaultReferenceIdentity: 'SystemAssigned'
  }
}

但是当我尝试添加工作流程时

resource logicApp 'Microsoft.Logic/workflows@2019-05-01' = {
  name: logicAppName
  location: resourceGroupLocation
  properties: {
    state: 'Enabled'
    definition: {
      '$schema': 'https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#'
      actions: {
        HTTP: {
          inputs: {
            method: 'GET'
            uri: 'https://ifconfig.me'
          }
          runAfter: {}
          runtimeConfiguration: {
            contentTransfer: {
              transferMode: 'Chunked'
            }
          }
          type: 'Http'
        }
      }
      contentVersion: '1.0.0.0'
      outputs: {}
      triggers: {
        When_a_HTTP_request_is_received: {
          kind: 'Http'
          type: 'Request'
        }
      }
    }
  }
}

它使用消费计划创建一个新的逻辑应用。无需在标准逻辑应用程序内创建工作流程。

logic app code view

然后我尝试手动实现工作流程并尝试获取代码,但

kind: 'Stateful'
属性不适合二头肌模板。

同样使用 API 连接,但 API 连接是在资源组内部创建的,但无法添加到工作流程中。

connections inside workflow API连接二头肌

resource sqlServerAPIConnection 'Microsoft.Web/connections@2016-06-01' = {
  name: sqlServerAPIConnectionName
  location: resourceGroupLocation
  properties: {
    api: {
      name: sqlServerAPIConnectionName
      type: 'Microsoft.Web/locations/managedApis'
      displayName: 'SQL SERVER'
      brandColor: '#f2f2f2'
      description: 'Connect to SQL Server'
      iconUri: 'https://connectoricons-prod.azureedge.net/releases/v1.0.1683/1.0.1683.3685/sql/icon.png'
      id: '/subscriptions/${subscription().subscriptionId}/providers/Microsoft.Web/locations/${resourceGroupLocation}/managedApis/sql'
    }
    parameterValues: {
      database: sqlServerAPIConnectionDbName
      server: sqlServerAPIConnectionServerName
      username: sqlServerAPIConnectionUsername
      password: sqlServerAPIConnectionPassword
      authType: 'sqlAuthentication'
    }

    displayName: 'SQL'
  }
}

API 连接和工作流程都无法在标准逻辑应用程序中正确部署。

我想部署标准逻辑APP的API连接和工作流程。

我尝试了消费计划逻辑应用程序,它与此工作流程和 API 连接完美配合。

azure arm azure-logic-apps azure-bicep azure-workflow-automation
1个回答
0
投票

使用arm模板在标准逻辑应用程序中部署工作流程是另一个故事,要复杂得多。您不能只是将

consumption
工作流程代码复制粘贴到
standard
中。但使用
workflow.json
connections.json
等。github 或官方文档中的示例代码文档很少。我刚刚在 azure github 中找到了一个示例 link 。只需学习并遵循模式即可。

© www.soinside.com 2019 - 2024. All rights reserved.