How to Setup Azure DevOps CI/CD end-to-end for Python on Azure Function under 5 min?

How to Setup Azure DevOps CI/CD end-to-end for Python on Azure Function under 5 min?

This post lets us learn how we can set up an end-to-end Azure DevOps CI/CD Pipeline for Python applications running on Azure Function App. This could be one of the simplest and fastest ways to set up your complete Azure DevOps Project. It will set up CI/CD Pipeline, Provision all Azure Resource, and deploying a simple python code to Azure Function. We will set this up using Azure DevOps Starter Project.

Azure DevOps CI/CD for Python on Azure Function

To get started, Sign in to your Azure Subscription and select  DevOps Starter, and Create New Starter Project. By default, “GitHub” will be set as the default connection. . Change the Connection Settings to “Azure DevOps” from “GitHub“.

Related Tip: Switch DevOps Starter between Azure DevOps and GitHub Action – Daily .NET Tips (dailydotnettips.com)

Firstly, Select Python application.

Select Python Application for Azure Function Deployment

Secondly, choose “Simple Python App“, as application framework.

Thirdly, choose Azure Function App for deploying the application.

Finally, provide all the required information in the create service step, including Azure DevOps Project Name, Your Azure Subscription Name, and Function App Name. Then, Create the Project.

Create Azure DevOps Project, Azure Function App and CI/CD Setup

Honestly, that’s it. It’s as quick as it is.

The DevOps Starter Project will provision the Azure Function, Create the Azure DevOps Project, and set up the end-to-end CI/CD Pipeline. Following is the dashboard for Azure DevOps Starter Project.

Well, this dashboard speaks the volume of the heavy lifting work done in the backend. you can see, starting from creating Azure DevOps Project, CI/CD, Setting up Application Insights for Azure Function everything has been taken care of.

DevOps Starter Dashboard

Review The Dashboard and Resources

Navigate through the dashboard, and start from the project dashboard. The DevOps Project, with all the services configured for you.

Azure DevOps Dashboard

When you move to the “Repos” you will find the source code for a basic python http trigger pushed to Git.

Git code repository

The CI/CD Pipeline is completely configured, and it create a Stage called “Dev“. You can now extend it for other Stage.

Build and Release for Python and Azure Function

If you dig into the build definition, you can see exactly what has been configured as Build Task to deploy the code into Azure Function.

build definition for python

Open the Azure Function App, to view the deployed Code.

python running on azure function

Run the function and test it.

You can now configure your git source code to any of your favorite IDE, including Visual Studio Code, Visual Studio, and update and push the code. You don’t need to worry about anything else.

To summarize, the DevOps Starter project is beneficial to get started with setting up end to end CI/CD pipeline. For a complex project where deployment and build are more complex, this may not scale, but it will help you set up the complete project’s blueprint.

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

2 Comments to “How to Setup Azure DevOps CI/CD end-to-end for Python on Azure Function under 5 min?”

Comments are closed.