Skip to content

Resource Owner Password Credential flow

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

While not recommended, there still may be scenarios when this flow may be required - so module supports it.
This sample uses ROPC to get token to access Azure Key Vault. Get-AadToken uses implicit authentication factory cached by most recent call of New-AadAuthenticationFactory.

$creds = Get-Credential
#create app registration in EntraID and allow ROPC on it
$clientId = 'your custom client id'
New-AadAuthenticationFactory `
    -TenantId 'mytenant.com' `
    -ClientId $clientId `
    -ResourceOwnerCredential $creds `
    -DefaultScopes 'https://vault.azure.net/.default' `
| Get-AadToken `
| Test-AadToekn
Clone this wiki locally