This Article will presume that the API is already setup and you know the endpoint you want to call, if you are unsure read ProvisionPoint API & Setup
Once PowerShell 7 is installed you will need to run as an administrator to ensure the Modules have been installed.
To authenticate with the API App Registration we recommend AZ and AZ.Accounts.
Install-Module Az
Install-Module Az.Accounts
We have created some PowerShell functions contained in a folder called 'Modules', containing pp-api.psm1 and pp-common.psm1 files.
Please collect the latest version from our Resources area in the knowledge base, these will need to be used with any of our sample scripts.
We have also provided an authentication script that can be used with any of the API endpoint.
Authentication
There are a number of variables used to process the authentication that must be collected and added to the script
- $UserTenant = "Add your Azure tenant ID"
- $UserAppClientId = "Add your API App registration Client ID"
- Certificate, Secret or user account - Choose either the Certificate, Secret or comment out both to use a username and password
- $CertificateThumbprint = "Add Certificate Thumbprint from the App registration"
- $Secret = "Add the Secret value from App registration"
- The ProvisionPoint Instance values - There are 5 to choose between, UK, EU, CH, US, AU these have been added to the example authentication script. Remove any you are not using.
- These values are static and should not be changed, for example the UK instance is
- $APIClientId = "8fca124b-608f-47a0-bf3b-d1144b8c755a"
- The ProvisionPoint Enterprise App ID
- $APIUrl = "https://api.provisionpoint.com/v1.0""
- The Base Endpoint
- $APIResourceUrl = "api://app.provisionpoint.com/8fca124b-608f-47a0-bf3b-d1144b8c755a"
- Scope
To make the authentication call use functions from our Modules files to make a REST call to pass through relevant values to use a certificate, secret or user account and password.
- Import-Modules

- Set-Auth
- Invoke-PPAZAPIAuthorisation

The example scripts we have provided can be customised, they are not guaranteed to work for all tenants so it is best to reach out to someone in the business who is familiar with REST APIs and PowerShell.
Your own authentication can be used and designed as needed. You will need to:
- Connect-AzAccount
- Pass through the variables for the the API and App registration
- Get an access token and store it
- Define Error handling