Skip to content

AzureCliTokenProvider

Reuses whatever identity a developer already authenticated with az login, by shelling out to az account get-access-token.

Meant for local development against a real storage account without ever handing out an account key.

The CLI already caches and refreshes its own token, so rather than parse its locale-formatted expiresOn this re-invokes it on a short, fixed TTL: the extra call is cheap and always correct, where parsing a datetime the CLI does not promise a stable format for would not be.

final class AzureCliTokenProvider implements AzureTokenProvider

ImplementsAzureTokenProvider
SourceAzureCliTokenProvider.php

public function __construct(AzureCliProcessRunner $processRunner = new ProcOpenAzureCliProcessRunner(…), string $resource = self::STORAGE_RESOURCE): mixed

ParameterTypeDescription
$processRunnerAzureCliProcessRunner
$resourcestring

Returns mixed

MethodDescription
getToken(): string

public function getToken(): string

Returns string