Add password manager to cyberark safe

Hey folks, so i was working on cyberak integration a while back where one of the use case was to add a local CPM to all the safes, around july i remember the code was working well… and now the same code keeps giving me unauthorized error. Do you know whats wrong now, or if something changed ?


  String identityName1="CPM0"; //round robin for CPM in prod
  String appName="PAM";
  String identityName="XXX"; // identity cube for whch the cpm needs addedd
  String target="P-IAM-"+identityName.replace("","");
  IdentityService is = new IdentityService(context);
  Identity identity=context.getObjectByName(Identity.class, identityName1);
  Application app=context.getObjectByName(Application.class, appName);


  ProvisioningPlan plan=new ProvisioningPlan();  
  plan.setIdentity(identity);
  plan.setTargetIntegration("Cyberark");

  ProvisioningPlan.AccountRequest ar=new ProvisioningPlan.AccountRequest();
  ar.setApplication(appName);
  ar.setNativeIdentity("77"); // native id of CPM here
  ar.setOp(ProvisioningPlan.ObjectOperation.Modify);
  ar.setType("Container");

  ProvisioningPlan.PermissionRequest pr=new ProvisioningPlan.PermissionRequest();
  pr.setOp(ProvisioningPlan.Operation.Add);
  List rights = Arrays.asList("useAccounts", "retrieveAccounts", "listAccounts", "accessWithoutConfirmation", "addAccounts","updateAccountContent","updateAccountProperties","initiateCPMAccountManagementOperations","specifyNextAccountContent","renameAccounts","createFolders","deleteFolders","moveAccountsAndFolders");
  pr.setRightsList(rights);
  pr.setTarget(target);
  pr.setTargetCollector("Cyberark");
  Attributes attributes = new Attributes();
  attributes.put("assignment","true");
  pr.setArguments(attributes);

  ar.add(pr);
  plan.addRequest(ar);
  Provisioner provisioner  = new Provisioner(context);
  if(plan!=null) {

    ProvisioningProject project = provisioner.compile(plan);
    provisioner.execute(project);


  } 

Code was untouched and was working till July end, same error i keep getting if i try to add a local cyberark group, or a local CA account as well. :confused:

Have you validated the api keys or the user credential that his script would be using to connect to CyberArk?

Hi @rohit_jaiswal1

As @mpotti mentioned validate the keys and verify whether the user is having appropriate permissions for the action.The unauthorized error is usually related to authentication/authorization issues.

Hello Mark, Jarin… so keys are fine because i am able to do a few operations, its where the safe modification comes into picture errors are coming. i have asked our CA team to check the scim service account permissions

Hello @mpotti @Jarin_James , so APi keys are correct. i tried the same script multiple times and it works like 1 out of 3 times… this has me sooo confused if its not the code and the api issue :confused:

Hi @rohit_jaiswal1,

Thats interesting. Try to capture the logs and see what exactly is causing this issue. Is the request getting timed-out, or any other network issue.

i do have the trace logs enabled let me stub some details and share here with you.

FYI same happens when i try to add a local cyberark account or local cyberark group… gets 401 sometimes, gets success others

@rohit_jaiswal1 Have you opened a ticket with Support or Expert Services? After reading some threads from CyberArk this behavior could mean that when reaching out to the server that the secret is not actually being passed. The other common thing I was seeing was permissions related. But seeing as this is working some times I don’t think it is permissions related. I would ask the question around the keys being passed to the CyberArk Server. You may also want to enable debugging on the connector and trance the logs that way. I would also ask your CyberArk team if they can look at the logs on the CyberArk side and see if any other errors come up from that side.

On the CyberArk Technical Community site a related issue was posted.
https://cyberark.my.site.com/s/article/SCIM-integration-with-sailpoint-failing-test-connection-with-401-error

From this issue you can see which log-files on the SCIM server can be viewed to find an indication.

And the question is: Is there a number behind the 401 error? This number should provide more details on why it is a 401.

– Remold

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.