to return my test active directory account, However it returns this
Invoke-RestMethod: Self referencing loop detected for property 'AccountDomainSid' with type 'System.Security.Principal.SecurityIdentifier'. Path '[0].SID.AccountDomainSid'.
If i throw in a username for an account that doesn’t exist it returns that the account doesn’t exist, but looking up a real account just errors.
The issue is, that the user’s SID is stored as a System.Security.Principal.SecurityIdentifier object. This class defines a property AccountDomainSid which is a SecurityIdentifier again and again has the property AccountDomainSid.