azure-oss/identity
A PHP identity library for acquiring Microsoft Entra ID access tokens via client secret, client certificate, workload identity, managed identity, chained, and default credential flows. Uses PSR-18/17 HTTP implementations. Community-maintained and not affiliated with Microsoft.
A PHP identity library for acquiring Microsoft Entra ID access tokens with client secret, client certificate, workload identity, managed identity, and default credential flows.
[!IMPORTANT] This package is community-maintained and is not affiliated with, endorsed by, or supported by Microsoft.
composer require azure-oss/identity
<?php
use AzureOss\Identity\ClientSecretCredential;
use AzureOss\Identity\TokenRequestContext;
$credential = new ClientSecretCredential(
tenantId: getenv('AZURE_TENANT_ID'),
clientId: getenv('AZURE_CLIENT_ID'),
clientSecret: getenv('AZURE_CLIENT_SECRET'),
);
$token = $credential->getToken(
new TokenRequestContext(['https://storage.azure.com/.default'])
);
echo $token->token;
ClientSecretCredentialClientCertificateCredentialEnvironmentCredentialWorkloadIdentityCredentialManagedIdentityCredentialChainedTokenCredentialDefaultAzureCredentialDefaultAzureCredential tries a configurable credential chain for common Azure hosting environments.DefaultAzureCredential includes environment and workload identity credentials. Managed identity can be enabled through DefaultAzureCredentialOptions.You can read the documentation here.
This package is part of the community-maintained PHP OSS for Azure project. It is an independent project and is not affiliated with or endorsed by Microsoft.
This project is released under the MIT License. See LICENSE for details.
How can I help you explore Laravel packages today?