Not sure what to say, I seem to be getting successful lookups minus the one. It does open a browser window and asks for my login and I receive the "Authentication complete. You can return to the application. Feel free to close this browser tab." message.
.\Find-EwsUsage.ps1 -OutputPath C:\Users\Username\Desktop\EWS-Output\ -OAuthClientId {myClientID} -OAuthTenantId {myTenantID} -PermissionType Delegated -Operation GetEwsActivity -Verbose
Successful:
VERBOSE: Calling Invoke-GraphApiRequest
VERBOSE: Graph API uri called: https://graph.microsoft.com/v1.0/servicePrincipals(appId='24e92c11-071d-4be6-83d1-66b18f8ef1cc')/appRoleAssignments
VERBOSE: Method: GET ContentType: application/json
VERBOSE: Calling Invoke-WebRequestWithProxyDetection
VERBOSE: Calling Confirm-ProxyServer
VERBOSE: Proxy server configuration detected
VERBOSE: Unable to check for proxy server configuration
VERBOSE: WebRequest: v1.1 GET https://graph.microsoft.com/v1.0/servicePrincipals(appId='24e92c11-071d-4be6-83d1-66b18f8ef1cc')/appRoleAssignments with application/json payload with body size 0 b (0 bytes)
VERBOSE: WebResponse: 200 OK with application/json payload
VERBOSE: Graph API request successful
The below is the only unsuccessful lookup, but it's not saying why:
VERBOSE: Calling Invoke-GraphApiRequest
VERBOSE: Graph API uri called: https://graph.microsoft.com/v1.0/servicePrincipals(appId='d1b9d202-4d99-4012-938a-31c08c68051c')/appRoleAssignments
VERBOSE: Method: GET ContentType: application/json
VERBOSE: Calling Invoke-WebRequestWithProxyDetection
VERBOSE: Calling Confirm-ProxyServer
VERBOSE: Proxy server configuration detected
VERBOSE: Unable to check for proxy server configuration
VERBOSE: WebRequest: v1.1 GET https://graph.microsoft.com/v1.0/servicePrincipals(appId='d1b9d202-4d99-4012-938a-31c08c68051c')/appRoleAssignments with application/json payload with body size 0 b (0 bytes)
VERBOSE: WebResponse: 404 Not Found with application/json payload
InvalidOperation: Find-EwsUsage.ps1:759:9
Line |
759 | $reader = New-Object System.IO.StreamReader($response.GetResp …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Method invocation failed because [System.Net.Http.HttpResponseMessage] does not contain a method named 'GetResponseStream'.
VERBOSE: Graph API request failed - no response
Unable to get app role assignments for application Teams Bot. Please review the error message below and re-run the script:
So, it appears to be able to do all the lookups it needs to do, but is failing on the one app registration, and somehow that is causing the entire script to fail?