Python Appservice Deploy
MicrosoftOfficialCreated by Microsoft
- Skill
- Workflow
- Cloud and DevOps
- MIT
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured, idempotent workflow for deploying Python applications (Flask, Django, FastAPI) to Azure App Service on Linux. It handles the creation of necessary Azure resources—including Resource Groups, App Service Plans (P0v3), and Web Apps—while enforcing best practices like server-side builds and proper startup configuration. The process includes automated normalization of shell scripts to ensure compatibility and provides a reliable path for both standard CLI-based deployments and those utilizing Azure Developer CLI (azd) configurations.
What it does
- Automatically creates or validates Azure Resource Groups, App Service Plans, and Web Apps.
- Configures server-side builds via SCM_DO_BUILD_DURING_DEPLOYMENT.
- Normalizes Linux shell scripts to prevent line-ending issues during deployment.
- Sets appropriate startup commands for FastAPI applications.
- Packages the application code into a clean ZIP archive, excluding unnecessary files.
- Supports both standard Azure CLI and azd-based deployment workflows.
When to use it
- When you need to deploy a Python Flask, Django, or FastAPI application to Azure App Service Linux.
- When you want to automate the provisioning of the required Azure infrastructure alongside the code deployment.
- When you need a repeatable, error-checked deployment process for Python web apps.
- When you are working with a standard Python project structure and require a reliable deployment pipeline.
Advantages
- Reduces manual configuration by deriving sensible defaults for resource names and regions.
- Ensures cross-platform compatibility by normalizing line endings in scripts.
- Prevents common deployment failures through pre-packaging validation.
- Provides a consistent, idempotent approach to resource creation.
- Integrates seamlessly with existing Azure CLI and azd workflows.
Usage examples
- “Deploy my Flask app to Azure App Service.”
- The agent will prompt for an app name, then automatically create the necessary Resource Group, P0v3 Linux App Service Plan, and Web App, finally deploying the code.
- “Deploy my FastAPI project to Azure.”
- The agent will configure the Web App with the required uvicorn startup command and deploy the code to an Azure App Service Linux instance.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/microsoft/python-appservice-deploy/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip python-appservice-deploy.zip -d .agents/skills
Documentation by Microsoft
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
Prerequisite: Verify the latest stable Azure CLI; update with approval and recheck if needed.
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. Before creating a plan, invokeazure-quotasto check quota availability. 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 --enriched-errors true.STOP. Print the post-deploy message (post-deploy-message.md) and end the turn.
Hard rules
LINUX SCRIPTS — normalize selected shell/startup files to LF, then verify no CR bytes remain. Stop on normalization, validation or packaging failure; deploy only a fresh package.
DJANGO REMOTE BUILDS — require
STATIC_ROOTand successful system/collectstaticchecks before packaging.⛔ 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.
Files
- ATTRIBUTION.mdAdded by AutoGineer1004 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md3.2 KiB
- references/create-app.md6.2 KiB
- references/deploy-azcli.md6.8 KiB
- references/deploy-azd.md3.4 KiB
- references/detect.md3.6 KiB
- references/errors.md3.8 KiB
- references/post-deploy-message.md4.4 KiB
- references/startup-commands.md4.3 KiB
- references/transient-retry.md2.3 KiB
- scripts/generate-app-name.ps1Script1.7 KiB
- scripts/generate-app-name.shScript1.8 KiB
- scripts/retry-az-create.ps1Script2.1 KiB
- scripts/retry-az-create.shScript1.9 KiB
references/detect.md
Framework Detection (Advisory)
Framework detection is advisory only. The deployment never blocks because of an unknown framework.
What to check
Confirm Python project — at least one of:
requirements.txtpyproject.toml*.pyfiles in workspace root
Scan dependencies in
requirements.txtorpyproject.toml:
| Token (case-insensitive) | Detected framework |
|---|---|
flask, Flask | flask |
django, Django | django |
fastapi | fastapi |
gunicorn (alone, no flask) | wsgi-generic |
uvicorn (alone, no fastapi) | asgi-generic |
| None of the above | unknown |
Locate the WSGI / ASGI entry point (best-effort):
Flask common:
app.pyexportingapp,application.py,wsgi.pyDjango common:
<project>/wsgi.pyFastAPI common:
main.pyexportingapp
Record findings in your working memory so Step 5 (startup) can use them.
Outcomes
| Detection | Step 5 behavior |
|---|---|
flask | Skip startup auto-config. Oryx auto-detects Flask and starts it. |
django | Skip startup auto-config. Oryx auto-detects Django via wsgi.py and starts it. |
fastapi (any Python version) | Always auto-set startup: python -m uvicorn main:app --host 0.0.0.0 (replace main:app with the discovered entry point if different — e.g., app.main:app). The skill does not rely on Oryx FastAPI auto-detection. |
wsgi-generic, asgi-generic, unknown | Skip startup auto-config. Emit warning: "Could not auto-detect a supported framework (only Flask, Django, and FastAPI are auto-configured today). The app will deploy, but you may need to set the startup command manually: az webapp config set --startup-file '<your-command>'" |
Priority rule when both
flaskandfastapiappear inrequirements.txt(orpyproject.toml): always treat as FastAPI — set the explicit uvicorn startup command. This is deterministic and avoids relying on import-order or token-order heuristics. Rationale: Flask is happily auto-detected by Oryx with no startup command, but FastAPI requires the explicit uvicorn command to run reliably; if the project actually uses Flask as the served app, the user can override the startup command later, but if it uses FastAPI and we silently picked Flask, the container ping fails.
Important rules
⛔ Do not abort deployment when framework is unknown.
⛔ Do not try to install Flask, Django, or any framework into the user's project.
✅ Always report what was detected so the user has full context.
✅ When detection is
wsgi-generic,asgi-generic, orunknown, remember this fact for Step 8 — the post-deploy message must use the unknown-framework template in post-deploy-message.md, which adds an explicit "set a startup command" instruction. The Step 5 warning alone is not enough; the user needs the reminder at the end of the run too.
Example output to surface to the user
Detected: Flask (Python 3.14)
Entry point: app.py
Startup command will be auto-detected by Oryx — no startup command needed.or
Detected: Django (Python 3.14)
Entry point: <project>/wsgi.py
Startup command will be auto-detected by Oryx — no startup command needed.or
Detected: FastAPI (Python 3.14)
Entry point: main.py → app
Setting startup command (always set for FastAPI):
python -m uvicorn main:app --host 0.0.0.0or
Detected: Python project, framework unknown.
The app will deploy, but App Service may not start it correctly until
you set a startup command:
az webapp config set -n <app> -g <rg> --startup-file '<command>'
See startup-commands.md for examples.Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Python
Security
What our scanner noticed· Low risk
- Instructions that use the network
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Created by
- Microsoft
- Publisher
- Microsoft (Official)
- Source
- microsoft/skills · .github/plugins/azure-skills/skills/python-appservice-deploy · commit 0696600
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from .github/plugins/azure-skills/LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Also distributed in
- microsoft/azure-skills
AutoGineer is not affiliated with or endorsed by Microsoft or Microsoft.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download python-appservice-deploy.zip