Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

How to convert powershell script to REST api in download tool?

csh8428
11 - Bolide

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

4 REPLIES 4
apathetichell
19 - Altair

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.

ChrisTX
16 - Nebula
16 - Nebula

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

 

Picture1.png

Chris

csh8428
11 - Bolide

@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.

Run command.pngscreenshot.png

 

@apathetichell or @ChrisTX  know how to fix the password part?

apathetichell
19 - Altair

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.

 

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.security/get-pfxcertificate...

Labels
Top Solution Authors