Azure DevOps to Deploy Azure Functions

  • Published
  • Posted in Azure
  • Updated
  • 4 mins read
  • Tagged as

Azure DevOps is a set of development tools and services provided by Microsoft to help teams plan, develop, test, and deliver software applications. It includes a wide range of features, including robust support for Continuous Integration (CI) and Continuous Deployment (CD) pipelines.

CI/CD features in Azure DevOps:

  1. Pipelines: Azure DevOps Pipelines is a feature that allows you to create, configure, and manage CI/CD pipelines for your applications
  2. Continuous Integration (CI): 
  • Builds: You can set up build pipelines to compile source code, run tests, and generate build artifacts. These pipelines automatically trigger when changes are pushed to your repository.
  • Testing: Azure DevOps supports integration with testing frameworks to automate unit tests, integration tests, and other types of testing.
  1. Continuous Deployment (CD):
  • Release Management: Azure DevOps allows you to define release pipelines that automate the deployment of your application to different environments such as development, staging, and production.
  • Deployment Strategies: You can implement various deployment strategies like rolling deployments, blue-green deployments, canary releases, etc., to minimize downtime and risk during deployments.
  • Environment Management: Easily create and manage different environments for your application, each with its own configurations and settings.
  1. Artifacts: Azure DevOps provides a built-in artifact repository for storing and versioning build artifacts, such as binaries, packages, and Docker images. These artifacts can be used in your release pipelines.
  2. Integration with Version Control: Azure DevOps integrates with popular version control systems like Git and TFVC (Team Foundation Version Control), allowing you to track changes, collaborate with team members, and manage your source code.

Steps to Deploy Azure Function using Azure DevOps

  1. create a Repository to save code that needs to be deployed. 
  2. commit your code to the newly created repo. 
  1. Now go to the Azure portal and search Function App. 
  2. Create a new function app with the required configuration, click on download the template for automation after filling details instead of creating it as we require only code for deployment. 
  3. Go to the repo and create a folder Named Infrastructure. 
  4. Upload the template and parameter file in that infrastructure folder. 
  5. We need to create a pipeline to build the resources present in our repo into a zip file to deploy it in another environment. 
    • Go to Pipelines and click on Create a new pipeline. Use the classic editor and search on the Azure function and select according to your language.
        
  6. In this example function app is coded in Python hence selecting Azure Function for Python 
  7. Selecting the Version of Python is important and should be according to the deployment version. 
  8. Enable the continuous deployment trigger  
  1. Rename the artifact according to your choice 
  1. Now click on save and check if the pipeline run is successful.  
  2. Go to Release and create a new release pipeline 
  3. Under the Artifacts sections we need to attach the build pipeline which will provide the zip file for deployment and Repo which will provide a file for azure function app resource deployment.

  1. Click on Stage 1 and Under Task click on the + icon. Search ARM template deployment 
  2. you need to create a service connection to deploy and access your resource group/subscription in which you want to deploy by going to project settings Under the section of the pipeline.  
  3. In the Azure Resource Manager connection select the service connection that you have created. 
  4. Create Variables if required. 
  1. Fill/select other details with your respective scope of deployment. In Template select the deployment JSON file from the artifact. In the Template parameter file select the respective parameter JSON file.  
  1. Override the parameters according to your requirements. 

  1. Search Azure Function app deployment task  
  1. In-App type you need to select Windows/Linux depending on your configuration. 
  1. Under Runtime stack select the appropriate language and version according to your deployment and build. 

  1. Under Application and Configuration Settings you can add app settings which would be used in code.  
  1. Now Enable the Continuous deployment trigger if you want a release for every build when the to be created for every change in repo for configure branch and click on save. 

 

Addend Analytics is a Microsoft Gold Partner based in Mumbai, India, and a branch office in the U.S.

Addend has successfully implemented 100+ Microsoft Power BI and Business Central projects for 100+ clients across sectors like Financial Services, Banking, Insurance, Retail, Sales, Manufacturing, Real estate, Logistics, and Healthcare in countries like the US, Europe, Switzerland, and Australia.

Get a free consultation now by emailing us or contacting us.