Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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
An Azure account and active subscription. Get a free account.
A SQL Server, Azure SQL Database, or Azure SQL Managed Instance and a database.
Configure the network and firewall rules to allow the Hybrid Logic Apps runtime to connect to the database. For Azure SQL, see Network access controls.
If you have SQL Express for local development, connect to the default named instance
localhost\SQLExpress.Follow the steps to set up your SQL environment in this article.
For local development, you need Visual Studio Code locally installed on your computer.
Note
Make sure to install the latest Azure Functions Core Tools and that you have SQL support by choosing the Microsoft Installer (MSI), which is
func-cli-X.X.XXXX-x*.msi. For more information about Visual Studio Code requirements, see Create Standard workflows in Azure Logic Apps with Visual Studio Code.
Set up your SQL environment
Before you set up SQL Storage Provider, confirm that you finished the required steps in the Prerequisites.
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, anddq. - 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.
- Create and delete the following schemas:
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.
In the Azure portal search box, enter
logic apps, and select Logic apps.On the Logic apps page toolbar, select Create.
On the Create Logic App page, under Standard, select Hybrid as the hosting option.
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:
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:
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.
Set up your development environment to work with single-tenant Azure Logic Apps.
Meet the prerequisites to work in Visual Studio Code with the Azure Logic Apps (Standard) extension.
Set up Visual Studio Code to work with the Azure Logic Apps (Standard) extension.
In Visual Studio Code, connect to your Azure account and create a blank logic app project.
In Visual Studio Code, open the Explorer pane, if not already open.
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.
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.
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.
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
In Visual Studio Code, open the Explorer pane, if not already open.
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.
If prompted, select the Azure subscription for your logic app deployment.
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.
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.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.
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.
Select the Connected Environment to use.
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.
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.
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:
In the Azure portal, open your logic app resource.
On the resource navigation menu, under Settings, select Configuration.
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.
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:
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: