Just want to check to see if the behavior I’m seeing is just how it works or if it is because of how I have PSU configured. I created a new API endpoint and assigned it to a role that allows access from a particular account. If I were to run Invoke-RestMethod and pass a credential object for the account that has access, the command works fine and works as expected. But if I run Invoke-RestMethod under the account that has access without passing a credential, It fails with the following error:
Invoke-RestMethod : The remote server returned an error: (401) Unauthorized.
I did notice that this is different than if I tried to hit that endpoint from an account that shouldn’t have access. When I do that, I get the appropriate API response of 403 (Forbidden):
Invoke-RestMethod: Response status code does not indicate success: 403 (Forbidden).
Is this just the way Invoke-RestMethod or PSU work or am I missing something?
Product: PowerShell Universal Version: 1.5.8