API, Powershell

Managing Kiuwan users through API with PowerShell

If you have Kiuwan with enabled SAML, and you manage access to the enterprise app using groups – this script is for you.

With this script running from time to time (in my case it is every 15 minutes) after a user manager in Kiuwan adds a user – user is added to the relevant group in Active Directory. If user is removed – then certain user is removed from the Active Directory group.

The script can be found here, the key part is this:

$USER = "Kiuwan_API_User"

# PUT USER PASSWORD HERE <<
$password = 'PutPasswordHere'

$HeaderAuth = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $USER, $password)))
$SessionHeader = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$SessionHeader.Add('Authorization',('Basic {0}' -f $HeaderAuth))
$SessionHeader.Add('Accept','application/json')
$SessionHeader.Add('Content-Type','application/json')

# PUT KIUWAN ID HERE <<
$SessionHeader.Add('X-KW-CORPORATE-DOMAIN-ID','PutDomainIdHere')

$URL = "https://api.kiuwan.com/users"
$APIResponse = Invoke-RestMethod -Method Get -Uri $URL -Headers  $Sessionheader -Verbose -TimeoutSec 33

More about Kiuwan’s API can be found here https://static.kiuwan.com/rest-api/kiuwan-rest-api.html

And here is a good video showing it’s capabilities can be found here:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s