sam2p
1
I have user email address stored in UserPrincipalName object
$AzureADUsers | Select-Object -Property UserPrincipalName
and trying to search that email and list email which doesn’t match using github rest API
$Result = Invoke-RestMethod -Headers $Headers -Uri https://api.github.com/user/emails -Method Get
$Result | Select-Object -Property email
ForEach($email in $Result) {
Invoke-RestMethod -Headers $Headers -Uri https://api.github.com/user/$UserPrincipalName -Method Get
}
Okay, Are you facing any issues with the above code ?
sam2p
3
Sorry my post got altered, I get this error. Wondering if object can be passed along withb rest Uri
Invoke-RestMethod : {“message”:“Not Found”,“documentation_url”:“GitHub REST API - GitHub Docs”}
At line:11 char:9
- Invoke-RestMethod -Headers $Headers -Uri https://api.github.c …
-
- CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
- FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Invoke-RestMethod : {“message”:“Not Found”,“documentation_url”:“GitHub REST API - GitHub Docs”}
At line:11 char:9
- Invoke-RestMethod -Headers $Headers -Uri https://api.github.c …
-
- CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
- FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand