Telerik License Key in CI/CD Environment
This article describes how to set up and activate your Telerik UI for Blazor license key across a few popular CI/CD services by using environment variables.
This documentation section applies to Telerik UI for Blazor version 8.0.0 and above. Older versions do not require a license key.
Basics
The Telerik license activation process in a CI/CD environment involves the following steps:
- Go to the License Keys page in your Telerik account and download your license key.
- Set your license key value as an environment variable with a name
TELERIK_LICENSE
. In specific cases you may need to use a license file instead.
Creating Environment Variables
The recommended way to provide your license key to the Telerik.Licensing
NuGet package in CI/CD environment is to use an environment variable. Each CI/CD platform has a different process for setting environment variables. This article lists only some of the most popular examples.
Azure Pipelines
- Create a new secret variable. Follow the respective producedure for your YAML, Classic, or CLI pipeline setup. Also check the separate article Set Secret Variables.
- Paste the contents of the license key file as a value of the secret variable.
- Map the secret variable to a new environment variable named
TELERIK_LICENSE
. - Use the
TELERIK_LICENSE
environment variable in the tasks, steps, or scripts that build and publish the Blazor 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
steps:
- task: DotNetCoreCLI@2
inputs:
command: 'build'
# ...
env:
TELERIK_LICENSE: $(Secret_Telerik_License_Key)
Another option is to use a Telerik license file as a secure file in the pipeline. Implement a script that copies the license file to the application's root folder, so that it's available to all projects that need it.
GitHub Actions
- Create a new Repository Secret or an Organization Secret.
- Paste the contents of the license key file as a value of the GitHub secret.
- Assign the secret to an environment variable named
TELERIK_LICENSE
. - Use the
TELERIK_LICENSE
environment variable in the steps, which build and publish the Blazor app:The resulting workflow steps may look similar to:YAMLenv: TELERIK_LICENSE: ${{ secrets.Telerik_License_Key }}
Also see Using NuGet Keys in the article Restoring NuGet Packages in Your CI Workflow. It shows how to use theYAML- name: Build Step run: dotnet build -c Release env: TELERIK_NUGET_KEY: ${{ secrets.Telerik_NuGet_Key }} TELERIK_LICENSE: ${{ secrets.Telerik_License_Key }} - name: Publish Step run: dotnet publish -c Release env: TELERIK_LICENSE: ${{ secrets.Telerik_License_Key }}
TELERIK_NUGET_KEY
environment variable in your CI build environment.
Docker
- 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 .
- 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 Blazor app.SHRUN --mount=type=secret,id=telerik-license-key,env=TELERIK_LICENSE \ dotnet publish BlazorProjectName.csproj -c Release -o /app/publish /p:UseAppHost=false
Using License File
Use a license file on Windows and Windows Server machines, which are managed directly through the operating system's user interface. Do not use an environment variable in these cases.