Setup key authentication
For Zervicepoint Powershell Management
When authenticating towards the Zervicepoint PowerShell API you now have two options. Either use ADFS or a Key. ADFS requires the ADFS service running in your environment which provides tokens to prove your identity. Using a key does not require any additional services as the key itself proves your identity. This guide covers how to change from using ADFS for our API to instead use Key.
To change from ADFS to Key authentication follow these steps
- Go to AdminWeb, Edit Store, API Authentication tab
- Click the Authentication method dropdown and select Key
- Fill out the email-address of the user who you want to add API rights for
- Click on Generate key and the following modal will be shown
- Make sure you copy the Key as it will only be shown once.
Make sure you click Save
Now the basic setup is done. To use your key start up PowerShell where you have the Zervicepoint PowerShell Management API installed. In the code example below we assume you are running PowerShell from the Zervicepoint server as the module is installed in the default location
Run the following line of code to import the module
Import-Module "C:\Program Files\Zipper\ZervicePoint\Powershell\ZervicePoint.WebApi.PowerShell"
Then run the following code to put the key you just generate into a credential on the machine you are running PowerShell from. The credential will be linked to the store specified in the URL, configure the key on the local machine
$url = "https://zervicepoint.dev.local:30000/Store/" Set-ZPKeyCredential -Key "Un+cfCbIAYT69bZwz6MR8TJd9LJ0iCFwh6/r/RY3H5M=" -Url $url
Now you can run the usual cmdlets like Get-ZPStore
Get-ZPOrder example Get-ZPOrder -Url $url
It is also possible to skip Set-ZPKeyCredential by supplying a Key directly in the Key parameter when making common calls using the API
Get-ZPOrder -Key "Un+cfCbIAYT69bZwz6MR8TJd9LJ0iCFwh6/r/RY3H5M=" -Url $url