How to convert Postman/API script to e.g. Powershell script - with a secure method


I have managed to create a Postman Post call that starts a specific job in Orchestrator.
I have also managed to use the “Code snippet” tool in Postman and get the “Powershell - RestMethod” snippet and it works in Powershell ISE

So now to the “Problem”:

  • I want a business user to double click a file(e.g. powershell) to execute the script and start the job when they want.

  • Currently the script contains the access token(Bearer) in plaintext, so it only works for some time.

  • I have another post where one suggestion where to use “External Applications” in Orchestrator, but I have no clue how to use it alongside powershell.

  • Currently I have an account with stripped down access that is only able to start a job. This account is generating the access token in Postman where I then manually copy and put it in the header in the Powershell script. Do I need to have the 2 powershell scripts where the first generates the token and saves it to a variable and then passes it to the script that executes the job? I mean then I have the user credentials in plaintext in the powershell file and these file will be located on the client PC.

  • Is there another approach and a guide I can follow somewhere?