Trying to set up our first Static Web App in Azure, connecting it to our SQL Server in Azure, but struggling to get off the ground. When I add the "Database Connection (preview)" environment, it says
The database connection configuration file is missing from your repository.
In the Azure portal, we have 3 resources: SQL server, SQL database, and Static Web App.
I've created a dab-config.json, a SWA-4.database.config.json, and a staticwebapp.database.config.json. All 3 files are in my GitHub repository's root level. 3, because it's unclear to my untrained brain if the file prefix needs to match my Static Web App name, if it should just be staticwebapp., or if it should be dab-config.
All 3 JSON files have the same content
{
"$schema": "https://github.com/Azure/data-api-builder/releases/download/v1.2.14/dab.draft.schema.json",
"data-source": {
"database-type": "mssql",
"connection-string": "Server=tcp:REMOVED,1433;Initial Catalog=REMOVED;Persist Security Info=False;User ID=REMOVED;Password=REMOVED;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;",
"options": {
"set-session-context": false
}
},
"runtime": {
"rest": {
"enabled": true,
"path": "/api",
"request-body-strict": true
},
"graphql": {
"enabled": true,
"path": "/graphql",
"allow-introspection": true
},
"host": {
"cors": {
"origins": [],
"allow-credentials": false
},
"authentication": {
"provider": "StaticWebApps"
},
"mode": "production"
}
},
"entities": {
........ continued ..............
When I look at my GitHub Actions… one of the Static Web Apps workflows is successful, but the other two, Update dab-config.json and "ci: add Azure Static Web Apps workflow file" both give the same error
The content server has rejected the request with: BadRequest. Reason: No matching Static Web App was found or the api key was invalid."
Index.html
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-inline'">
<script src="/script.js"></script>
</head>
<button id="list" onclick="list()">List</button>
</html>
script.js
async function list() {
const response = await fetch('/data-api/rest/VirtuousAI_Matches');
const data = await response.json();
console.table(data.value);
}
At this point I'm completely unsure of which step I've messed up. Any help is appreciated




Output:


staticwebapp.database.config.jsonswa db init --database-type mssqlin local and usedab add Item -c "staticwebapp.database.config.json" --source dbo.ShoppingItems --permissions "anonymous:*". SO you see Data API will be accessed via<WEB APP URL>/data-api/rest/<ENTITY>staticwebapp.database.config.jsonconfiguration.