SWA CLI를 사용하여 정적 웹사이트를 생성, 구성 및 배포하며 선택적으로 서버리스 API 백엔드를 사용할 수 있습니다.
- GitHub 스타
- 41,038
- 파일
- 1
- 마지막 커밋
- 2026년 11월 11일
- 라이선스
- MIT
- 허용된 도구
- —
azure-static-web-apps skill은 무엇을 하나요?
azure-static-web-apps은(는) agent skill입니다. SWA CLI를 사용하여 정적 웹사이트를 생성, 구성 및 배포하며 선택적으로 서버리스 API 백엔드를 사용할 수 있습니다.
skill의 SKILL.md에서 생성된 요약입니다.
azure-static-web-apps skill 정보
개발자는 이 SKILL을 사용하여 서버리스 백엔드를 갖춘 정적 웹사이트를 배포하고 관리할 수 있습니다. 로컬 에뮬레이션부터 프로덕션 배포까지 Azure Static Web App의 전체 라이프사이클을 처리할 수 있도록 SWA CLI에 대한 액세스를 제공합니다. 사용자가 새 프로젝트를 초기화하거나, API 프록시가 포함된 로컬 개발 서버를 실행하거나, staticwebapp.config.json을 통해 라우팅 및 인증을 구성해야 할 때 에이전트가 이 도구를 로드해야 합니다.
이 SKILL은 swa init 명령어를 통해 프레임워크 감지를 자동화하며, 필요한 swa-cli.config.json 파일을 생성합니다. API 레이어로 Azure Functions를 통합할 수 있으며 MSSQL, PostgreSQL, CosmosDB를 포함한 다양한 데이터베이스 연결을 지원합니다. 사용자는 swa deploy를 사용하여 프로덕션 또는 프리뷰 환경으로의 배포를 관리할 수 있으며, GitHub Actions를 사용하여 자동화된 CI/CD 파이프라인을 구축할 수도 있습니다.
agent가 수행할 수 있는 작업
- 1새 프로젝트 초기화프론트엔드 프레임워크를 자동으로 감지하고 설정 파일을 생성하여 새로운 Static Web App 프로젝트를 설정합니다.
- 2로컬 에뮬레이터 실행호스팅 환경과 API 프록시를 시뮬레이션하는 로컬 개발 환경을 시작합니다.
- 3Azure에 배포빌드된 애플리케이션과 API를 Azure Static Web App 환경으로 푸시합니다.
- 4데이터베이스 연결PostgreSQL 또는 CosmosDB와 같은 백엔드 데이터베이스 연결을 구성합니다.
skill의 SKILL.md를 기반으로 작성되었습니다. 모든 사용 사례는 해당 문서의 인용구와 대조 확인되었습니다.
azure-static-web-apps skill 설치 방법
각 명령은 skill 폴더를 클라이언트의 skills 디렉터리에 복사합니다. 클라이언트를 재시작하거나 새 세션을 시작하여 로드하세요.Claude Code에 azure-static-web-apps skill 설치
~/.claude/skills/azure-static-web-apps/SKILL.md
$ npx degit github/awesome-copilot/skills/azure-static-web-apps ~/.claude/skills/azure-static-web-appsClaude Code (project)에 azure-static-web-apps skill 설치
.claude/skills/azure-static-web-apps/SKILL.md
$ npx degit github/awesome-copilot/skills/azure-static-web-apps .claude/skills/azure-static-web-appsCodex에 azure-static-web-apps skill 설치
~/.agents/skills/azure-static-web-apps/SKILL.md
$ npx degit github/awesome-copilot/skills/azure-static-web-apps ~/.agents/skills/azure-static-web-appsGemini CLI에 azure-static-web-apps skill 설치
~/.gemini/skills/azure-static-web-apps/SKILL.md
$ npx degit github/awesome-copilot/skills/azure-static-web-apps ~/.gemini/skills/azure-static-web-appsClaude.ai에 azure-static-web-apps skill 설치
npx degit github/awesome-copilot/skills/azure-static-web-apps azure-static-web-apps && zip -r azure-static-web-apps.zip azure-static-web-apps # claude.ai → Customize → Skills → + → Create skill → Upload a skill → azure-static-web-apps.zip
자동 검사
2026년 11월 15일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 보안 감사는 아닙니다. 에이전트가 실행하기 전에 스크립트를 읽어 보세요. 검사 방식
- 소스 저장소 연결 및 접근 가능github/awesome-copilot/skills/azure-static-web-apps is public and reachablegithub.com/github/awesome-copilot/tree/HEAD/skills/azure-sta ↗통과
- 오픈 소스 라이선스 (OSI)MITspdx.org/licenses/MIT.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit 2026-11-11github.com/github/awesome-copilot/commits ↗통과
- 스크립트에 다운로드 후 실행이나 자격 증명 탈취가 없음No scripts in the skill folder통과
- SKILL.md에 숨겨진 지침 없음No override phrases, safeguard switches, credential requests or hidden charactersgithub.com/github/awesome-copilot/blob/HEAD/skills/azure-sta ↗통과
- 사전 허용 도구가 제한됨No pre-approved tools; the agent asks before using onegithub.com/github/awesome-copilot/blob/HEAD/skills/azure-sta ↗통과
- SKILL.md가 Agent Skills 형식을 따름Valid name and description; says when to use it; 316 linesgithub.com/github/awesome-copilot/blob/HEAD/skills/azure-sta ↗통과
SKILL.md
GitHub에서 보기Overview
Azure Static Web Apps (SWA) hosts static frontends with optional serverless API backends. The SWA CLI (swa) provides local development emulation and deployment capabilities.
Key features:
- Local emulator with API proxy and auth simulation
- Framework auto-detection and configuration
- Direct deployment to Azure
- Database connections support
Config files:
swa-cli.config.json- CLI settings, created byswa init(never create manually)staticwebapp.config.json- Runtime config (routes, auth, headers, API runtime) - can be created manually
General Instructions
Installation
npm install -D @azure/static-web-apps-cli
Verify: npx swa --version
Quick Start Workflow
IMPORTANT: Always use swa init to create configuration files. Never manually create swa-cli.config.json.
swa init- Required first step - auto-detects framework and createsswa-cli.config.jsonswa start- Run local emulator athttp://localhost:4280swa login- Authenticate with Azureswa deploy- Deploy to Azure
Configuration Files
swa-cli.config.json - Created by swa init, do not create manually:
- Run
swa initfor interactive setup with framework detection - Run
swa init --yesto accept auto-detected defaults - Edit the generated file only to customize settings after initialization
Example of generated config (for reference only):
{
"$schema": "https://aka.ms/azure/static-web-apps-cli/schema",
"configurations": {
"app": {
"appLocation": ".",
"apiLocation": "api",
"outputLocation": "dist",
"appBuildCommand": "npm run build",
"run": "npm run dev",
"appDevserverUrl": "http://localhost:3000"
}
}
}
staticwebapp.config.json (in app source or output folder) - This file CAN be created manually for runtime configuration:
{
"navigationFallback": {
"rewrite": "/index.html",
"exclude": ["/images/*", "/css/*"]
},
"routes": [
{ "route": "/api/*", "allowedRoles": ["authenticated"] }
],
"platform": {
"apiRuntime": "node:20"
}
}
Command-line Reference
swa login
Authenticate with Azure for deployment.
swa login # Interactive login
swa login --subscription-id <id> # Specific subscription
swa login --clear-credentials # Clear cached credentials
Flags: --subscription-id, -S | --resource-group, -R | --tenant-id, -T | --client-id, -C | --client-secret, -CS | --app-name, -n
swa init
Configure a new SWA project based on an existing frontend and (optional) API. Detects frameworks automatically.
swa init # Interactive setup
swa init --yes # Accept defaults
swa build
Build frontend and/or API.
swa build # Build using config
swa build --auto # Auto-detect and build
swa build myApp # Build specific configuration
Flags: --app-location, -a | --api-location, -i | --output-location, -O | --app-build-command, -A | --api-build-command, -I
swa start
Start local development emulator.
swa start # Serve from outputLocation
swa start ./dist # Serve specific folder
swa start http://localhost:3000 # Proxy to dev server
swa start ./dist --api-location ./api # With API folder
swa start http://localhost:3000 --run "npm start" # Auto-start dev server
Common framework ports:
| Framework | Port |
|---|---|
| React/Vue/Next.js | 3000 |
| Angular | 4200 |
| Vite | 5173 |
Key flags:
--port, -p- Emulator port (default: 4280)--api-location, -i- API folder path--api-port, -j- API port (default: 7071)--run, -r- Command to start dev server--open, -o- Open browser automatically--ssl, -s- Enable HTTPS
swa deploy
Deploy to Azure Static Web Apps.
swa deploy # Deploy using config
swa deploy ./dist # Deploy specific folder
swa deploy --env production # Deploy to production
swa deploy --deployment-token <TOKEN> # Use deployment token
swa deploy --dry-run # Preview without deploying
Get deployment token:
- Azure Portal: Static Web App → Overview → Manage deployment token
- CLI:
swa deploy --print-token - Environment variable:
SWA_CLI_DEPLOYMENT_TOKEN
Key flags:
--env- Target environment (previeworproduction)--deployment-token, -d- Deployment token--app-name, -n- Azure SWA resource name
swa db
Initialize database connections.
swa db init --database-type mssql
swa db init --database-type postgresql
swa db init --database-type cosmosdb_nosql
Scenarios
Create SWA from Existing Frontend and Backend
Always run swa init before swa start or swa deploy. Do not manually create swa-cli.config.json.
# 1. Install CLI
npm install -D @azure/static-web-apps-cli
# 2. Initialize - REQUIRED: creates swa-cli.config.json with auto-detected settings
npx swa init # Interactive mode
# OR
npx swa init --yes # Accept auto-detected defaults
# 3. Build application (if needed)
npm run build
# 4. Test locally (uses settings from swa-cli.config.json)
npx swa start
# 5. Deploy
npx swa login
npx swa deploy --env production
Add Azure Functions Backend
- Create API folder:
mkdir api && cd api
func init --worker-runtime node --model V4
func new --name message --template "HTTP trigger"
- Example function (
api/src/functions/message.js):
const { app } = require('@azure/functions');
app.http('message', {
methods: ['GET', 'POST'],
authLevel: 'anonymous',
handler: async (request) => {
const name = request.query.get('name') || 'World';
return { jsonBody: { message: `Hello, ${name}!` } };
}
});
- Set API runtime in
staticwebapp.config.json:
{
"platform": { "apiRuntime": "node:20" }
}
- Update CLI config in
swa-cli.config.json:
{
"configurations": {
"app": { "apiLocation": "api" }
}
}
- Test locally:
npx swa start ./dist --api-location ./api
# Access API at http://localhost:4280/api/message
Supported API runtimes: node:18, node:20, node:22, dotnet:8.0, dotnet-isolated:8.0, python:3.10, python:3.11
Set Up GitHub Actions Deployment
- Create SWA resource in Azure Portal or via Azure CLI
- Link GitHub repository - workflow auto-generated, or create manually:
.github/workflows/azure-static-web-apps.yml:
name: Azure Static Web Apps CI/CD
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, closed]
branches: [main]
jobs:
build_and_deploy:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build And Deploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: upload
app_location: /
api_location: api
output_location: dist
close_pr:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: close
- Add secret: Copy deployment token to repository secret
AZURE_STATIC_WEB_APPS_API_TOKEN
Workflow settings:
app_location- Frontend source pathapi_location- API source pathoutput_location- Built output folderskip_app_build: true- Skip if pre-builtapp_build_command- Custom build command
Troubleshooting
| Issue | Solution |
|---|---|
| 404 on client routes | Add navigationFallback with rewrite: "/index.html" to staticwebapp.config.json |
| API returns 404 | Verify api folder structure, ensure platform.apiRuntime is set, check function exports |
| Build output not found | Verify output_location matches actual build output directory |
| Auth not working locally | Use /.auth/login/<provider> to access auth emulator UI |
| CORS errors | APIs under /api/* are same-origin; external APIs need CORS headers |
| Deployment token expired | Regenerate in Azure Portal → Static Web App → Manage deployment token |
| Config not applied | Ensure staticwebapp.config.json is in app_location or output_location |
| Local API timeout | Default is 45 seconds; optimize function or check for blocking calls |
Debug commands:
swa start --verbose log # Verbose output
swa deploy --dry-run # Preview deployment
swa --print-config # Show resolved configuration
이 스킬의 파일
1azure-static-web-apps skill 질문
Claude Code에 azure-static-web-apps skill을 어떻게 설치하나요?
npx degit github/awesome-copilot/skills/azure-static-web-apps ~/.claude/skills/azure-static-web-apps를 실행합니다. Claude Code는 ~/.claude/skills(모든 프로젝트) 또는 .claude/skills(한 프로젝트)에서 skills를 로드하며, 설명이 작업과 일치할 때 skill을 사용합니다.
azure-static-web-apps skill을 사용할 수 있는 클라이언트는 무엇인가요?
Agent Skills 형식을 읽는 모든 클라이언트(Claude Code, Codex, Gemini CLI, claude.ai(ZIP으로 업로드))가 사용할 수 있습니다. skill 내 스크립트는 클라이언트가 코드 실행을 허용하는 경우에만 실행됩니다.
새 SWA 프로젝트를 위한 설정 파일을 어떻게 만드나요?
swa init 명령어를 사용하여 프레임워크를 자동으로 감지하고 swa-cli.config.json 파일을 생성해야 합니다. 이 파일을 수동으로 직접 만들지 마세요.
런타임 설정을 위한 설정 파일을 수동으로 만들 수 있나요?
네, 앱 소스 또는 출력 폴더에 staticwebapp.config.json 파일을 수동으로 생성하여 라우팅, 인증 및 헤더를 관리할 수 있습니다.
클라이언트 측 라우트에서 발생하는 404 오류를 어떻게 해결하나요?
클라이언트 라우트의 404 오류를 해결하려면 staticwebapp.config.json 파일 내에 /index.html로 리라이트(rewrite)하는 navigationFallback을 추가하세요.