Add Privileged Account Credential Permission ​
POST /api/privaccountpermissions
To add permissions to a Privileged Account Credential entry, you use the Privileged Account Credential API Key. Permissions are required on Privileged Account Credentials, if you want user's to have access to the Privileged Account Credential i.e. so they can configure Password Resets, Account Discovery Jobs, etc.
Adding permissions can be achieved as per the example below, using the following parameter descriptions:
Powershell
#JSON data for the object
$Body = @{
PrivilegedAccountID = "7"
ApplyPermissionsForSecurityGroupName = "Core Admins"
}
$jsonData = $Body | ConvertTo-Json
$PasswordstateURL = 'https://passwordstate/api'
$result = Invoke-Restmethod -Method Post -Uri $PasswordstateURL'/privaccountpermissions' -ContentType "application/json" -Body $jsonData -Header @{ "APIKey" = "<apikey>" }
Write-Output $result| Heading | Date Type | Description |
|---|---|---|
| PrivilegedAccountID | Integer | Unique identifier for the Privileged Account Credential Read-only: Created automatically at the time the Privileged Account Credential was added. |
| ApplyPermissionsForUserID | String (100) | The UserID you wish to apply permissions for |
| ApplyPermissionsForSecurityGroupID | Integer | The SecurityGroupID you wish to apply permissions for. You can only specify SecurityGroupID or SecurityGroupName, not both in the same call. |
| ApplyPermissionsForSecurityGroupName | String (NA) | The Security Group Name you wish to apply permissions for You can only specify SecurityGroupID or SecurityGroupName, not both in the same call. |
| APIKey | String (NA) | Privileged Account Credential API Key. This can either be specified in the HTTP Header, or within the POST Body |
Special Note: If you specify the value of 0 for ApplyPermissionsForUserID and ApplyPermissionsForSecurityGroupID, then All Users and Security Groups will be granted access. Equivalent to "All Users and Security Groups" you see in the UI.
Json
# Response
HTTP/1.1 200
[
{
"PrivilegedAccountID":"7",
"ApplyPermissionsForUserID":"0",
"ApplyPermissionsForSecurityGroupID":"312",
"ApplyPermissionsForSecurityGroupName":"Core Admins",
"APIKey":"Redacted"
}
]