I’ve been looking for a script to identify stale Azure AD users. Trying to run the example at https://github.com/azure365pro/AzureAD_Inactive_Users/blob/main/AzureAD_Inactive_Users.ps1. Does it work in a GCC High tenant? I’ve modified the URLs to reference the “.us” suffix but getting an error when the script runs the line below.
$ExpiredUsers = (Invoke-RestMethod -Headers @{Authorization = "Bearer $($token)"} -Uri $LoginUrl -Method Get).value
The error message is:
Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
At C:\xxx\Documents\Scripts\AzureAD_Inactive_Users.ps1:58 char:18
+ ... redUsers = (Invoke-RestMethod -Headers @{Authorization = "Bearer $($t ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand