Add Privileged Account Credential ​
POST /userapi/privaccount
Adding a new Privileged Account Credential can be achieved by making a POST request on the URL, with appropriate fields forming the HTTP message body. The account executing this call must have the Privileged Account Credentials Security Administrator's role in Passwordstate.
The PowerShell example below creates an Privileged Account Credential record with various fields specified.
Powershell
#JSON data for the object
$Body = @{
UserName = "domain\ps_accnt"
Description = "AD Account for Priv Account Management"
Password = "boots-t=3R#DK"
PasswordID = $PasswordID
SiteID = "0"
AccountType = "Active Directory"
}
$jsonData = $Body | ConvertTo-Json
$PasswordstateURL = 'https://passwordstate/userapi'
$result = Invoke-Restmethod -Method Post -Uri $PasswordstateURL'/privaccount' -ContentType "application/json"-Body $jsonData -Header @{ "UserID" = "<UserID>" ; "APIKey" = "<APIKey>" }
Write-Output $resultThe following fields can be specified when creating Privileged Account Credentials:
| Heading | Data Type | Description |
|---|---|---|
| Description | String (200) | The description for the Privileged Account Credential entry |
| UserName | String (100) | The Username field of the account for the Privileged Account Credential entry. If the Account Type is an Active Directory Account, then the format to be used is domain\username |
| Password | String (NA) | The password value for the account |
| PasswordID | String (NA) | If the credential is to be linked to a Password record which exists in a Password List, then specify the PasswordID value as appropriate. Otherwise, exclude this field |
| KeyType | String (20) | If the account is a Linux account, to be used for Public/Private Key authentication, then the KeyType's which can be specified are OpenSSH or Putty |
| PassPhrase | String (NA) | The value of the PassPhrase, as associated with the PrivateKey below |
| PrivateKey | String (NA) | The value of the PrivateKey |
| SiteID | Integer | The SiteID to associate the Privileged Account Credential entry with. SiteID's can be found on the screen Administration -> Remote Site Administration -> Remote Site Locations |
| AccountType | String (50) | The Account Type for the Privileged Account Credential entry. The AccountType values can be found on the screen Administration -> Images and Account Types |
| EnablePassword | String (NA) | This password field is specific for the Account Type of 'Cisco IOS', and is also optional for this Account Type |