Tests/Test-Invoke-AadProtectedApi.ps1

Remove-Module AadSupport
Import-Module AadSupport
Connect-AadSupport

Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
Write-Host "TEST Invoke-AadProtectedApi USING Client and Resource" -ForegroundColor Yellow
Invoke-AadProtectedApi -Endpoint 'https://graph.microsoft.com/v1.0/me' -Client 'test native app' -Resource 'https://graph.microsoft.com'


Write-Host "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
Write-Host "TEST Invoke-AadProtectedApi USING Token" -ForegroundColor Yellow
$token = Get-AadTokenUsingAdal 'custom native app' `
-ResourceId "https://graph.microsoft.com"

Invoke-AadProtectedApi -Endpoint 'https://graph.microsoft.com/v1.0/me' -Bearer $token.AccessToken