pspete / psPAS

PowerShell module for CyberArk Privileged Access Security REST API
https://pspas.pspete.dev
MIT License
296 stars 91 forks source link

Add-PASAccount required Parameter #24

Closed JohnnyLeuthard closed 7 years ago

JohnnyLeuthard commented 7 years ago

for the Add-PASAccount function the 'username' parameter is not set to mandatory but it is mandatory for adding an account. Or is there a reason I am missing as to why that's not a required one in the function?

pspete commented 7 years ago

Hi @JohnnyLeuthard -

The Rest API documentation states only safe, platformID & password are required.

Variances in the configuration at the platform level would dictate which parameters are required or optional; a platform could be configured to say Username is optional....

I've not tested the above, but I believe the platform would allow an account to be added without a username.

pspete commented 7 years ago

I just got around to testing this:

Attempting to add an account via the Web Service against a platform which specifies Username as optional, and not supplying a username, resulted in the following error:

Cannot add account; reason: Missing mandatory parameter. (parameter: Username)

On that basis will update the username parameter on Add-PASAccount to be mandatory.

NathanielMaier commented 7 years ago

If I understand your testing correctly, this sounds like a REST API bug. If the username is optional per the Platform configuration, it should not be mandatory in the REST call, right? Should this be reported to CyberArk?

pspete commented 7 years ago

@NathanielMaier - That is the behaviour I would expect, although I do not envisage many occasions when a username would not be part of an account. The unofficial documentation has Username listed as Mandatory - so is possibly just a documentation error/anomaly.

Setting username as required for adding an account via the module explicitly negates the opportunity for the related error to be raised; if the API behaviour is updated in any later release, the module can be updated accordingly.