Welcome › Forums › General PowerShell Q&A › Compare AzureADUsers using github restapi
- This topic has 2 replies, 2 voices, and was last updated 3 weeks, 6 days ago by
Participant.
-
AuthorPosts
-
-
December 21, 2020 at 6:37 pm #281689
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
} -
December 22, 2020 at 4:58 am #281782
Okay, Are you facing any issues with the above code ?
-
December 22, 2020 at 9:46 am #281831
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”:”https://docs.github.com/rest”}
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”:”https://docs.github.com/rest”}
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
-
-
AuthorPosts
- You must be logged in to reply to this topic.