GitHubActionsCommands.

AzureLogin(string, string, CancellationToken) Method

Summary

Exchanges a GitHub Actions OIDC identity token for an Azure AD access token (workload identity federation). Default scope is https://management.azure.com/.default, default OIDC audience is api://AzureADTokenExchange, and default token authority is https://login.microsoftonline.com. Requires permissions: id-token: write in the GitHub Actions workflow. OIDC tokens and the returned access token are automatically masked in the build log.

Syntax

public Task<string> AzureLogin(string tenantId, string clientId, CancellationToken cancellationToken = default(CancellationToken))

Examples

var tenantId = EnvironmentVariable("AZURE_TENANT_ID");
var clientId = EnvironmentVariable("AZURE_CLIENT_ID");
var accessToken = await GitHubActions.Commands.AzureLogin(tenantId, clientId);

Parameters

Name Type Description
tenantId string The Entra ID tenant ID.
clientId string The application (client) ID.
cancellationToken CancellationToken The cancellation token.

Return Value

Type Description
Task<string> The Azure AD access token.