Set up DevOps deployment for Standard logic app workflows in single-tenant Azure Logic Apps

Applies to: Azure Logic Apps (Standard)

This article shows how to deploy a Standard logic app project to single-tenant Azure Logic Apps from Visual Studio Code to your infrastructure by using DevOps tools and processes. Based on whether you prefer GitHub or Azure DevOps for deployment, choose the path and tools that work best for your scenario. You can use the included samples that contain example logic app projects plus examples for Azure deployment using either GitHub or Azure DevOps. For more information about DevOps for single-tenant, review DevOps deployment overview for single-tenant Azure Logic Apps.

Prerequisites

Deploy infrastructure resources

If you haven't already set up a logic app project or infrastructure, you can use the following sample projects to deploy an example app and infrastructure, based on the source and deployment options you prefer to use:

Both samples include the following resources that a logic app uses to run.

Resource name Required Description
Logic App (Standard) Yes This Azure resource contains the workflows that run in single-tenant Azure Logic Apps.
Functions Premium or App Service hosting plan Yes This Azure resource specifies the hosting resources to use for running your logic app, such as compute, processing, storage, networking, and so on.

Important: In the current experience, the Logic App (Standard) resource requires the Workflow Standard hosting plan, which is based on the Functions Premium hosting plan.

Azure storage account Yes, for both stateful and stateless workflows This Azure resource stores the metadata, keys for access control, state, inputs, outputs, run history, and other information about your workflows.
Application Insights Optional This Azure resource provides monitoring capabilities for your workflows.
API connections Optional, if none exist These Azure resources define any managed API connections that your workflows use to run managed connector operations, such as Office 365, SharePoint, and so on.

Important: In your logic app project, the connections.json file contains metadata, endpoints, and keys for any managed API connections and Azure functions that your workflows use. To use different connections and functions in each environment, make sure that you parameterize the connections.json file and update the endpoints.

For more information, review API connection resources and access policies.

Azure Resource Manager (ARM) template Optional This Azure resource defines a baseline infrastructure deployment that you can reuse or export.

API connection resources and access policies

In single-tenant Azure Logic Apps, every managed or API connection resource in your workflows requires an associated access policy. This policy needs your logic app's identity to provide the correct permissions for accessing the managed connector infrastructure. The included sample projects include an ARM template that includes all the necessary infrastructure resources, including these access policies.

The following diagram shows the dependencies between your logic app project and infrastructure resources:

Conceptual diagram showing infrastructure dependencies for a logic app project in the single-tenant Azure Logic Apps model.

Deploy logic app resources (zip deploy)

After you push your logic app project to your source repository, you can set up build and release pipelines either inside or outside Azure that deploy logic apps to infrastructure.

Build your project

To set up a build pipeline based on your logic app project type, complete the corresponding actions in the following table:

Project type Description and steps
Nuget-based The NuGet-based project structure is based on the .NET Framework. To build these projects, make sure to follow the build steps for .NET Standard. For more information, review the documentation for Create a NuGet package using MSBuild.
Bundle-based The extension bundle-based project isn't language-specific and doesn't require any language-specific build steps. You can use any method to zip your project files.

Important: Make sure that your .zip file contains the actual build artifacts, including all workflow folders, configuration files such as host.json, connections.json, and any other related files.

Before release to Azure

The managed API connections inside your logic app project's connections.json file are created specifically for local use in Visual Studio Code. Before you can release your project artifacts from Visual Studio Code to Azure, you have to update these artifacts. To use the managed API connections in Azure, you have to update their authentication methods so that they're in the correct format to use in Azure.

Update authentication type

For each managed API connection that uses authentication, you have to update the authentication object from the local format in Visual Studio Code to the Azure portal format, as shown by the first and second code examples, respectively:

Visual Studio Code format

