# Connect with WAM and explicit Graph scopes

Connect with WAM and explicit Graph scopes on Evotec with practical examples, usage guidance, and reusable project workflows.

Project

O365Essentials

A module that helps to manage some tasks on Office 365/Azure via undocumented API

[View on GitHub](https://github.com/EvotecIT/O365Essentials) [Visit Website](#) [Releases](https://github.com/EvotecIT/O365Essentials/releases/tag/v1.0.2) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/O365Essentials)

Stars**145**

Forks**22**

Open issues**0**

PowerShell Gallery downloads**29962**

Release**v1.0.4**

Language: PowerShell Updated: 2026-11-11

Curated Examples

Use O365Essentials with Windows Web Account Manager for MFA-aware sign-in and Graph scope consent.

This pattern is useful when MFA is required, when the wrong cached Windows account is selected, or when a Graph command needs a delegated scope that is not already present in the token cache.

It is adapted from `Examples/ConnectO365AdminWam.ps1`.

## Example

```powershell
Import-Module O365Essentials

$TenantId = '00000000-0000-0000-0000-000000000000'
$Credential = Get-Credential -UserName 'admin@contoso.com' -Message 'Enter the account to use as the WAM login hint'

$Headers = Connect-O365Admin `
    -UseWam `
    -Credential $Credential `
    -Tenant $TenantId `
    -ForceRefresh `
    -GraphScope 'Policy.Read.All' `
    -Verbose

Get-O365AzureConditionalAccessLocation -Headers $Headers -Verbose
```

## What this demonstrates

- using WAM instead of legacy OAuth cache seeding
- using a credential username as a WAM login hint without sending the password to Graph
- forcing the account picker when the Windows cache picked the wrong identity
- requesting the Graph scope required by the command

## Source

- [ConnectO365AdminWam.ps1](https://github.com/EvotecIT/O365Essentials/blob/master/Examples/ConnectO365AdminWam.ps1)

<!-- PowerForge markdown artifact sha256:C75C8D3E90C81996FFD0E39BD380E0E4B0FEBC5EB72D1CA057E713D3304E46BC -->
