@InternalApi public class AzureMsiTokenSource extends Object implements TokenSource
TokenSource that fetches OAuth tokens from the Azure Instance Metadata Service (IMDS)
endpoint for Managed Service Identity (MSI) authentication.
This token source makes HTTP GET requests to the well-known IMDS endpoint at http://169.254.169.254/metadata/identity/oauth2/token to obtain access tokens for the specified
Azure resource.
| Constructor and Description |
|---|
AzureMsiTokenSource(HttpClient httpClient,
String resource,
String clientId)
Creates a new AzureMsiTokenSource.
|
public AzureMsiTokenSource(HttpClient httpClient, String resource, String clientId)
httpClient - The HTTP client to use for requests to the IMDS endpoint.resource - The Azure resource for which to obtain an access token.clientId - The client ID of the managed identity to use. May be null for system-assigned
identities.public Token getToken()
getToken in interface TokenSourceCopyright © 2026. All rights reserved.