Authentication and authorization for PowerShell Universal APIs
In this lecture, we go through how to configure API authentication and authorization. We'll look at how to enable authentication, enforce role-based access and use different authentication mechanisms to access the PowerShell Universal API.
Invoke-RestMethod http://localhost:5000/auth -Headers @{ Authorization = "Bearer " } $Identity $ClaimsPrincipal Invoke-WebRequest http://localhost:5000/api/v1/signin -Body (@{ UserName = "Admin" Password = "Any" } | ConvertTo-Json) -ContentType 'application/json' -SessionVariable mySession -Method POST Invoke-WebRequest http://localhost:5000/auth -WebSession $mySession Invoke-RestMethod http://localhost:5000/auth -UseDefaultCredentials