New to Telerik UI for ASP.NET MVCStart a free 30-day trial

Telerik License Key in CI/CD Environment

Updated on Nov 11, 2025

This article describes how to set up and activate your Telerik UI for ASP.NET MVC license key across a few popular cloud build and deployment services. You can find guidance and examples on how to set environment variables for some of the most popular CI/CD platforms.

The deployment articles in this documentation provide general guidance and fundamentals. Telerik does not provide technical support for setting up CI/CD environments or application publishing infrastructure, except for questions about using Telerik license keys.

Basics

A Telerik license key is required during application build. During application deployment, this includes all steps that:

  • Build the app
  • Run unit tests
  • Publish the app

The Telerik license activation process in CI/CD test, build, staging, and production environments involves the following steps:

  1. Go to the License Keys page in your Telerik account and download your license key.
  2. Set an environment variable with either of the following names:
    • TELERIK_LICENSE—the value must be the Telerik license key string.
    • TELERIK_LICENSE_PATH—the value must be the full path to the license key file, including the license file name itself. TELERIK_LICENSE_PATH requires Telerik.Licensing version 1.4.9 and above.
  3. (optional) Fail the build and deployment if there is an issue with the license key.

In most cases, the recommended way to provide your license key to the Telerik.Licensing NuGet package in CI/CD environments is to use one of the available environment variables.

Treat the license key and the license file as secrets. Always store and retrieve them in a secure manner, according to the build platform's best practices.

Environment Variable Length Limitations

The Telerik license key size depends on the number of licenses it includes, including renewals. Some environments may have a limit on the environment variable size, which is smaller than your Telerik license key length. Such examples include:

  • Windows and Windows Server machines (up to 32,767 characters for all environment variables and much smaller limits for setting variables in the Registry or the system settings)
  • GitLab (up to 10,000 characters)

In such cases, use TELERIK_LICENSE_PATH or only a license file instead of TELERIK_LICENSE. The TELERIK_LICENSE_PATH variable must point to the Telerik license file location, including the telerik-license.txt file name itself. The license file must be stored and provided to the deployment pipeline in a secure manner.

Azure Pipelines

Azure Pipelines provides built-in tools to store and use secret environment variables and secure files. The recommended option with Classic pipelines is to download the Telerik license file as a secure file.

Use TELERIK_LICENSE

  1. Create a new secret variable. Also check the separate article Set Secret Variables.
  2. Paste the contents of the license key file as a value of the secret variable.
  3. Map the secret variable to a new environment variable named TELERIK_LICENSE.
  4. Use the TELERIK_LICENSE environment variable in the tasks, steps, or scripts that build and publish the ASP.NET MVC app. Classic pipelines may need to set an output variable to share and consume the license key in multiple steps.

Using a TELERIK_LICENSE environment variable in Azure Pipeline YAML

YAML
steps:

- task: VSBuild@1
  inputs:
    solution: '**/*.sln'
    platform: 'Any CPU'
    configuration: 'Release'
  env:
    TELERIK_LICENSE: $(Secret_Telerik_License_Key)

- task: VSBuild@1
  inputs:
    solution: '**/*.sln'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(Build.ArtifactStagingDirectory)"'
    platform: 'Any CPU'
    configuration: 'Release'
  env:
    TELERIK_LICENSE: $(Secret_Telerik_License_Key)

Use TELERIK_LICENSE_PATH

  1. Add a secure file and grant any necessary permissions to use it in the pipeline.
  2. Download the secure file in a task with a name. The secure file path is available to other tasks through the secureFilePath output.
  3. Set the TELERIK_LICENSE_PATH environment variable in all tasks, steps, or scripts that build and publish the ASP.NET MVC app.

Using a TELERIK_LICENSE_PATH environment variable in Azure Pipeline YAML

YAML
steps:

- task: DownloadSecureFile@1
  name: telerikLicense
  displayName: 'Download telerik-license.txt'
  inputs:
    secureFile: 'telerik-license.txt'

- task: VSBuild@1
  inputs:
    solution: '**/*.sln'
    platform: 'Any CPU'
    configuration: 'Release'
  env:
    TELERIK_LICENSE_PATH: $(telerikLicense.secureFilePath)

- task: VSBuild@1
  displayName: 'Publish'
  inputs:
    solution: '**/*.sln'
    msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(Build.ArtifactStagingDirectory)"'
    platform: 'Any CPU'
    configuration: 'Release'
  env:
    TELERIK_LICENSE_PATH: $(telerikLicense.secureFilePath)

GitHub Actions

To set up license key authentication in GitHub Actions:

  1. Create a new Repository Secret or an Organization Secret.
  2. Paste the contents of the license key file as a value of the GitHub secret.
  3. Assign the secret to an environment variable named TELERIK_LICENSE.
  4. Use the TELERIK_LICENSE environment variable in the steps, which build and publish the ASP.NET MVC app.

In a complete CI/CD workflow, you also need to set up NuGet package restoration authentication using TELERIK_NUGET_KEY. See Restoring NuGet Packages in Your CI Workflow for details.

Using a TELERIK_LICENSE environment variable in GitHub Actions

YAML
- name: Build Step
  run: msbuild ProjectName.sln /p:Configuration=Release /p:Platform="Any CPU"
  env:
    TELERIK_NUGET_KEY: ${{ secrets.Telerik_NuGet_Key }}
    TELERIK_LICENSE: ${{ secrets.Telerik_License_Key }}

- name: Publish Step
  run: msbuild ProjectName.sln /p:Configuration=Release /p:Platform="Any CPU" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation=publish
  env:
    TELERIK_LICENSE: ${{ secrets.Telerik_License_Key }}

Also see Using API Keys in the article Restoring NuGet Packages in Your CI Workflow. It shows how to use the TELERIK_NUGET_KEY environment variable in your CI build environment.

Docker

  1. Create a Docker build secret that holds the Telerik license key file.

    SH
      docker build --secret id=telerik-license-key,src=/path/to/telerik-license.txt .
  2. Mount the secret and set a TELERIK_LICENSE environment variable in the build container. The environment variable is required when building and publishing the Telerik UI for ASP.NET MVC app.

    SH
    RUN --mount=type=secret,id=telerik-license-key,env=TELERIK_LICENSE \
      msbuild "ProjectName.csproj" /p:Configuration=Release /p:Platform="Any CPU" /p:DeployOnBuild=true /p:PublishUrl=C:\app\publish

Abort Deployment on License Key Error

To avoid accidental license watermarks and notifications on your live site, you can fail the application build and abort deployment when there is an issue with the license key. There are multiple ways to list the Telerik license warning codes to be treated as errors:

  • Add а <TelerikLicensingStrict> tag to the .csproj project file. This approach requires Telerik.Licensing version 1.6.5 and above.

    XML
    <PropertyGroup>
      <TelerikLicensingStrict Condition="$(Configuration) == 'Release'">true</TelerikLicensingStrict>
    </PropertyGroup>
  • Add a <WarningsAsErrors> tag to the .csproj project file:

    XML
    <PropertyGroup>
        <WarningsAsErrors>TKL001;TKL002;TKL003;TKL004;TKL101;TKL102;TKL103;TKL104;TKL105</WarningsAsErrors>
    </PropertyGroup>
  • Set the -warnaserror MSBuild switch in the MSBuild command:

    SH
    msbuild ProjectName.csproj /p:WarningsAsErrors="TKL001;TKL002;TKL003;TKL004;TKL101;TKL102;TKL103;TKL104;TKL105"

Next Steps

See Also