Overview
This guide will show you how to create an Azure AD App, configure a Federated Credential, and configure env zero to utilize OIDC. The federated credential within the Azure AD app will be configured to accept env zero’s OIDC token. Refer to OIDC Integrations for more background on env zero’s OIDC configuration.This guide configures a v2 OIDC credential (the recommended format), where the federated credential audience is
api://AzureADTokenExchange. See Token versions for background. If you already authenticate to Azure with a v1 credential (audience set to https://prod.env0.com), see Migrating an existing v1 credential below.Azure AD App + Federated Credential
The Azure AD App will be configured with a Federated Credential to accept the env zero OIDC token. Using the Azure Portal:- Microsoft Entra ID > App registrations > ”+ New Registration”
- Enter Name: e.g., “env zero OIDC app”
- Select Supported account types if you’re unsure, choose “Single tenant”
- Skip Redirect URI
- Register the app.
- Under the “env zero OIDC app” > “Certificates and Secrets” > “Federated credentials”
- “+ Add credential”
- Federated Credential Scenario - Other issuer
- Issuer -
https://login.app.env0.com/ - Subject Identifier -
auth0|xxxxxx(see the section below on “Retrieving your Subject Identifier”) - Name - enter a name (e.g., “env0 OIDC”)
- Audience -
api://AzureADTokenExchange
- For using the Azure Provider in Terraform, we need to specify the following variables:
ARM_TENANT_ID- you can find the value in your app registration summary (“env zero OIDC app”) under “Directory (tenant) ID”ARM_CLIENT_ID- you can find the value in your app registration summary (“env zero OIDC app”) under “Application (client) ID”ARM_SUBSCRIPTION_ID- You can retrieve the Subscription ID from the Azure Subscription, or in a Resource Group that you want to use.
api://AzureADTokenExchange is Microsoft’s recommended audience for the public Azure cloud. Sovereign and government clouds (for example, Azure Government or Azure China) may require a different value. Consult Microsoft’s workload identity federation documentation for the value that applies to your cloud.Azure AD App Permissions
In order for Terraform to be able to deploy and manage the resources, we need to associate your Azure AD App with your Subscription or Resource Group- In this example, I will give the “env zero OIDC app” the “Contributor” role in my “sales-acme-demo” resource group. This means that env zero will only be able to create and manage resources within this resource group.
- Go to the Resource Group (”sales-acme-demo”) > Access Control (IAM)
- Click on “+ Add” > “Add role assignment”\

- Select a role (the level of privilege to give to Terraform) - in this case, we choose “Contributor” and hit “Next”
- Assign access to “User, group, or service principal”
- Select a member by “+ Select Members”
- Search for “env zero OIDC app” and hit “Select”
- Hit “Review + assign”\

Configure env0 OIDC Credential
Go to the organization’s credentials page and create a new deployment credential. SelectAzure OIDC type and enter the following fields:
Subscription ID- Azure subscription idTenant ID- Azure tenant idClient ID- Azure client id- Use v2 OIDC token - check this box so env zero mints a token with the
api://AzureADTokenExchangeaudience configured on the federated credential above. The form shows the resultingAudience (aud)value. Leaving it unchecked produces a v1 token (aud: https://prod.env0.com), which the federated credential will reject.

Assign your Credential in your Project
After creating your Organization Credential - don’t forget to go into your Project Settings to use the OIDC credential you just created.Deploying to multiple Azure Subscriptions
Sometimes you want to deploy to multiple Azure Subscriptions in one Terraform workspace. In Terraform / OpenTofu, you can specify multiple azure provider blocks to target multiple subscriptions, see example below:Terraform / OpenTofu (hcl)
Migrating an existing v1 credential
If you already authenticate to Azure with a v1 env zero OIDC credential, your federated credential audience ishttps://prod.env0.com. Moving to v2 means changing that audience to api://AzureADTokenExchange.
- Update the federated credential audience. In Microsoft Entra ID > your app > “Certificates and Secrets” > “Federated credentials”, edit the env zero federated credential and change the Audience from
https://prod.env0.comtoapi://AzureADTokenExchange. If the portal does not let you edit the audience, delete the credential and recreate it with the new audience (keep the same Issuer and Subject Identifier). - Enable v2 on the credential. Immediately after, edit the Azure OIDC credential in env zero and check Use v2 OIDC token. The next deployment mints a token with
aud: api://AzureADTokenExchange.
Next steps
- Retrieve OIDC Subject Identifier - Find the subject identifier for your OIDC token.
- OIDC for AWS - Set up OIDC for AWS as an alternative cloud provider.
- OIDC for GCP - Set up OIDC for Google Cloud Platform.