Specified value has invalid CRLF characters
Symptom
Using REST API call with powershell script from https://github.com/cyberark/epv-api-scripts triggers error:
Error configuring safe '<safe-name>'. Error: Source:; Message: New-Safe: Error adding <safe-name> to the Vault.
->Source:System; Message: Specified value has invalid CRLF characters.
Parameter name: value
Environment
13.2 Privileged Access Manager (PAM, self-hosted);Privilege Cloud Cyber-Ark API/SDK Cyber-Ark API/SDK REST API
Cause
The PVWA URL is missing the ending "/PasswordVault".
Reviewing the script at:
https://github.com/cyberark/epv-api-scripts/blob/main/Safe%20Management/Safe-Management.ps1
The script assigns for the base API URL:
$URL_PVWAAPI = $PVWAURL + "/api"
The required API URL is:
https://<subdomain>.privilegecloud.cyberark.com/PasswordVault/API/Safes/
From the documentation:
https://docs.cyberark.com/PrivCloud/Latest/en/Content/WebServices/Add%20Safe.htm?tocpath=Developers%7CREST%20APIs%7CSafes%7C_____1
Resolution
Add the '/passwordvault' to the end of the PVWA address. Providing the full PVWA address with /passwordvault should resolve the issue.
For example:
.\Safe-Management.ps1 -PVWAURL "https://<pvwa-tenant-id>/privilegedcloud/passwordvault" -Add -SafeName "<safe-name>"