Build Environment variables


Visual Studio App Center is scheduled for retirement on March 31, 2025. While you can continue to use Visual Studio App Center until it is fully retired, there are several recommended alternatives that you may consider migrating to.

Learn more about support timelines and alternatives.

Environment variables help manage your build script tasks. You can call pre-defined variables or create your own.

Pre-Defined variables

General variables Description
APPCENTER_BUILD_ID The unique identifier for the current build
APPCENTER_BRANCH Name of the branch that's being built from
APPCENTER_SOURCE_DIRECTORY Location of the source code on the build machine
APPCENTER_OUTPUT_DIRECTORY Location where the build results are stored in
APPCENTER_TRIGGER What triggered the build, was it manual or continuous by push

iOS specific
APPCENTER_XCODE_PROJECT Selected Xcode project
APPCENTER_XCODE_SCHEME Selected Xcode scheme

Android specific
APPCENTER_ANDROID_VARIANT Selected Android variant
APPCENTER_ANDROID_MODULE Selected Android module

UWP specific

Xamarin specific

React Native specific

Variables declared in Build Configuration

Custom environment variables allow you to define sensitive information that's required for your build without checking them into your repository. You can create your environment variables in the build configuration and use them in your build. For example, to access an API key, a webhook token, or other secrets.


'Platform' is reserved from use as an environment variable.

The build configuration showing custom environment variables in different states

Encrypting variables

Values of variables are encrypted by clicking on the lock icon, which obfuscates them in the build configuration & logs. Encrypted values aren't editable once they're saved, but they can be deleted & re-created.

Non-encrypted values can be encrypted at any time.

Access the variables

Pre-set environment variables can be consumed during the build process. Depending on the toolset you're using, the syntax is different.


The correct way to consume environment variables depends on the toolchain used.

Build scripts

In the build scripts, you can access the variables with the following syntax depending on whether you're using Bash or PowerShell.

  • Bash

  • PowerShell


NuGet.Config for Xamarin or UWP

If you're building a Xamarin or UWP app, you might want to connect to a private NuGet feed, which requires authentication. In the NuGet.Config file, you can consume the variables you've defined. For more details about the usage of credentials in your NuGet.Config file, read the reference documentation.

    <add key="Username" value="%USER_VARIABLE%" />
    <add key="ClearTextPassword" value="%PASSWORD_VARIABLE%" />

build.gradle (app level) for Android

For Android apps, you can access your variables in the build.gradle (app level) config. For more details, read the Gradle Tips and Recipes documentation.

buildConfigField("String", "API_KEY", "\"${System.env.API_KEY}\"")