fai-azure-static-web-apps-setup
/fai-azure-static-web-apps-setup
Set up Azure Static Web Apps with custom auth, staged preview environments, API backend linking, and route-level access control. Use when deploying frontend apps with serverless APIs, GitHub/Azure DevOps CI/CD, and role-based route protection.
Assessment and security
- Files in this package
- 3
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 1
No signals detected. Repository changed on 26.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Set up Azure Static Web Apps with custom auth, staged preview environments, API backend linking, and route-level access control. Use when deploying frontend apps with serverless APIs, GitHub/Azure DevOps CI/CD, and role-based route protection.
Original author description
Set up Azure Static Web Apps with custom auth, staged preview environments, API backend linking, and route-level access control. Use when deploying frontend apps with serverless APIs, GitHub/Azure DevOps CI/CD, and role-based route protection.
How it works
- When to Use
- Bicep Provisioning
- Route Configuration
- GitHub Actions Workflow
- Custom Domain + Edge Caching
- Troubleshooting
SKILL.md preview
---
name: fai-azure-static-web-apps-setup
description: |
Set up Azure Static Web Apps with custom auth, staged preview environments, API
backend linking, and route-level access control. Use when deploying frontend apps
with serverless APIs, GitHub/Azure DevOps CI/CD, and role-based route protection.
---
# Azure Static Web Apps Setup
Deploy frontend apps with serverless APIs, preview environments, and role-based routing.
## When to Use
- Deploying React, Next.js, or other SPA frameworks to Azure
- Setting up preview environments per pull request
- Connecting Azure Functions as API backend
- Configuring route-level auth with AAD or custom providers
---
## Bicep Provisioning
```bicep
resource swa 'Microsoft.Web/staticSites@2023-12-01' = {
name: swaName
location: location
sku: { name: 'Standard', tier: 'Standard' }
properties: {
repositoryUrl: repoUrl
branch: 'main'
buildProperties: {
appLocation: '/'
apiLocation: 'api'
outputLocation: 'out'
}
}
}
```
## Route Configuration
```json
{
"routes": [
{ "route": "/admin/*", "allowedRoles": ["admin"] },
{ "route": "/api/*", "allowedRoles": ["authenticated"] },
{ "route": "/*", "allowedRoles": ["anonymous"] }
],
"auth": {
"identityProviders": {
"azureActiveDirectory": {
"registration": { "openIdIssuer": "https://login.microsoftonline.com/{tenant}/v2.0",
"clientIdSettingName": "AAD_CLIENT_ID" }
}
}
},
"responseOverrides": {
"401": { "redirect": "/.auth/login/aad", "statusCode": 302 },
"403": { "rewrite": "/unauthorized.html" }
},
"navigationFallback": { "rewrite": "/index.html",
"exclude": ["/api/*", "/images/*", "/*.{css,js,png,svg}"] }
}
```
## GitHub Actions Workflow
```yaml
name: Deploy SWA
on:
push: { branches: [main] }
pull_request: { types: [opened, synchronize, closed], branches: [main] }
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.SWA_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: upload
app_location: /
api_location: api
output_location: out
```
## Custom Domain + Edge Caching
```bash
# Add custom domain
az staticwebapp hostname set --name $SWA --hostname app.example.com
# Configure cache headers in staticwebapp.config.json
# Already handled via globalHeaders
```
```json
{
"globalHeaders": {
"Cache-Control": "public, max-age=300",
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "DENY"
}
}
```
## Troubleshooting
| Issue | Cause | Fix |
|-------|-------|-----|
| Auth bypass on preview envs | Role rules not applied per route | Define routes in staticwebapp.config.json |
| API returns 404 | api_location mismatch in build config | Verify apiLocation matches Functions folder |
| Deploy fails on PR | Token not set for fork PRs | Use repository_dispatch or restrict to same-repo PRs |
| Stale cache after deploy | Aggressive cache-control | Use versioned asset filenames, set short max-age for HTML |
Files in this package (3)
- SKILL.lean.md 3 KB
- SKILL.md 3 KB
- agents/openai.yaml 1 KB
Versions
The database has no other skills named fai-azure-static-web-apps-setup.
Database snapshot: 13.11.2026 · package version 7d77876a39b6 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Similar skills
- 100azure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development, configuring staticwebapp.config.json, adding Azure Functions APIs to SWA, or setting up GitHub Actions CI/CD for Static Web Apps. - 85azure-static-web-apps
Expert knowledge for Azure Static Web Apps development including troubleshooting, decision making, limits & quotas, security, configuration, integrations & coding patterns, and deployment. Use when wiring SWA APIs to Azure DBs, configuring custom domains/DNS, auth/roles, CI/CD,… - 100azure-integrations
Azure deployment for web apps — Static Web Apps, App Service, Blob Storage, Bicep/ARM, GitHub Actions CI/CD. Use when deploying Next.js/Vite to Azure or configuring Azure resources for full-stack apps. - 100azure-devops
Set up Azure Pipelines for CI/CD, configure build and release pipelines, manage Azure DevOps projects, and integrate with Azure services. Use when working with Azure DevOps Services or Server for enterprise DevOps workflows. - 85azure-static-web-apps
Expert knowledge for Azure Static Web Apps development including troubleshooting, decision making, limits & quotas, security, configuration, integrations & coding patterns, and deployment. Use when wiring SWA APIs to Azure DBs, configuring custom domains/backends, Entra auth,… - 100azure-devops
Azure DevOps via Apideck's Proxy API + managed Vault auth — Apideck handles auth and proxies HTTP calls to Azure DevOps's native API. Use when the user wants to call Azure DevOps (no unified API resource mapping). Routes through Apideck with serviceId "azure-devops".