Add variables to configurations and Intune Apps

  • Last update on September 27th, 2024

This guide shows how to add variables to configurations and Intune Apps.

The process involves:

  1. Create the configuration or Intune app in the baseline tenant
  2. Sync your baseline
  3. In the downstream tenant repository define the variable with the value you want to be replaced
  4. Sync the downstream tenant

Create the configuration or Intune app in the baseline tenant

For these steps you can follow this video tutorial:

Step 1: access DevOps

  • Access DevOps
     
  • Select the baseline tenant repository

Step 2: define the variable in the config.tenant.json file

  • From the main page, select “Tenants
     
  • In the sidebar menu, expand “Repos” > then, from the dropdown menu, select “Files
     
  • Expand the “Source” folder > then, expand the “Resources” folder
     
  • Select the config.tenant.json file
     
  • Click “Edit” on the top right of the screen

Step 3: adding the variables

Inside ResourceContext, add:

"VariableName": "PLACEHOLDER_VALUE" 

as shown here:

{
   "ResourceContext": {
       "M365Licenses": "[]",
       "VariableName": "PLACEHOLDER_VALUE"
   }
}

Remember that:

  • Variable values must be a minimum of 7 characters.
  • If you define multiple variables, you must include trailing commas.

Ensure the property that you want to variablize matches the property value as defined in the config.tenant.json file.

 

Step 4: commit

  • When done, click “Commit” in the top right of the screen
     
  • From the panel that opens, click “Commit

Sync your baseline

Sync your baseline

Define the variables in the downstream tenant

In the downstream tenant repository config.tenant.json file, define the variable with the value you want to be replaced as shown below:

{
   "ResourceContext": {
       "M365Licenses": "[]",
       "VariableName": "downstream tenant value"
   }
}

To do this, follow the same steps (or the video) that you previously followed to add variables to the baseline, but this time select your downstream tenant.

Sync your downstream tenant

Sync the downstream tenant and Approve to deploy the configuration. 

The configuration should deploy to the tenant and replace the variable with the value as defined in the tenant's config.tenant.json file.