Design e UI Fonte oficial
Deploy de Python no Azure App Service Linux
Automatiza o deploy de aplicações Flask, Django, FastAPI ou Python genérico no Azure App Service Linux.
Ver código no GitHub Instala diretamente do repositório-fonte.
O que esta skill faz
Esta skill conduz o deploy de código Python no Azure App Service Linux, criando grupo de recursos, plano e Web App quando necessário. Ela escolhe entre azd e Azure CLI, configura build e define o startup específico do FastAPI.
Quando usar
- Publicar uma aplicação Flask no App Service
- Fazer deploy de um projeto Django em Linux
- Configurar o startup de uma API FastAPI
- Usar azure.yaml em um deploy com azd
Como usar
- Revise o repositório, as dependências e o framework Python utilizado
- Defina o nome da aplicação e confirme assinatura, região e recursos derivados
- Escolha o fluxo com azd quando houver azure.yaml compatível ou use Azure CLI
- Crie ou reutilize os recursos e configure o build durante o deploy
- Publique o código e verifique inicialização e logs da aplicação
O que revisar antes de instalar
- É destinada ao Azure App Service Linux e a aplicações Python
- Não cobre Container Apps, Functions, Terraform, Bicep ou infraestrutura completa
- VNet, Key Vault e bancos de dados devem ser tratados pelo fluxo azure-prepare
- O startup automático não é definido para aplicações Python genéricas
SKILL.md
--- name: python-appservice-deploy description: "Deploy Python (Flask/Django/FastAPI) code to Azure App Service Linux. WHEN: \"Flask App Service\", \"Django App Service\", \"FastAPI App Service\", \"deploy Python to App Service\". DO NOT USE FOR: Container Apps, Functions, non-Python, Terraform/Bicep/IaC, full infra — use azure-prepare." license: MIT metadata: author: Microsoft version: "1.0.1" --- # Python on Azure App Service — Code Deploy Deploys Python (Flask, Django, FastAPI, generic) code to Azure App Service Linux (P0v3, Python 3.14). Creates RG + Plan + Web App if missing. Hand off to `azure-prepare` for VNet, Key Vault, databases, or IaC. **MCP tools used**: `mcp_azure_mcp_subscription_list`, `mcp_azure_mcp_group_list`, `mcp_azure_mcp_appservice`, `mcp_azure_mcp_azd` (when `azure.yaml` is present). ## Workflow 1. **Resolve context — smart defaults, minimal prompts.** Only the app name is interactive; RG (`<app>-rg`), Plan (`<app>-plan`), region (current `az` default or `eastus2`), subscription are derived. [create-app.md](references/create-app.md) §1. 2. **Detect framework** (advisory, never blocks). [detect.md](references/detect.md). 3. **Choose path** — `azure.yaml` host: appservice → [deploy-azd.md](references/deploy-azd.md); else [deploy-azcli.md](references/deploy-azcli.md). 4. **Ensure RG → Plan (`P0v3 --is-linux`) → Web App (`--runtime "PYTHON:3.14"`)** exist. On transient ARM errors, follow [transient-retry.md](references/transient-retry.md). [create-app.md](references/create-app.md). 5. **Set startup** — Flask/Django: none (Oryx auto-detects). FastAPI: always `python -m uvicorn main:app --host 0.0.0.0`. Other: warn. [startup-commands.md](references/startup-commands.md). 6. **Set `SCM_DO_BUILD_DURING_DEPLOYMENT=true`**. 7. **Deploy** — `azd deploy` or `az webapp deploy --type zip --track-status false`. 8. **STOP. Print the post-deploy message** ([post-deploy-message.md](references/post-deploy-message.md)) and end the turn. ### Hard rules - ⛔ **NO POST-DEPLOY VERIFICATION** — after deploy returns, do not run `az webapp log tail`, `curl`, `Invoke-WebRequest`, or any health probe. App Service needs 2–3 min to warm; a quiet log or early 5xx is not failure. - ⛔ **SHELL SAFETY** — for `--runtime` always use `"PYTHON:3.14"` (colon). Never `"PYTHON|3.14"` (pipe is a shell operator). - ⛔ **NEVER `az webapp up`** — deprecated. Use Step 7 commands. - ✅ **URL FORMAT** — present endpoints as `https://...` URLs. ## Error Handling See [errors.md](references/errors.md) for the full symptom → cause → fix matrix. Quick triage: missing plan/app → re-run Step 4; container ping timeout on 8000 → fix startup (Step 5); `ModuleNotFoundError` after deploy → ensure Step 6 ran, redeploy.