Access Artifact BuildNumber in Azure DevOps Release Pipeline

access_time 12 months ago visibility790 comment 0

It might be useful to push artifact or build variables to your Azure websites environment variables in Release pipelines. 

In this article, I'm going to show you how to add build number in Build pipeline to your Azure website when publishing using Release pipeline in Azure DevOps. For this website, the build number is also shown in page footer for reference. 

Available variables

Refer to the following link to find out the complete list of available environment variables that you can use in Release pipelines.

For build number, we will use this particular variable:


The build number or the commit identifier.

Azure pipelines example: 20170112.1

Jenkins/TeamCity example: 20170112.1

TFVC example: Changeset 3

Git example: 38629c964

GitHub example: 38629c964

Use variable

In Azure App Service Deploy task in my release job, update App settings in Application and Configuration Settings section to add the following value:


This step will add an environment variable named KONTEXT_BUILD_NUMBER to my ASP.NET Core application settings when doing the deployment.

Please note 'Starlink-ASP.NET Core-CI' is the artifact alias for my website build artifact. You need to replace it accordingly to your own artifact alias. 

Run the release pipeline

And then you can run the release pipeline. In the output logs, you can see the application settings is added. 

2019-12-01T11:16:31.9073238Z ##[section]Starting: Azure App Service Deploy: kontext
2019-12-01T11:16:31.9280133Z ==============================================================================
2019-12-01T11:16:31.9280240Z Task         : Azure App Service deploy
2019-12-01T11:16:31.9280327Z Description  : Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby
2019-12-01T11:16:31.9280408Z Version      : 4.157.4
2019-12-01T11:16:31.9280454Z Author       : Microsoft Corporation
2019-12-01T11:16:31.9280535Z Help         :
2019-12-01T11:16:31.9280606Z ==============================================================================
2019-12-01T11:16:32.6839383Z Got service connection details for Azure App Service:'kontext'
2019-12-01T11:16:33.9921958Z Updating App Service Application settings. Data: {"WEBSITE_RUN_FROM_PACKAGE":"1"}
2019-12-01T11:16:34.5066167Z Updated App Service Application settings and Kudu Application settings.
2019-12-01T11:16:42.2346930Z Package deployment using ZIP Deploy initiated.
2019-12-01T11:16:47.2178269Z Successfully deployed web package to App Service.
2019-12-01T11:16:47.2181086Z Updating App Service Application settings. Data: {"KONTEXT_BUILD_NUMBER":"20191201.2"}
2019-12-01T11:16:59.4388373Z Updated App Service Application settings and Kudu Application settings.
2019-12-01T11:17:00.0648701Z App Service Application URL:
2019-12-01T11:17:00.0730976Z ##[section]Finishing: Azure App Service Deploy: kontext

Check the application settings in Azure App Service

In Azure portal, you can also find the new settings in Settings > Configurations > Application Settings


Build number is just one of the artifact variables that you can use in release pipelines and you can use any other available variables in your Release pipelines. You can also configure this in pipeline yml file instead of using the Classic UI.

If you want to use the environment variables in PowerShell, the naming will be slightly different. For example, the build number environment name for my artifact is:


To save your time, you can find all the available environment variable names in Initialize Job step in your release pipeline as the following screenshot shows:

info Last modified by Raymond at 12 months ago copyright This page is subject to Site terms.
Like this article?
Share on

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts

Want to publish your article on Kontext?

Learn more

Kontext Column

Created for everyone to publish data, programming and cloud related articles.
Follow three steps to create your columns.

Learn more arrow_forward

More from Kontext

local_offer Azure local_offer python local_offer spark local_offer pyspark

visibility 7011
thumb_up 1
access_time 2 years ago

The page summarizes the steps required to run and debug PySpark (Spark for Python) in Visual Studio Code. Install Python from the official website: . The version I am using is 3.6.4 32-bit. Pip is shipped together in this version. Download Spark 2.3.3 from ...

local_offer Azure local_offer power-bi

visibility 2232
thumb_up 1
access_time 3 years ago

Microsoft Azure provides a number of data analytics related products and services. It allows users to tailor the solutions to meet different requirements, for example, architecture for modern data warehouse, advanced analytics with big data or real time analytics. The following diagram shows a ...

local_offer kontext local_offer Azure

visibility 19
thumb_up 0
access_time 11 months ago

From release v0.6.0, Kontext website now runs from a package (zip file) in Azure App Services. This ensures storage (incl. database storage, blob storage for uploaded files) is separated from the application and the application itself is read-only.  In Azure DevOps release pipelines, it can ...

About column

Data analytics, application development with Microsoft Azure cloud platform.

rss_feed Subscribe RSS