Tutorial: Deploy Python apps to Azure App Service on Linux from Visual Studio Code

This article walks you through using Visual Studio Code to deploy a Python application to Azure App Service on Linux using the Azure App Service extension.

If you encounter issues with any of the steps in this tutorial, we'd love to hear the details. Use the Having issues? Let us know. link at the end of each article to submit feedback.

For a demonstration video, see Build WebApps with VS Code and Azure App Service (youtube.com) from virtual PyCon 2020.

Note

If you prefer to deploy apps through the CLI, see Quickstart: Create a Python app in Azure App Service on Linux.

Tip

Azure App Service on Linux runs your source code in a pre-defined Docker container. That container runs apps with Python 3.7 using the Gunicorn web server. The characteristics of this container are described on Configure Python apps for App Service on Linux. The container definition itself is on the github.com/Azure-App-Service/python.

Configure your environment

Azure subscription

If you don't have an Azure subscription, sign up now for a free account with $200 in Azure credits to try out any combination of services.

Visual Studio Code, Python, and the Azure App Service extension

Install the following software:

Sign in to Azure

Once you've installed the Azure extension, sign into your Azure account by navigating to the Azure explorer, select Sign in to Azure, and follow the prompts. (If you have multiple Azure extensions installed, select the one for the area in which you're working, such as App Service, Functions, etc.)

Sign in to Azure through VS Code

After signing in, verify that Azure: Signed In" appears in the Status Bar and your subscription(s) appears in the Azure explorer:

Visual Studio Code status bar showing Azure account

Visual Studio Code Azure App Service explorer showing subscriptions

Note

If you see the error "Cannot find subscription with name [subscription ID]", this may be because you are behind a proxy and unable to reach the Azure API. Configure HTTP_PROXY and HTTPS_PROXY environment variables with your proxy information in your terminal:

# Windows
set HTTPS_PROXY=https://username:password@proxy:8080
set HTTP_PROXY=http://username:password@proxy:8080
# macOS/Linux
export HTTPS_PROXY=https://username:password@proxy:8080
export HTTP_PROXY=http://username:password@proxy:8080

Having issues? Let us know.