Azure, Cloud Computing

3 Mins Read

Automate Azure Function Deployments by Setting up Azure Pipelines

Introduction

Serverless computing has answered many requirements like reducing administration of production workloads, refactoring an application into different individual independent functionalities, massively scaling with minimal downtime, and delivering quick services without the need to manage servers. Azure Function is a serverless offering from Azure, which supports different programming languages and various sources for the trigger.

Prerequisites

  1. An active Azure subscription for creating a function app
  2. A GitHub repository with the code to deploy
  3. An Azure DevOps Organization, if you do not have any, you can create one for free

  • Cloud Migration
  • Devops
  • AIML & IoT
Know More

Steps to create a Function App

  1. Login to your Azure portal and Search for Function Apps. Click on create new.
  2. Give required fields like subscription, resource group, Function app name, runtime stack, and storage accounts.
  3. Wait till the deployment process is completed, once done click on Go to resource

Steps to create a Pipeline into the Function App

1. Go to your Azure DevOps Organization and create a new project.

2. You need to create a service connection that stores your credentials for azure pipelines to connect with your Azure.

3. Go to project settings at the bottom of the navigation bar. Select service connection under pipelines. Click on new service connection → Azure resource manager → Service Principle(auto) → Under subscription scope gives your details and save it.

4. You can add the variables with the variable group in the library under pipelines which can be referenced inside the pipeline YAML file. You can add your Function App name as a variable and reference it while adding the deployment stage.

5. Go inside the project and navigate to pipelines and click on create a pipeline. Select GitHub and select repository, then it will ask you to authenticate your GitHub account. Select configure as starter pipeline.

6. You can add the different stages for build, test, and deployment. For each stage, you can define a job to run on a specific agent with steps required according to your application. Use the assistant showing on the right side for adding tasks like building the application, archiving the files, publishing the artifact to the pipeline, downloading the artifact from the building, deploying the application to the function app, etc.

7. You can use the Azure Functions template in the assistant to add your target function deployment step as a task

8. Once the YAML is ready click on Save and run, give a commit message, and run the pipeline. It will push the YAML file into the specified repository and trigger the pipeline to run
9. Verify that the pipeline job ran successfully and go inside and click on jobs to trace the tasks as it runs

10. Verify the deployment from the function app or get the function URL and verify through the browser

If you want to know more about Infrastructure-as-Code Pipelines in Azure here.

Conclusion

Based on your application and the DevOps tools you use, you can select among the wide variety of deployment strategies available in Azure DevOps. Azure DevOps can be extended to different target resources, and you can leverage the templates in your YAML. A proper Service Connection is required for the pipeline to authenticate to Azure.

Get your new hires billable within 1-60 days. Experience our Capability Development Framework today.

  • Cloud Training
  • Customized Training
  • Experiential Learning
Read More

About CloudThat

CloudThat is the official AWS (Amazon Web Services) Advanced Consulting Partner, Microsoft Gold Partner, Google Cloud Partner, and Training Partner helping people develop knowledge of the cloud and help their businesses aim for higher goals using best-in-industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Explore our consulting here.

If you have any queries regarding Azure and Azure Functions drop a line below the comments section. I will get back to you at the earliest.

FAQs

1. What is an agent in Azure DevOps?

ANS: – An agent is an Infrastructure for computational needs for running the jobs during pipeline execution. You can use Microsoft-hosted agents to reduce your management workload or Self-hosted agents to gain more control over the agent.

2. What is a parallel Job?

ANS: – A Pipeline can contain any number of jobs. Each job runs as a parallel job on separate agents, and if all parallel jobs are consumed, then the remaining jobs will queue up and run one after the other.

WRITTEN BY Dharshan Kumar K S

Dharshan Kumar is a Research Associate at CloudThat. He has a working knowledge of various cloud platforms such as AWS, Microsoft, ad GCP. He is interested to learn more about AWS's Well-Architected Framework and writes about them.

Share

Comments

    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!