top of page
Search
CITLead

How to create users in PagerDuty using REST API v2 and PowerShell


First get a API Key, skip if you already have a API Key.

Log into your PagerDuty instance, go to Configuration > API Access












 

Click on Create New API Key



 

Add a Description, then select Create Key







 

You should now have a PagerDuty API key












 



 

PagerDuty has an excellent API reference


Under the section for Users > Create a User they give us hints on how we can code this in PowerShell. We will be using the Invoke-RestMethod, and we will start with the header.


In the API reference page, we can try out the API calls, when click try PagerDuty shows all actions. Also keep note of the method POST.


 

Requests Header

We need to transform it for the Invoke-RestMethod, this is how it should look like



 

Now for the body, the example that PagerDuty API reference page shows.


Here is how it should look like


Now to put everything together




 

Here is a function I build to create accounts





224 views0 comments

Recent Posts

See All

Comments


bottom of page