Skip to content
Skills Library
DevOps & cloud · Building & coding

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.

Repository
frootai ↗
Licence
MIT
Last repository change
26.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 26.10.2026, without references to retired models or APIs.

Licence

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

  1. When to Use
  2. Bicep Provisioning
  3. Route Configuration
  4. GitHub Actions Workflow
  5. Custom Domain + Edge Caching
  6. Troubleshooting
Original SKILL.md headings · 111 lines, 345 words
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

: harmful content, incorrect descriptions or an author’s removal request.

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".

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.