Skip to main content
Use Microsoft Entra workload identity federation to exchange a Trigger.dev OIDC token for an Entra access token. Your tasks authenticate as an app registration with no AZURE_CLIENT_SECRET or client certificate stored anywhere. Follow the OIDC prerequisites, then go to the OIDC page for your environment and copy the issuer URL and subject.

Configure Azure

  1. Register an app in Microsoft Entra ID, or reuse one, and grant it access to the Azure resources your task uses (for the example below, the Storage Blob Data Reader role on a storage account).
  2. In the app registration, open Certificates & secrets, select the Federated credentials tab, select Add credential, and choose the Other issuer scenario. Fill in the federated identity credential:
  3. Copy the app’s Application (client) ID and Directory (tenant) ID from its Overview page.
Azure compares the issuer and subject exactly and doesn’t support wildcards, so each environment needs its own federated credential. An app registration holds at most 20 federated credentials, so use one app per group of environments rather than one credential per Preview branch.

Use the credential in your task

ClientAssertionCredential from @azure/identity calls your function whenever it needs a new Entra token. Return a fresh Trigger.dev OIDC token from it:
/trigger/read-from-azure.ts
The tenant and client IDs aren’t secrets. Keep them in AZURE_TENANT_ID and AZURE_CLIENT_ID if you prefer. Create the credential inside run so one run’s tokens are never reused by another. Redeploy and start a new run on that deployment.

Remove the old credential

Once runs in every deployed environment authenticate this way, delete AZURE_CLIENT_SECRET, AZURE_CLIENT_CERTIFICATE_PATH, and AZURE_CLIENT_CERTIFICATE_PASSWORD from those environments on the Environment Variables page, then delete the secret or certificate from the app registration. Local Development runs can’t mint OIDC tokens. Use your own Azure sign-in there, such as DefaultAzureCredential with the Azure CLI, when ctx.environment.type === "DEVELOPMENT".