Python on Azure App Service — Code Deploy skill
Deploy Python (Flask/Django/FastAPI) code to Azure App Service Linux.
by microsoft·MIT license·★ 1,532 Stars on the repo·GitHub ↗
npx degit microsoft/azure-skills/skills/python-appservice-deploy#main ~/.claude/skills/python-appservice-deployChecked ·commit main
Files of Python on Azure App Service — Code Deploy
Show the full text37 lines
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
- Resolve context — smart defaults, minimal prompts. Only the app name is interactive; RG (
<app>-rg), Plan (<app>-plan), region (currentazdefault oreastus2), subscription are derived. create-app.md §1. - Detect framework (advisory, never blocks). detect.md.
- Choose path —
azure.yamlhost: appservice → deploy-azd.md; else deploy-azcli.md. - Ensure RG → Plan (
P0v3 --is-linux) → Web App (--runtime "PYTHON:3.14") exist. On transient ARM errors, follow transient-retry.md. create-app.md. - 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. - Set
SCM_DO_BUILD_DURING_DEPLOYMENT=true. - Deploy —
azd deployoraz webapp deploy --type zip --track-status false. - STOP. Print the post-deploy message (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
--runtimealways 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 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.
| 1 | |
| 2 | name python-appservice-deploy |
| 3 | 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." |
| 4 | license MIT |
| 5 | metadata |
| 6 | author Microsoft |
| 7 | version "1.1.1" |
| 8 | |
| 9 | |
| 10 | # Python on Azure App Service — Code Deploy |
| 11 | |
| 12 | 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. |
| 13 | |
| 14 | **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). |
| 15 | |
| 16 | ## Workflow |
| 17 | |
| 18 | **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] §1. |
| 19 | **Detect framework** (advisory, never blocks). [detect.md]. |
| 20 | **Choose path** — `azure.yaml` host: appservice → [deploy-azd.md]; else [deploy-azcli.md]. |
| 21 | **Ensure RG → Plan (`P0v3 --is-linux`) → Web App (`--runtime "PYTHON:3.14"`)** exist. On transient ARM errors, follow [transient-retry.md]. [create-app.md]. |
| 22 | **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]. |
| 23 | **Set `SCM_DO_BUILD_DURING_DEPLOYMENT=true`**. |
| 24 | **Deploy** — `azd deploy` or `az webapp deploy --type zip --track-status false`. |
| 25 | **STOP. Print the post-deploy message** ([post-deploy-message.md]) and end the turn. |
| 26 | |
| 27 | ### Hard rules |
| 28 | |
| 29 | ⛔ **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. |
| 30 | ⛔ **SHELL SAFETY** — for `--runtime` always use `"PYTHON:3.14"` (colon). Never `"PYTHON|3.14"` (pipe is a shell operator). |
| 31 | ⛔ **NEVER `az webapp up`** — deprecated. Use Step 7 commands. |
| 32 | ✅ **URL FORMAT** — present endpoints as `https://...` URLs. |
| 33 | |
| 34 | ## Error Handling |
| 35 | |
| 36 | See [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. |
| 37 |
Discussion
Alternatives
Browse more free Claude skills or everything in Development.