Edit

Set up SQL database storage for Hybrid Logic Apps

Applies to: Azure Logic Apps (Standard)

SQL as a storage provider is supported only for Hybrid Logic Apps. It isn't supported for regular Azure-hosted Logic Apps Standard, including the Workflow Service Plan and App Service Environment v3 options. For Hybrid deployment requirements, see Set up your own infrastructure for Standard logic apps for hybrid deployment.

Runtime-managed SQL schema

When the Hybrid Logic Apps runtime starts, it validates and initializes the database schema required for workflow execution. The runtime manages its database objects and persisted workflow state, including runs, actions, triggers, jobs, subscriptions, and runtime metadata. You manage the SQL Server infrastructure, including its availability, capacity, backups, security, and maintenance.

Important

Don't manually create, change, rename, or drop runtime-managed tables, indexes, stored procedures, or other database objects unless Microsoft Support explicitly directs you to do so.

SQL Server maintenance

You manage SQL Server availability, capacity, backups, security, and maintenance. Follow your organization's SQL Server operations practices, including these recommendations:

  • Monitor database and transaction log capacity. Plan storage and compute for expected workflow volume and concurrency, and alert before capacity limits are reached.
  • Configure backups and disaster recovery to meet your recovery objectives. Regularly verify backups and test restores.
  • Monitor CPU, memory, I/O latency, transaction log throughput, connectivity, blocking, and deadlocks. SQL responsiveness affects workflow-state persistence and retrieval.
  • Run supported database integrity checks and review statistics and index health. Don't alter or remove runtime-managed objects.
  • Coordinate database maintenance or failover with the application maintenance window. Afterward, verify connectivity and confirm that workflow processing has resumed.

For performance benchmarking guidance, see Hybrid Logic Apps - SQL as storage provider benchmarking.

Prerequisites

Set up your SQL environment

  1. Before you set up SQL Storage Provider, confirm that you finished the required steps in the Prerequisites.

  2. Set up permissions for your SQL server.

    SQL Storage Provider currently supports SQL authentication through connection strings. You can also choose Windows Authentication for local development and testing. At this time, support for Microsoft Entra ID and managed identities isn't available.

    The identity in the connection string must have permission to initialize and manage the runtime schema in the target database.

    The runtime uses the connection string to create and manage these objects:

    • Create and delete the following schemas: dt, dc, and dq.
    • Add, alter, and delete tables in these schemas.
    • Add, alter, and delete user-defined table types in these schemas.

    For more information about targeted permissions, see SQL server permissions in the Database Engine.

    Important

    Treat the SQL connection string as a secret. Store and manage it securely, for example, by using Azure Key Vault and Key Vault references in app settings.

  3. Connect to your SQL server and database.

    Verify that the Hybrid Logic Apps runtime and any development environment can connect to the SQL server. Configure network access for the runtime's network path; allowing Azure services alone might not permit the connection.

Set up SQL during creation in the Azure portal

When you create a Hybrid Logic App, you can set up SQL as its storage provider. Don't select the Workflow Service Plan or App Service Environment v3 hosting options for SQL storage.

  1. In the Azure portal search box, enter logic apps, and select Logic apps.

    Screenshot shows the Azure portal search box with logic apps entered and selected category named Logic apps.

  2. On the Logic apps page toolbar, select Create.

  3. On the Create Logic App page, under Standard, select Hybrid as the hosting option.

  4. On the Basics tab, enter your subscription, resource group, and logic app name, then select the connected environment and region for your Hybrid deployment.

    The following example shows the Basics tab with the Hybrid hosting option:

    Screenshot shows the Create Logic App page with the Hybrid hosting option selected.

  5. Select Next: Storage and provide the following information:

    Property Required Value
    SQL connection string Yes <sql-connection-string>. SQL authentication is supported. The portal doesn't validate the connection string.
    Host name Yes <host-name>. The fully qualified domain name or IP address of the Server Message Block (SMB) server for artifacts.
    File share path Yes <file-share-path>. The file share path and any subfolders for artifacts.
    User name Yes <host-user-name>. Use <domain>\<username> or <username> if the domain is localhost.
    Password Yes <host-user-password>. The password used to access the host.

    The following example shows the Storage tab for the Hybrid option:

    Screenshot shows the Storage tab for the Hybrid option.

  6. Finish creating the Hybrid Logic App. For more information, see Create Standard workflows for hybrid deployment on your own infrastructure.

When you're done, your Hybrid Logic App uses your SQL database as its runtime storage provider.

Set up SQL for local development in Visual Studio Code

