Static Web App Database Connection Issue

Alan Davis 0 Reputation points
2025-12-08T15:00:36.7633333+00:00

I have been using an Azure Static Web App with a DB Connection to an Azure SQL server which it appears is being / has been retired - what do I need to do to get this to continue to work?

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Golla Venkata Pavani 165 Reputation points Microsoft External Staff Moderator
    2025-12-08T16:22:15.31+00:00

    Hii Alan,

    Thank you reaching us regarding the issue.

    It sounds like you're facing some challenges with your Azure Static Web App's database connection due to the retirement of the current feature. Here’s what you should consider to keep your app functioning properly:
    Steps to Continue Using Database Connections:

    1. Configuration File: Ensure that you have a staticwebapp.database.config.json file in your configuration folder. This file is essential for database connections. The default folder name is swa-db-connections, but if you've configured a different name, make sure it aligns with your data_api_location in the build workflow file.
    2. Database Type: If you're using Azure Cosmos DB, you need to reference a staticwebapp.database.schema.gql file within your configuration. This schema file must define your database's structure.
    3. Migration: Since the Azure Static Web Apps database connection feature will be retired on November 30, 2025, it's recommended to migrate to a self-hosted Data API builder instance on Azure Container Apps.
    4. Local Development: If you're developing locally, you can use the Azure Static Web Apps CLI to manage your database connections. Make sure to start the CLI correctly by using the --data-api-location option pointing to your configuration folder.
    5. Post-Migration Support: If you have issues specific to configuring or developing with the Data API builder post-migration, consider reaching out to the Data API Builder GitHub forum for assistance.

    Reference:
    https://learn.microsoft.com/en-us/azure/static-web-apps/database-overview
    https://learn.microsoft.com/en-us/azure/static-web-apps/database-azure-sql?tabs=bash&pivots=static-web-apps-rest#configure-the-static-web-app
    https://learn.microsoft.com/en-us/azure/data-api-builder/overview

    Kindly let us know if the above comment helps or you need further assistance on this issue.
    Please "upvote" if the information helped you. This will help us and others in the community as well.


  2. Adam Zachary 2,025 Reputation points
    2025-12-08T20:49:14.4466667+00:00

    I ran into this change with one of my customers not long ago.

    Azure quietly retired the old Static Web App “built-in database connection” preview feature, so anything that relied on that older model will stop working.

    You’ll need to move to a proper API layer. The current, supported approach is to connect your Static Web App to Azure SQL through an API built in Azure Functions or Azure App Service, using managed identity or a normal connection string. Once we switched to that model, everything worked again.

    In short, the old DB connection feature is gone. You just need to replace it with an API that handles the SQL calls securely and directly.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.