How to Onboard AWS Access key and secret using RESTAPI script

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

How to Onboard AWS Access key and secret using RESTAPI script

L3 Networker

Hi,

 

i would like to onboard AWS access key and secret using RESTAPI script below is the piece of code and the required detail i adding the same code into my script but getting error "Cannot add account; reason: Missing mandatory parameter in Platform AWS_AccessKey_Test. (parameter: AWSAccessKeyID)"

 

Note - " AWS_AccessKey_Test" is created as platform in PVWA.

 

i think the url which i am using for account addition is something wrong please suggest

 

## STEP THROUGH EACH CSV ROW

foreach ($row in $csvRows) {

  # DEFINE VARIABLES FOR EACH VALUE - MANDATORY FIELDS

  $mandatoryArray = 'Password_name','Safe','Folder','Password','DeviceType','PolicyID','Address','UserName','AWSAccessKeyID','AWSAccountID'

  $objectName    = $row.Password_name.trim()

  $safe       = $row.Safe.trim()

  $safeFolder    = $row.Folder.trim()

  $password     = $row.Password.trim()

  $DeviceType    = $row.DeviceType.trim()

  $platformID    = $row.PolicyID.trim()

  $address      = $row.Address.trim()  

  $username     = $row.UserName.trim()

  $AWSAccessKeyID  = $row.AWSAccessKeyID.trim()

  $AWSAccountID   = $row.AWSAccountID.trim()

 

 

  #**Logging Open row for Account

  $XMLResult = $xmlFile.CreateNode("element","Result",$null)

  $actName = $xmlFile.CreateElement("AccountName")

  $actName.InnerText = $ObjectName

  $XMLResult.AppendChild($actName) | Out-Null

 

  #Declaration

  $webServiceAddAccount = "https://PVWAURL/PasswordVault/WebServices/PIMServices.svc/Account"

 

  #Authorization

  $headerParams = @{}

  $headerParams.Add("Authorization",$sessionID)

 

  $newAccounts = @{}

  $newAccount = @{}

  $newAccount.accountName = $ObjectName;

  $newAccount.safe = $Safe

  $newAccount.password = $Password

  $newAccount.platformID = $PlatformID

  $newAccount.username = $username

  $newAccount.address = $address

  $newAccount.AWSAccessKeyID = $AWSAccessKeyID

  $newAccount.AWSAccountID = $AWSAccountID

  $properties = @{}

3 REPLIES 3

L3 Networker

Done, i find out the solution myself and its working fine.

Can you share that here?

L3 Networker

i used the same github account onboarding utility script and at the time of runing the script i used command

.\Accounts_Onboard_Utility.ps1 -PVWAURL "https://Hostname/PasswordVault" -CsvPath .\accounts.csv -Create

 

and the parameter i used for onboard

Parameters for AWS accesskey onboarding :- 

safe platformID address username DeviceType password AWSAccessKeyID AWSAccountID disableAutoMgmt disableAutoMgmtReason

  • 458 Views
  • 3 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!