Share via

How do I deploy an Azure Function App using Azure DevOps pipeline?

Smooth Dev 45 Reputation points
2025-10-28T12:33:57.62+00:00

Hi Team,

I’m new to Azure DevOps and trying to set up a CI/CD pipeline for my Azure Function App (written in Node.js / Python / .NET — I can specify the runtime if needed).

I have my Function App code in Azure Repos, and I want to:
Automatically build it when I push changes to the main branch.

Deploy it to an existing Function App in my Azure subscription.

Could someone please guide me with the correct steps or a sample YAML configuration for deploying an Azure Function App through Azure DevOps?

Also, do I need to create a separate Service Connection for this deployment?

Thank you!

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.

0 comments No comments

Answer accepted by question author

Anurag Rohikar 3,190 Reputation points Microsoft External Staff Moderator
2025-10-28T15:20:42.2333333+00:00

Hello Smooth Dev,

To deploy an Azure Function App using an Azure DevOps pipeline, follow these steps:

Step 1: Set Up the Azure DevOps Pipeline

  1. Create a new YAML pipeline linked to your Azure Repos repository containing the function app code.

Add the following YAML configuration to automate the build and deployment process. Here's an example for a Node.js Azure Function App:

trigger:
  branches:
    include:
      - main  # Triggers the pipeline when changes are pushed to the main branch

pool:
  vmImage: 'ubuntu-latest'  # Select VM image based on your environment

steps:
- task: UseNode@2  # For Node.js apps. Replace with Python or .NET task if needed
  inputs:
    versionSpec: '14.x'
    
- task: NodeTool@0  # Installs Node.js. Modify as needed for other runtimes.
  inputs:
    versionSpec: '14.x'
    
- task: Npm@1  # Installs dependencies for Node.js apps
  inputs:
    command: 'install'
    
- task: AzureFunctionApp@1  # Deploys the Azure Function App
  inputs:
    azureSubscription: 'Your-Service-Connection-Name'  # Replace with your service connection
    appType: 'functionAppLinux'  # Use 'functionAppWindows' if your app is Windows-based
    appName: 'Your-Function-App-Name'  # Your Azure Function App name
    package: '$(System.DefaultWorkingDirectory)/**/dist'  # Adjust this to match your app's output directory

Step 2: Service Connection Setup

You need a Service Connection for Azure DevOps to authenticate and deploy to Azure:

Go to Project Settings > Service Connections.

Click New Service Connection and choose Azure Resource Manager.

Select the appropriate authentication method (Service Principal or Managed Identity).

  1. Once created, reference this service connection in the azureSubscription field of the YAML.

Step 3: Commit and Push

After setting up your pipeline, commit the YAML file to your repository and push it to the main branch. The pipeline will automatically trigger on every push to main, build the app, and deploy it to your Azure Function App.

Documentation:

I hope this helps you get your CI/CD pipeline up and running. Let me know if you run into any issues or have further questions along the way. Thank you!

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.