Managing Admin API via powershell with ADFS token

This blog post describes how to get token from ADFS if Get-MgmtSvcToken would not return token as expected.

We will use use script which will define new function called Get-AdfsToken. Direct link to script can be found from here.

First we need to add new function Get-AdfsToken. Start Powershell ISE with admin priviledges
AdminAPI1

Paste new function to ISE and then modify following variables at the end:
$adfsAddress = ‘https://adfshost’
$username = ‘domain\username’
$password = ‘password’

 

Choose play (F5) and now you should have token from ADFS in $token variable
AdminAPI2

Next, create new window to ISE and and add following variables with correct values and choose play (F5)

 

AdminAPI3

Now you should be able to run commands against Admin API

For example list registered resource providers

AdminAPI4

That´s it.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *