Hello Amir,
I have listed troubleshooting information below to help you with your Azure SQL Database:
- Root cause: In Azure Static Web Apps, don’t attach Azure SQL during creation. Create the Static Web App first, then link your database from Settings > Database connection. If Azure SQL looks unavailable there, it’s typically a provider registration, SQL server networking, tenant policies, or cloud/region.
- Fix flow:
- Link after creation: Open your Static Web App > Settings > Database connection > Link existing database.
- Register provider:
az provider register --namespace Microsoft.Sql
az provider list --query "[?namespace=='Microsoft.Sql']" --output table
- SQL networking: On your SQL Server, enable public access, add your client IPv4 (for local dev), and check “Allow Azure services and resources to access this server.” Private endpoint-only setups are not supported by SWA database connections today.
- Supported type: Use Azure SQL Database (PaaS). Managed Instance/private-only isn’t supported by SWA database connections.
- Tenant policies/region: If your org enforces private endpoints or you’re in a sovereign cloud, the option can be disabled.
Azure SQL tutorial:
https://learn.microsoft.com/azure/static-web-apps/database-azure-sql
https://learn.microsoft.com/azure/static-web-apps/database-overview
Configuration:
https://learn.microsoft.com/azure/static-web-apps/database-configuration
Let me know if you have other questions. Also, if this was helpful, please mark this as an "Answer" as this helps the community find relevant information.
Best regards,
Andrew Taylor