{
   "managedApiConnections": {
      "sql": {
         "api": {
            "id": "/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/providers/Microsoft.Web/locations/westus/managedApis/sql"
      },
      "connection": {
         "id": "/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/ase/providers/Microsoft.Web/connections/sql-8"
      },
      "connectionRuntimeUrl": "https://xxxxxxxxxxxxxx.01.common.logic-westus.azure-apihub.net/apim/sql/xxxxxxxxxxxxxxxxxxxxxxxxx/",
      "authentication": {
         "type": "Raw",
         "scheme": "Key",
         "parameter": "@appsetting('sql-connectionKey')"
      }
   }
}

Azure portal format

{
   "managedApiConnections": {
      "sql": {
         "api": {
            "id": "/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/providers/Microsoft.Web/locations/westus/managedApis/sql"
      },
      "connection": {
         "id": "/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/ase/providers/Microsoft.Web/connections/sql-8"
      },
      "connectionRuntimeUrl": "https://xxxxxxxxxxxxxx.01.common.logic-westus.azure-apihub.net/apim/sql/xxxxxxxxxxxxxxxxxxxxxxxxx/",
      "authentication": {
         "type": "ManagedServiceIdentity",
      }
   }
}

Create API connections as needed

If you're deploying your logic app workflow to an Azure region or subscription different from your local development environment, you must also make sure to create these managed API connections before deployment. Azure Resource Manager template (ARM template) deployment is the easiest way to create managed API connections.

The following example shows a SQL managed API connection resource definition in an ARM template:

{
   "type": "Microsoft.Web/connections",
   "apiVersion": "2016–06–01",
   "location": "[parameters('location')]",
   "name": "[parameters('connectionName')]",
   "properties": {
      "displayName": "sqltestconnector",
      "api": {
         "id": "/subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/providers/Microsoft.Web/locations/{Azure-region-location}/managedApis/sql"
      },
      "parameterValues": {
         "authType": "windows", 
         "database": "TestDB",
         "password": "TestPassword",
         "server": "TestServer",
         "username": "TestUserName"
      }
   }
}

To find the values that you need to use in the properties object for completing the connection resource definition, you can use the following API for a specific connector:

GET https://management.azure.com/subscriptions/{Azure-subscription-ID}/providers/Microsoft.Web/locations/{Azure-region-location}/managedApis/{connector-name}?api-version=2016-06-01

In the response, find the connectionParameters object, which contains all the information necessary for you to complete resource definition for that specific connector. The following example shows an example resource definition for a SQL managed connection:

{
   "type": "Microsoft.Web/connections",
   "apiVersion": "2016–06–01",
   "location": "[parameters('location')]",
   "name": "[parameters('connectionName')]",
   "properties": {
      "displayName": "sqltestconnector",
      "api": {
         "id": "/subscriptions/{Azure-subscription-ID}/providers/Microsoft.Web/locations/{Azure-region-location}/managedApis/sql"
      },
      "parameterValues": {
         "authType": "windows",
         "database": "TestDB",
         "password": "TestPassword",
         "server": "TestServer",
         "username": "TestUserName"
      }
   }
}

As an alternative, you can capture and review the network trace for when you create a connection using the workflow designer in Azure Logic Apps. Find the PUT call that's sent to the connector's managed API as previously described, and review the request body for all the necessary information.

Release to Azure

To set up a release pipeline that deploys to Azure, follow the associated steps for GitHub, Azure DevOps, or Azure CLI.

Note

Azure Logic Apps currently doesn't support Azure deployment slots.

For GitHub deployments, you can deploy your logic app by using GitHub Actions, for example, the GitHub Actions in Azure Functions. This action requires that you pass through the following information:

  • The logic app name to use for deployment
  • The zip file that contains your actual build artifacts, including all workflow folders, configuration files such as host.json, connections.json, and any other related files.
  • Your publish profile, which is used for authentication
- name: 'Run Azure Functions Action'
  uses: Azure/functions-action@v1
  id: fa
  with:
   app-name: 'MyLogicAppName'
   package: 'MyBuildArtifact.zip'
   publish-profile: 'MyLogicAppPublishProfile'

For more information, review the Continuous delivery by using GitHub Action documentation.

After release to Azure

Each API connection has access policies. After the zip deployment completes, you must open your logic app resource in the Azure portal, and create access policies for each API connection to set up permissions for the deployed logic app. The zip deployment doesn't create app settings for you. So, after deployment, you must create these app settings based on the local.settings.json file in your local Visual Studio Code project.

Next steps

We'd like to hear about your experiences with the single-tenant Azure Logic Apps!