Saturday, May 2, 2026

Deploying Your Flask Application with Ease: A Step-by-Step Guide Using Microsoft Azure

 Summary: 

This articles works perfectly. simple steps. check in api file to Git. add requirements.txt file . Trigger build using git actions. It works perfectly.

I have created deployment from Azure portal i.e after creating web app I have attached git repo for deployment to this web app. If requirements.txt is good it deploys flash api to azure web app without any issues.

Deploying applications to the cloud requires choosing suitable services and understanding the deployment process. In this tutorial, we’ll focus on deploying a Python-based Flask application to Azure using Azure App Service.

Step 1: Setting Up Your Flask Application

  1. Create Your Flask Application: Start by building your Flask application. Ensure that the main file is named application.py for compatibility during deployment on Azure. This is crucial for maintaining data integrity in a cloud infrastructure.
  2. Go to your Github and change the name of adding another file with application.py Note: You might get errors when you have more than one file with py extension.
Press enter or click to view image in full size

Step 2: Azure Portal Setup

  1. Sign In/Sign Up on Azure Portal: https://portal.azure.com/

If you haven’t already, sign up for an Azure account. You can opt for a student subscription or use the free subscription for the first year.

2. Accessing App Services:

Navigate to the Azure portal and locate “App Services.” and click on “Create” to start the process of creating a new service.

Press enter or click to view image in full size

Step 3: Confugure your Web App

  1. Choose “Web App” among the options.

2. Select your subscription and create a new resource group (if needed).

3. Fill in the instance name, select the “code” option, choose the Python version, and leave other settings as default.

Get Johnas Chami’s stories in your inbox

Join Medium for free to get updates from this writer.

4. Proceed to the “databases” section and maintain default settings and then skip ahead to the “deployments” section.

Press enter or click to view image in full size

Step 4: Confuguring GitHub Actions

  1. Enable GitHub Actions settings and link your GitHub account.

2. Choose the repository and branch for deployment and skip other settings, review your configurations, and proceed with the deployment creation.

3. After deployment, a GitHub workflow file will be generated in your repository.

Step 5: Checking Deployment Status

  1. Access the created resource and note the default domain address.

2. Give some time for the deployment to complete as the model is still in the deployment phase.

Press enter or click to view image in full size

3. Monitor your deployment with GitHub Actions. Go to your GitHub repository and navigate to GitHub Actions and observe the step-by-step progress of your application’s deployment.

Press enter or click to view image in full size

Step 6: Verifying Successful Deployment

  1. Check GitHub Actions to ensure both build and deployment phases are successful.

2. Note the time taken for the deployment process.

Final Step:

  1. Accessing the deployed application: Use the default domain provided to access your deployed application.
Press enter or click to view image in full size
  1. Verify that your Flask application is running as expected.
Press enter or click to view image in full size

Congratulations! You’ve successfully deployed your Flask application to Azure using Azure App Service. This process leverages GitHub Actions for smooth integration and provides a reliable cloud environment for your Python-based ML prediction model.

No comments:

Post a Comment

Deploying Your Flask Application with Ease: A Step-by-Step Guide Using Microsoft Azure

  Summary:  This articles works perfectly. simple steps. check in api file to Git. add requirements.txt file . Trigger build using git actio...