The following steps show how to configure SQL for local development and testing in Visual Studio Code. This local configuration doesn't mean SQL storage is supported for a regular Azure-hosted Logic Apps Standard deployment; SQL storage is supported only for Hybrid Logic Apps.

  1. Set up your development environment to work with single-tenant Azure Logic Apps.

    1. Meet the prerequisites to work in Visual Studio Code with the Azure Logic Apps (Standard) extension.

    2. Set up Visual Studio Code to work with the Azure Logic Apps (Standard) extension.

    3. In Visual Studio Code, connect to your Azure account and create a blank logic app project.

  2. In Visual Studio Code, open the Explorer pane, if not already open.

  3. In the Explorer pane, at your logic app project's root, move your mouse pointer over any blank area under the project's files and folders, open the shortcut menu, and select Use SQL storage for your logic app project.

    Screenshot shows Visual Studio Code, Explorer pane, and mouse pointer at project root in blank area, opened shortcut menu, and selected option for Use SQL storage for your logic app project.

  4. When the prompt appears, enter your SQL connection string. You can choose a local SQL Express instance or any other SQL database that you have.

    Screenshot shows SQL connection string prompt.

    After confirmation, Visual Studio Code creates the following setting in your project's local.settings.json file. You can update this setting at any time.

    Screenshot shows logic app project and open file named local.settings.json with SQL connection string setting.

Set up SQL during Hybrid deployment from Visual Studio Code

You can publish your logic app project from Visual Studio Code to a Hybrid Logic App. SQL storage isn't supported when you deploy to a regular Azure-hosted Logic Apps Standard resource.

  • If you're publishing your project as a new Hybrid Logic App and want SQL as the storage provider, enter your SQL connection string when you publish your app. For complete steps, see Set up SQL for a new Hybrid Logic App deployment.

  • If you already set up your SQL settings, you can publish your logic app project to an existing Hybrid Logic App. This action overwrites your existing logic app.

    Note

    Use Local SQL Express for local development and testing. It isn't a storage provider for regular Azure-hosted Logic Apps Standard.

Set up SQL for a new Hybrid Logic App deployment

  1. In Visual Studio Code, open the Explorer pane, if not already open.

  2. In the Explorer pane, at your logic app project's root, move your mouse pointer over any blank area under the project's files and folders, open the shortcut menu, and select Deploy to logic app.

  3. If prompted, select the Azure subscription for your logic app deployment.

  4. From the list that Visual Studio Code opens, make sure to select the advanced option for Create new Logic App (Standard) in Azure Advanced. Otherwise, you're not prompted to set up SQL.

    Screenshot shows selected deployment option to create new Standard logic app in Azure Advanced.

  5. When prompted, enter a globally unique name for your new logic app, which is the name for the Standard logic app resource. This example uses Fabrikam-Workflows-App.

    Screenshot shows prompt for a globally unique name for your logic app.

  6. Select the connected environment for your own infrastructure and choose Hybrid as the hosting plan type. SQL storage isn't supported for the Workflow Standard or App Service Plan hosting options.

  7. When you're prompted for an Azure resource group, for optimal performance, select the same Azure resource group as your project for your deployment.

    Note

    Although you can create or choose a different resource group, doing so might affect performance. If you create or choose a different resource group, but cancel after the confirmation prompt appears, your deployment is also canceled.

  8. Select the Connected Environment to use.

  9. When prompted to select a storage provider for your Hybrid Logic App, select the SQL option and provide the required SQL connection string and artifact file share settings.

  10. At the SQL storage confirmation prompt, select Yes. At the connection string prompt, enter your SQL connection string.

    Note

    Make sure that you enter a correct connection string because Visual Studio Code doesn't validate this string for you.

    Screenshot shows Visual Studio Code and SQL connection string prompt.

  11. Finish the remaining deployment steps for your Hybrid Logic App.

When you're done, your Hybrid Logic App uses your SQL database as its runtime storage provider.

Validate deployments

After you deploy your Hybrid Logic App, check whether your settings are correct:

  1. In the Azure portal, open your logic app resource.

  2. On the resource navigation menu, under Settings, select Configuration.

  3. On the Configuration pane, under Application settings, find the Workflows.Sql.ConnectionString app setting, and confirm that your SQL connection string appears and is correct.

  4. In your SQL environment, confirm that the Hybrid Logic Apps runtime initialized its required schema and tables.

The runtime manages these database objects. Don't change or remove them manually.

For example, the following screenshot shows tables created by the Hybrid Logic Apps runtime:

Screenshot shows SQL tables created by the Hybrid Logic Apps runtime.

The Hybrid Logic Apps runtime also creates user-defined table types. For example, the following screenshot shows user-defined table types created by the runtime:

Screenshot shows SQL user-defined table types created by the Hybrid Logic Apps runtime.