Security

Authentication and authorization for PowerShell Universal APIs

Download this Lecture Docs

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.

Commands Called in This Video

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