_test.ps1

Remove-Module AadSupport
Import-Module AadSupport

#Get-AadDateTime
#Get-AadServicePrincipal 'https://graph.microsoft.com'
#Get-AadServicePrincipalAccess 'custom web app'
#Get-AadServicePrincipalAdmins

<# SR 119050923001811
$uri = "https://graph.microsoft.com/beta/deviceManagement/auditEvents/getAuditCategories"
$token = Get-AadTokenUsingAdal -ResourceId "https://graph.microsoft.com" -ClientId $Global:AadSupportAppId -Redirect urn:ietf:wg:oauth:2.0:oob -Instance "https://login.microsoftonline.us" -Tenant williamfiddes.onmicrosoft.com -UserId admin@williamfiddes.onmicrosoft.com
$token.AccessToken
Invoke-AadProtectedApi -Endpoint $uri -Bearer $token.AccessToken
#>



<# Get-AadTokenUsingAdal SCENARIOS #>
<# Native App Test
$appid = (Get-AadServicePrincipal 'custom native app').AppId
 
(Get-AadToken -Verbose `
 -ClientId $appid `
 -UseResourceOwner `
 -Username admin@williamfiddes.onmicrosoft.com `
 -Password P0rsche911).AccessTokenClaims | Sort Name
#>



<# Get-AadTokenUsingAdal SCENARIOS #>
<#
Get-AadTokenUsingAdal -ResourceId $Global:ResourceAadGraph -ClientId $Global:AadSupportAppId -Redirect $Global:AadSupportRedirectUri -UserId $Global:AadSupportSession.Account
Get-AadTokenUsingAdal -ResourceId $Global:ResourceMsGraph -ClientId $Global:AadSupportAppId -Redirect $Global:AadSupportRedirectUri -UserId $Global:AadSupportSession.Account
Get-AadTokenUsingAdal -ResourceId $Global:ResourceAzure -ClientId $Global:AadSupportAppId -Redirect $Global:AadSupportRedirectUri -UserId $Global:AadSupportSession.Account
 
<# Web App Test
$appid = (Get-AadServicePrincipal 'custom web app').AppId
 
Get-AadTokenUsingAdal -UseClientCredential -ResourceId "https://graph.windows.net" -ClientId 5120cd5d-afbb-4cac-92c3-fc3ff3eda1d8 -ClientSecret "6k+?-ekQQ+2Jr5FIeQ3I6BOrBv-Vq*6R" -Tenant williamfiddes.onmicrosoft.com
#>