How to convert powershell script to REST api in download tool?
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
We are trying to use Cyberark to call stored credentials from the Cyberark vault. The way we implemented Cyberark, we do not support the native connection tools, so we must use the api. Our internal team that owns our Cyerberark deployment has given me the following script that works in Windows Powershell. How can I convert this to use with the download tool. The main issue I'm having is how can I pass the SSL certificate using Alteryx. The double and single quotes are part of the script, not added by me. I anonymized any confidential data like the folder path, appId, safe, and username.
$certPath = "D:\Folder\Folder\certname.pfx"
$cert = Get-PfxCertificate -FilePath $certPath
Invoke-RestMethod -Method Get -Uri 'https://APIBASEURL?AppID=ABCD&Safe=HIJK&UserName=JOHNSMITH' -Certificate $cert
Thanks for any help!
-Craig
- Labels:
- API
- Connectors
- Developer Tools
- Download
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Download tool doesn't natively support this. If this is a non-password protected cert - you can "try" reading it in as a blob - passing the blob in the header as Certficiate. Will that work? No idea.
I might just skip the native Alteryx function and use Python here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Do you have your Powershell script saved, and you just need to run it from Alteryx?
Use the Run Command tool
Command: powershell
Command Arguments [Optional]: -NoLogo -NonInteractive -WindowStyle Hidden -File "\\?\MyPowershellFolder\MySubFolder\MyPowershellScript.ps1"
For all folder paths: If you are using a UNC path (beginning with \\), use “\\?\” instead of “\\”, like this:
"\\?\UNCPath\MySubFolder\MyPowershellScript.ps1"
Working Directory [Optional]: you may need to leave this value blank, to avoid an error
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@ChrisTX You got me close! I don't know why, but I couldn't get it to work with Powershell. I had to use Powershell ISE. Next hurdle, if I run the script manually in Powershell ISE I get a prompt to enter a password, but when Powershell ISE is run from Alteryx there is no password prompt.
@apathetichell or @ChrisTX know how to fix the password part?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
You need to include your password in your api call or in your Get-Pfx-Certificate. alteryx will not give you a pop up in run command.
If the popup is for your cert password - you can pass it in with Get-Pfx-Certificate using a -password tag and a secureString.
