PHPackages                             esposimo/azure-auth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. esposimo/azure-auth

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

esposimo/azure-auth
===================

Simple azure auth with client id / client secret

v1.1.0(8mo ago)02MITPHPPHP &gt;=8.2

Since Oct 14Pushed 8mo agoCompare

[ Source](https://github.com/esposimo/azure-auth)[ Packagist](https://packagist.org/packages/esposimo/azure-auth)[ RSS](/packages/esposimo-azure-auth/feed)WikiDiscussions main Synced today

READMEChangelog (3)Dependencies (2)Versions (3)Used By (0)

Azure PHP Auth Client
=====================

[](#azure-php-auth-client)

A lightweight PHP library for managing authentication to Microsoft Azure APIs via Microsoft Entra ID (formerly Azure AD). This library provides a simple and efficient way to handle OAuth 2.0 authentication flows when interacting with Azure services. Designed with simplicity in mind, it abstracts away the complexity of token management and authentication handshakes, allowing developers to focus on their core application logic rather than authentication implementation details. It currently supports authentication based on a Service Principal using Client ID and Client Secret and Managed Identities.

[![Latest Version on Packagist](https://camo.githubusercontent.com/4ce2fa2b0f263e7bbac268b9026f8387c6539e6d4b739cc2788ee7de2de945c1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6573706f73696d6f2f617373657274696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/esposimo/azure-auth)[![Total Downloads](https://camo.githubusercontent.com/8e91493bd6a7251b11b33d8ed8d2ac1d840255e4aa719272e8ee803d5ab07a5f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6573706f73696d6f2f617373657274696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/esposimo/azure-auth)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

Installation
------------

[](#installation)

Use Composer to add the library to your project:

```
composer require esposimo/azure-auth
```

Configuration and Authentication (Managed Identities)
-----------------------------------------------------

[](#configuration-and-authentication-managed-identities)

When your application is running in an Azure environment with Managed Identity enabled (e.g., Azure VMs, App Services, or Azure Functions), you can use the simplified authentication flow:

1. **Prerequisites**

To use this method, you must register your application in Microsoft Entra ID and grant it access to the Azure resources you want to access.

2. **Usage Example**

```
