In an environment using MFA to authenticate to the Vault, how do we leverage the API via scripting (like Powershell, for example)?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Welcome Idira to LIVEcommunity!

Our community just got stronger! Explore new identity security resources, connect with experts, and discover more ways to learn and collaborate.

Meet Idira

In an environment using MFA to authenticate to the Vault, how do we leverage the API via scripting (like Powershell, for example)?

L3 Networker
1 accepted solution

Accepted Solutions

L4 Transporter

This is not really a standard way for scripting/coding so I'm not sure it is supported. I don't think there is an MFA process for this as most people use scripts to automate tasks, which is the exact opposite of the usage of MFA 🙂

 

I actually never tried it myself. I'll run a test a bit later in our lab and see if it works and let you know

View solution in original post

15 REPLIES 15

L4 Transporter

When you say MFA is this SAML or RADIUS? API offers ways of authentication as below. For more details refer to SDK documentation

 

 CyberArk

https://<IIS_Server_

Ip>/PasswordVault/API/auth/Cyberark/Logon

 Windows

https://<IIS_Server_

Ip>/PasswordVault/API/auth/Windows/Logon

 LDAP

https://<IIS_Server_

Ip>/PasswordVault/API/auth/LDAP/Logon

 RADIUS

https://<IIS_Server_

Ip>/PasswordVault/API/auth/RADIUS/Logon

SAML

https://<IIS_Server_

Ip>/PasswordVault/WebServices/auth/SAML/SAMLAuthenticationService.svc/Logon

 

L4 Transporter

Also, there are two ways of logon ..pre v10 logon and v10 logon.

L4 Transporter

Its not the official page, but it is awesome:

https://documenter.getpostman.com/view/998920/cyberark-rest-api-v10-public/2QrXnF#ff4e4ce2-485b-fbf4-df80-1868ecc9d513

 

L3 Networker

Maybe I wasn't clear enough. I know how to login using the API from Postman using MFA. I want to be able to do that using a Powershell script. I am using RADIUS. So when I kick off a script, it needs to authenticate over MFA. How do I make use of MFA in the Powershell script? How can I get it to prompt for the MFA code and create the login token?

L3 Networker

@Maruthi Gullapudi​ The link you provided doesn't work. I used the IP, the URL, and the hostname. All result in failure. Plus, I am asking about logging in using a script not a browser

 

L2 Linker

I too have same problem in using RADIUS authentication in powershell script . If anyone know how to use it please help us .

 

L2 Linker

 

@tzuriel kastel​ - I tried to use RADIUS authentication from API with postman in the past but I got failure message because I was not able to provide one time Response . Could you please help me how to login using API with RADIUS Authentication with Postman.

L3 Networker

@Prakash Kalluri​

Using the CyberArk [v9.0+]/LDAP [v9.7+]/Radius [v9.7+] Logon request item:

 

on the Body tab, put your username and password. Your password should be what you would send to the RADIUS server when connecting.

useRadiusAuthentication should be set to true.

 

Click Send and you should get back a CyberArkLogonResult with your token. Add this to a variable. Create a set of environment variables with these as the Current Value:

 

BaseURL = your https URL to PVWA

CyberArkLogonResult = The token you got from the authentication

 

You should then be able to use the other requests as long as the variable for CyberArkLogonResult is formatted correctly {{CyberArkLogonResult}} in the Headers tab.

 

Hope this is clear and works for you!

 

L4 Transporter

Hey,

Something I'm missing here.

You want to use MULTI-FACTOR authentication in script? that was the issue?

L3 Networker

Yes. I want the script to allow for an MFA login. So that when I trigger the script, I get prompted for the MFA token (RADIUS). Currently, I can only use the API with CyberArk local user accounts. I would like to have the option of using LDAP accounts with RADIUS for MFA. I hope I am explaining the clearly. Thank you

L4 Transporter

This is not really a standard way for scripting/coding so I'm not sure it is supported. I don't think there is an MFA process for this as most people use scripts to automate tasks, which is the exact opposite of the usage of MFA 🙂

 

I actually never tried it myself. I'll run a test a bit later in our lab and see if it works and let you know

L3 Networker

Yes...I agree that it is not standard. But I want to be able to use MFA for certain use cases. Perhaps I am overthinking it. Thanks for your repsonses

L4 Transporter

@tzuriel kastel​ 

 

curl --request POST \

 --url 'https://components.cyberarkdemo.com/PasswordVault/WebServices/auth/Cyberark/CyberArkAuthenticationService.svc/Logon' \

 --header 'Content-Type: application/json' \

 --data '{

 "username":"Administrator",

 "password":"Cyberark1",

 "useRadiusAuthentication":"true",

 "connectionNumber":"1"

}'

L4 Transporter

We have implemented MFA in our environment as well but an exception has also been introduced in the directory mapping to segregate the accounts that are being used with API/SDK. The automation APIs (powershell and c#) are running using Domain sys accounts (which can't be assigned a RSA token) so we have added these accounts inside a parent group and assigned a different directory map to it (with default auth as LDAP)

  • 1 accepted solution
  • 1396 Views
  • 15 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!