# Quickstart: 063 — Entra Sign-in

## 1. Environment Setup

Add the following to your `.env` file. These are required for the Microsoft Socialite provider.

```dotenv
MICROSOFT_CLIENT_ID=your-entra-app-client-id
MICROSOFT_CLIENT_SECRET=your-entra-app-client-secret
MICROSOFT_REDIRECT_URI="${APP_URL}/auth/entra/callback"
```

## 2. Install Dependencies

Ensure Laravel Socialite is installed:
```bash
sail composer require laravel/socialite
```

## 3. Configuration

Add the Microsoft provider configuration to `config/services.php`:

```php
'microsoft' => [
    'client_id' => env('MICROSOFT_CLIENT_ID'),
    'client_secret' => env('MICROSOFT_CLIENT_SECRET'),
    'redirect' => env('MICROSOFT_REDIRECT_URI'),
    'tenant' => 'common', // Or your specific tenant ID
],
```

## 4. Run Migrations

The required columns (`entra_tenant_id`, `entra_object_id`) and the unique index should already exist from previous migrations. If not, a migration will be created.

```bash
sail artisan migrate
```

## 5. Usage

1.  Navigate to `/admin/login`.
2.  Click "Sign in with Microsoft".
3.  Complete the sign-in flow on the Microsoft page.
4.  You will be redirected back to the application and routed according to your tenant memberships.
