Skip to content

AzureTokenProvider

Produces an Azure AD access token for whichever resource its implementation was built for, caching and refreshing it however fits the source (a token exchange, a CLI call, a chain of both).

STORAGE_RESOURCE is every implementation’s own default, since Blob/Table storage is what AzureCredentialFactory builds one for; a caller that needs a token for a different AAD-protected API (e.g. Log Analytics) passes its own resource/scope instead, via AzureTokenProviderFactory or a provider’s constructor directly.

interface AzureTokenProvider

Implemented byAzureCliTokenProvider, ChainedTokenProvider, WorkloadIdentityTokenProvider
SourceAzureTokenProvider.php
ConstantValueDescription
STORAGE_RESOURCE'https://storage.azure.com/'The az account get-access-token --resource form: an https URL ending in /.
MethodDescription
getToken(): string

abstract public function getToken(): string

Returns string

ThrowsWhen
AzureStorageExceptionIf no token could be obtained.