Generated banner for Python Appservice Deploy
Generated logo for Python Appservice Deploy

Python Appservice Deploy

MicrosoftOfficialCreated by Microsoft

  • Skill
  • Workflow
  • Cloud and DevOps
  • MIT
  • Low risk
  • Has scripts

From the author

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.
— the description by Microsoft

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

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/microsoft/python-appservice-deploy/download
  2. Unzip 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.

  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 §1.

  2. Detect framework (advisory, never blocks). detect.md.

  3. Choose path — azure.yaml host: appservice → deploy-azd.md; else deploy-azcli.md.

  4. Ensure RG → Plan (P0v3 --is-linux) → Web App (--runtime "PYTHON:3.14") exist. Before creating a plan, invoke azure-quotas to check quota availability. On transient ARM errors, follow transient-retry.md. 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.

  6. Set SCM_DO_BUILD_DURING_DEPLOYMENT=true.

  7. Deploy — azd deploy or az webapp deploy --type zip --track-status false --enriched-errors true.

  8. 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_ROOT and successful system/collectstatic checks 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 --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 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

references/errors.md

Troubleshooting

Quick diagnosis flow

Deploy failed?
  ├─ Check `az webapp log tail` first
  ├─ Then `az webapp log deployment list` for build-time errors
  ├─ Then `az webapp config show` to verify runtime + startup
  └─ For `Connection reset` / `429` / `502-504` on create commands,
      see [transient-retry.md](transient-retry.md)

Symptom → Cause → Fix

SymptomLikely causeFix
Container ... didn't respond to HTTP pings on port: 8000Wrong/missing startup command, or app bound to 127.0.0.1Set startup to bind 0.0.0.0:8000 (startup-commands.md)
ModuleNotFoundError: No module named 'flask' (or any dep)Build skipped, deps not installedaz webapp config appsettings set --settings SCM_DO_BUILD_DURING_DEPLOYMENT=true then redeploy
gunicorn: command not foundgunicorn missing from requirements.txtAdd gunicorn>=21 to requirements, redeploy
Deploy returns 202 but site still shows default pageAsync deploy not finishedWait, or re-run with --track-status true to make the CLI block until completion; check az webapp log deployment list
OperationNotAllowed: ... requires the plan to be LinuxPlan was created as WindowsRecreate plan with --is-linux (create-app.md)
Resource group '<rg>' could not be foundRG missingaz group create -n <rg> -l <region>
An app with name '<app>' already existsGlobal name collisionPick a different name (App Service host names are globally unique)
az webapp up shown in user's notesDeprecated commandReplace with az webapp create + az webapp deploy --type zip
azd up provisions Container Apps instead of App Serviceazure.yaml host isn't appserviceEither fix the template's host: or fall back to az CLI path
Deployment hangs in "Building..."Oryx pip install failing on native depsRun az webapp log deployment list -n <app> -g <rg> to find the deployment ID, then az webapp log deployment show -n <app> -g <rg> --deployment-id <id>; pin known-good versions in requirements
401 / unauthorized on deployaz login expired or wrong subscriptionaz login + az account set -s <sub>
LinuxFxVersion shows DOCKER|...Web app was created as custom containerRecreate with --runtime "PYTHON:3.14" (colon form is shell-safe)

Where logs live

⚠️ Prereq for az webapp log tail on a fresh app: filesystem logging must be enabled, otherwise the stream stays empty. Run once after the app is created:

az webapp log config -n <app> -g <rg> \
  --application-logging filesystem \
  --web-server-logging filesystem \
  --level information
az webapp log config -n <app> -g <rg> `
  --application-logging filesystem `
  --web-server-logging filesystem `
  --level information

az webapp log deployment list/show and az webapp log download do not require this — they read from a different store.

LogCommand
Live streamaz webapp log tail -n <app> -g <rg>
Deployment historyaz webapp log deployment list -n <app> -g <rg>
Deployment detailsaz webapp log deployment show -n <app> -g <rg> --deployment-id <id>
Full log downloadaz webapp log download -n <app> -g <rg>

When to hand off to azure-prepare

Hand off (and stop) if the user needs:

  • VNet integration, private endpoints, or Front Door

  • Key Vault references for app settings

  • A database (Cosmos DB, PostgreSQL, MySQL, SQL)

  • Multiple environments with Bicep/Terraform-managed infra

  • A non-App-Service target (Container Apps, Functions, AKS)

Tell the user clearly: "This deployment goes beyond a code push — azure-prepare will build the full infrastructure plan."

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