pspete / psPAS

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

Error Get-PASAccount #257

Closed oscarITPRO closed 4 years ago

oscarITPRO commented 4 years ago

Your Environment

Expected Behaviour

Creation of account

Current Behaviour

Using the following command

Add-PASAccount -safe $SAFE -PlatformID $PlatformID -Address $Computer -Password $secureString -username $username

PowerShell show the following message error:

Invoke-PASRestMethod : [400] Cannot add account; reason: Missing mandatory parameter. (parameter: Username) At line:483 char:13

Does anyone know what could be wrong?

Thanks Best regards

pspete commented 4 years ago

Hi @oscarITPRO - thanks for the report, looks like an issue in the code when specifying parameters which direct the request to the classic api.

Requests using parameters which direct the Add-PASAccount request to the newer generation api (accessible from 10.4+) are not affected.

I've just updated the on the dev branch via #259 so should be fixed in the next version.

oscarITPRO commented 4 years ago

Hi @Pete - thank for the answer, one of our environments has the version 10.5.2 installed and we have the same problem with Add-PASAccount request. Isn't there a solution for this issue with this version?

pspete commented 4 years ago

immediate solution would be to use the parameters for the newer api requests available in that version.

Add-PASAccount -secretType Password -secret $secureString -address $Computer -userName $username -platformID $platformID -SafeName $safe

The fix for the issue you reported is already present in the psPAS dev branch.

pete commented 4 years ago

Hello, @oscarITPRO! I'm flattered that you value my expertise, but I could not tell you for certain. I have not ever used PowerShell.

oscarITPRO commented 4 years ago

Hi @pete reviewed the result of new parameters i have seen a issue "secretManagement : @{automaticManagementEnabled=True; status=failure; lastModifiedTime=1585856964}". You can see the status=failure. Do you know what could be wrong?

Info 02-abr-2020 19:52:13 AccountID : 58_18 Info 02-abr-2020 19:52:13 Safe : _PRE Info 02-abr-2020 19:52:13 address : hostname Info 02-abr-2020 19:52:13 userName : Administrator Info 02-abr-2020 19:52:13 name : Operating System-WinServerLocal-hostname-Administrator Info 02-abr-2020 19:52:13 platformId : WinServerLocal Info 02-abr-2020 19:52:13 secretType : password Info 02-abr-2020 19:52:13 secretManagement : @{automaticManagementEnabled=True; status=failure; Info 02-abr-2020 19:52:13 lastModifiedTime=1585856964} Info 02-abr-2020 19:52:13 createdTime : 4/2/2020 7:49:24 PM

Thanks Best regards