Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In earlier parts of our Function Azure blog post series, we outlined the implementation of different artifacts of our research project on communication between the VSTS and LaunchDarkly with the Azure Function extensions.
In this one we will present how we have implemented continuous integration and deployment of our Azure Functions in Azure using Visual Studio Team Services.
Before we start talking about pipelines, a reminder of the composition of our Visual Studio solution.
Our solution consists of 4 projects
The code of this solution is maintained, stored and versioned in this GitHub repository.
Requirements
Before we create the build and release pipeline we need some requirements
Continuous integration (CI)
CI is the first DevOps practice.
Build steps
The build definition for our Azure Function deployment performs the following steps:
The build definition tasks are:
This build contains 4 main phases:
When the build is successful we get the following results:
With the build created and tested successfully we can proceed to the setup of our release definition.
To maintain consistency with the pipeline of our VSTS extensions (see a really cool feature we noticed on vsts new release definition editor) we named the release environments with the same names:
For each environment, the release process is:
The advantage of deploying to the sub slot first is that the code will not be deployed to the principal slot, if the integration tests fail.
Here’s the release environment:
![]() |
This task creates or update Azure resources using the ARM Templates (see azure function provisioning and configuring our azure function infrastructure) |
![]() |
Run the UpdateAppSettings.ps1 script (see azure function provisioning and configuring our azure function infrastructure) to update the “Integration Tests” Azure Function slot’s application settings |
![]() |
Deploy the Azure Function App code (the Zip produced by the build) in the “Integration tests” sub slot |
![]() |
Install Newman from package.json |
![]() |
Replace all tokens in data-tests.json with environment variables that contain the integration tests environment values(see azure function integration ests automation) |
![]() |
Run integration tests by executing the package.json script command : npm run testapi (see azure function integration tests automation).Tests will use the LaunchDarkly integration tests project created in requirementsThe test results will be exported in Junit Xml files. |
![]() |
Publish integration test results to VSTS.This task is configured to always publish test results even if the previous task of test execution failed. |
![]() |
Execute the UpdateAppSettings.ps1 (see azure function provisioning and configuring our azure function infrastructure) script to update the Azure Function Application Settings for the ‘production’ slot |
![]() |
Swap the content from “Integration Tests” slot to the ‘production’ Slot |
Early adopters and User environments are composed by the same task workflow. Different values between the environments are managed in the Release environment’s variables.
To manage the environment’s variables, use the “Process variables”:
To prevent unauthorized deployments to Production and add a level of security, we configured Approvals in the “Users” environment
When the release is successful we get the following result:
The Tests tab with the published test results from the integration tests/
We can drill into the logs on the timeline for Newman integration test results.
When an integration test fails, the logs will highlight the failure, and the “Publish Test Results” task will still run to publish the results to VSTS, as is shown below:
If the release went well, our Azure architecture described in the ARM Template will exist in our portal, with one Resource group for each environment.
The Azure Function App contains the Azure functions developed in our Visual Studio Solution and one sub slot named “Integration Tests”
So, we managed to deploy our Azure Functions in a DevOps pipeline with:
We’re approaching the end of our series of Azure Function posts. In the next and final post, we’re going to look at another pivotal DevOps practice - monitoring.
THANK YOU REVIEWERS: Niel Zeeman, Hamid Shahid
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in