This beginner-friendly template deploys a Python web app and its supporting resources to Azure. It demonstrates the standard Azure Developer CLI (azd) workflow with readable application and infrastructure code.
Install Azure Developer CLI, then run:
azd init -t hello-azd-python
azd upazd up prompts for your Azure subscription and location, provisions the resources, builds the container remotely, and deploys the app.
- An Azure Container App running FastAPI
- An Azure Container Apps environment
- An Azure Container Registry
- An Azure Storage account with an
attachmentsblob container andticketstable - A user-assigned managed identity
- Identity-based Blob and Table Storage access
The application includes a ticket form, optional file attachments, and a table of submitted tickets. No storage keys or connection strings are used.
Important
The deployed demo is publicly accessible and doesn't require users to sign in. Don't submit sensitive or production data, and run azd down when you finish exploring the template.
azure.yamlmaps the Python project to the Container App and synchronizes resource endpoints for local development.infra/main.bicepcomposes the Azure resources and assigns access.infra/corecontains one focused Bicep module for each resource type.src/app/main.pydefines the FastAPI routes.src/app/storage.pyuses the Azure SDK withDefaultAzureCredential.src/app/templatesandsrc/app/staticdefine the server-rendered UI.
The postprovision hook writes the non-secret Storage endpoints to src/.env. Your Azure developer identity supplies authentication.
cd src
python -m venv .venvActivate the environment:
# Windows PowerShell
.\.venv\Scripts\Activate.ps1# macOS or Linux
source .venv/bin/activateInstall and run the app:
pip install -e .
uvicorn app.main:app --reloadOpen http://localhost:8000.
cd src
pip install -e ".[dev]"
ruff check .
ruff format --check .
pip-audit --requirement requirements.lockRuntime dependencies are pinned in src/requirements.lock. After changing dependencies in pyproject.toml, regenerate it from src:
python -m piptools compile --strip-extras --no-emit-index-url --output-file=requirements.lock pyproject.tomlDelete the Azure resources when you're finished:
azd down