Skip to content
Jiri Formacek edited this page Dec 30, 2024 · 1 revision

Module supports loggin in to B2C tenants.
Sample below shows how to get AAD token usable to authenticate with applications integrated with B2C tenant

$myB2CTenant = 'myb2ctenant.onmicrosoft.com'
$myB2CClientId = 'd01734f1-2a3f-452e-ad42-8ffe7ae300bf'
$myB2CClientRedirectUri = 'http://localhost:44351/'
$myB2CLoginApi = " https://myb2ctenant.b2clogin.com"
$myB2CAPI = "$myB2CTenant/13e25c85-a23a-4858-b988-4f171265a92d"

New-AadAuthenticationFactory `
    -ClientId $myB2CClientId `
    -TenantId $myB2CTenant `
    -AuthMode Interactive `
    -B2CPolicy 'B2C_1_siso' `
    -LoginApi $myB2CLoginApi `
    -RedirectUri $myB2CClientRedirectUri
Get-AadToken -Scopes "$myB2CAPI/.default" | Test-AadToken -Verbose
Clone this wiki locally