All Posts
2026-03-21

Deploying a Flask App to Azure App Service

Deploying a Flask App to Azure App Service

Milestone 1 — KodakCafe on Azure

Published: March 2026 | Tags: Azure, Flask, Python, Deployment, App Service

Overview

This guide walks through deploying a Python Flask web application to Azure App Service — from creating the hosting environment to getting your site live at your custom domain. This is Milestone 1 of building KodakCafe, a personal brand site covering photography, trading, technology, and more.

This is a real-world walkthrough including the errors and troubleshooting steps encountered along the way, so you know what to expect and how to handle it.

What You Will Build

  • A live Flask web application hosted on Azure App Service
  • Python 3.12 runtime on Linux (B1 Basic tier — ~$13/month)
  • A foundation ready for custom domain, SSL, CI/CD, and Blob Storage in future milestones
  • What You Need — Before You Start

    Make sure you have all of the following before beginning. This is your ingredient list — having everything ready avoids interruptions mid-setup.

    Background — What Is Azure App Service?

    If you come from an infrastructure background (VMware, vCenter, on-premises servers), here is how Azure App Service maps to what you already know:

    The key difference from VMware: Azure fully manages the underlying infrastructure. There is a Linux VM running underneath, but you never see the hypervisor, never patch the OS, and never worry about hardware failures. Azure handles restarts, failover, and scaling automatically.

    You can still access the Linux environment directly via SSH if needed — we cover that later in this guide.

    Choosing the Right App Service Plan

    Azure App Service offers several pricing tiers. Here is a comparison of the most relevant ones for a personal or small business site:

    Step 1 — Register Required Resource Providers

    Before creating any Azure resources, you need to register the resource providers for the services you plan to use. This is a one-time setup step that new Azure subscriptions often require.

    Navigate to your subscription in the Azure Portal and find Resource Providers:

    Figure 1 — Resource Providers list on your Azure Subscription

    Search for and register each of the following providers. Click the provider name, then click Register at the top:

  • Microsoft.Web
  • Microsoft.Compute
  • (needed for Blob Storage in Milestone 3)Microsoft.Storage
  • (needed for photo CDN in Milestone 3)Microsoft.Cdn
  • Wait for each provider to show status Registered before proceeding. This typically takes 1-2 minutes per provider.

    Step 2 — Create the App Service

    In the Azure Portal search bar, type App Services and click it.

    Figure 2 — Searching for App Services in the Azure Portal

    Click + Create → Web App. Fill in the form with these settings:

  • Azure subscription 1Subscription:
  • KodakcafeRG (create new if it does not exist)Resource Group:
  • kodakcafe (becomes kodakcafe.azurewebsites.net)Name:
  • CodePublish:
  • Python 3.12Runtime stack:
  • LinuxOperating System:
  • East USRegion:
  • Basic B1Pricing plan:
  • Figure 3 — Review + Create summary showing all settings correctly configured

    On the Database, Deployment, Networking, Monitor + Secure, and Tags tabs — leave all defaults. None of these are required for this setup. Go straight to Review + Create.

    Troubleshooting — Quota Error

    When you first attempt to create the App Service you may encounter this error:

    Figure 4 — Quota error: Operation cannot be completed without additional quota

    This is common with new Azure subscriptions. The error means your subscription has a limit of 0 Basic VMs allocated in that region. There are two ways to resolve it:

    Option A — Request a Quota Increase (Recommended)

    File a support request directly through the Azure Portal:

  • Navigate to: https://portal.azure.com/#create/Microsoft.Support
  • Select Issue Type: Service and subscription limits (quotas)
  • Select Quota Type: App Service
  • Follow the prompts to request Basic VM quota in your target region
  • Submit the request — Microsoft typically responds within 30 minutes for small quota increases
  • Figure 5 — Azure support ticket for quota increase

    Figure 6 — Ticket resolved and quota approved

    Option B — Try a Different Region

    If you need the site live immediately, try East US or West US 2 — these regions rarely have quota issues on new subscriptions. Note that switching regions after registering resource providers does not require re-registration.

    Step 3 — Verify the App Service

    Once the App Service is created, navigate to your KodakcafeRG resource group. You should see:

    Figure 7 — KodakcafeRG resource group showing the App Service Plan and App Service

    Click on KodakCafe (the App Service with the globe icon) to open the overview page:

    Figure 8 — App Service overview showing Status: Running, B1 plan, East US

    Confirm these values:

  • Status: Running
  • Pricing plan: B1
  • Operating System: Linux
  • Default domain: kodakcafe-[random].eastus-01.azurewebsites.net
  • Step 4 — Optional: Access the Linux Environment via SSH

    One of the questions that often comes up for infrastructure engineers is: can I actually get into this Linux server? Yes — two ways:

    Via Azure Portal

    In the App Service left menu, scroll down to Development Tools and click SSH. This opens a browser-based terminal directly into the container.

    Figure 9 — SSH menu option in the App Service left navigation

    Via Azure CLI

    az webapp ssh --name KodakCafe --resource-group KodakcafeRG

    Inside the container, your app files will live at /home/site/wwwroot/ once deployed. The environment runs Ubuntu Linux with Python 3.12 and Gunicorn pre-configured.

    Step 5 — Install Azure CLI on Your Mac

    The Azure CLI lets you deploy and manage your app from Terminal on your MacBook. Install it using Homebrew:

    Step 5a — Install Homebrew (if not already installed)

    Homebrew is the macOS package manager — equivalent to apt-get on Ubuntu or yum on RHEL. If you already have it, skip this step.

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

    Step 5b — Install Azure CLI

    brew install azure-cli

    Step 5c — Verify Installation

    az --version

    Figure 10 — Azure CLI version output confirming successful installation (v2.84)

    Step 6 — Log In to Azure via CLI

    Run the login command — this opens a browser window to authenticate with your Microsoft account:

    az login

    Figure 11 — Browser authentication prompt after running az login

    After signing in, confirm you are pointed at the correct subscription:

    az account show

    Figure 12 — az account show confirming the correct subscription and tenant

    Verify the output shows:

  • "name": "Azure subscription 1"
  • "state": "Enabled"
  • "isDefault": true
  • Step 7 — Prepare Your Site Files

    Navigate to the folder containing your KodakCafe site files:

    cd /Users/sashipoondi/Documents/MyProjects/kodakcafe

    Confirm the correct files are present:

    ls -la

    Figure 13 — Directory listing showing server.py, templates/, static/, posts/, requirements.txt

    Verify your requirements.txt contains the two required packages:

    cat requirements.txt

    Figure 14 — requirements.txt showing flask and gunicorn

    If you see any junk folders from zip extraction (like a folder named {templates,static), remove them first:

    rm -rf '{templates,static'

    Step 8 — Deploy to Azure

    Create a deployment zip file from your site folder, then push it to Azure:

    Step 8a — Create the Zip

    zip -r deploy.zip . --exclude "*.DS_Store" --exclude "__pycache__/*" --exclude "*.pyc" --exclude "deploy.zip"

    Step 8b — Deploy

    az webapp deploy --resource-group KodakcafeRG --name KodakCafe --src-path deploy.zip --type zip

    This takes approximately 60-90 seconds. You will see a series of status messages:

    Figure 15 — Successful deployment output showing "Site started successfully" and "Deployment has completed successfully"

    Look for these confirmation messages:

  • Build successful
  • Site started successfully
  • "status": "RuntimeSuccessful"
  • "numberOfInstancesSuccessful": 1
  • "errors": null
  • What You Built

    Open the URL from the deployment output in your browser. You should see your KodakCafe site loading live from Azure. Here is a summary of what is now running:

  • Azure App Service (B1 Linux) running Python 3.12 + Gunicorn in East US
  • KodakCafe Flask app deployed and serving traffic
  • Auto-restart enabled — if the app crashes, Azure brings it back automatically
  • Always-on — no cold start delays for visitors
  • Next Steps — Milestone 2

    The site is now live on Azure but accessible only via the azurewebsites.net URL. The next milestone covers:

  • Point kodakcafe.com DNS to your new Azure App Service IP
  • Add a custom domain binding in the App Service settings
  • Enable the free Azure-managed SSL certificate
  • Confirm the site loads at https://kodakcafe.com
  • Remove the old DDNS records pointing to the home server
  • Set up GitHub repository and CI/CD for automatic deployments
  • KodakCafe | kodakcafe.com | Technology & Azure Series

    ← All Posts