pspete / psPAS

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

Add-PASSafeMember: A parameter cannot be found that matches parameter name 'MemberType' #443

Closed nidhinckgithub closed 1 year ago

nidhinckgithub commented 1 year ago

Describe the issue While executing Add-PASSafeMember cmdlet, getting missing MemberType attribute.

To Reproduce Execute below cmdlet Add-PASSafeMember -SafeName TestSafe2 -MemberName member -SearchIn Vault -UseAccounts $true -RetrieveAccounts $true -ListAccounts $true

Expected behavior A clear and concise description of what you expected to happen.

Screenshots & Console Output image


<--Invoke-PASRestMethod : [400] There are some invalid parameters: Property [MemberType] not found, Missing mandatory parameter [MemberType].
At line:276 char:13
+ ...   $result = Invoke-PASRestMethod -Uri $URI -Method POST -Body $Body - ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: ({"Details":[{"E...id parameters"}:ErrorRecord) [Invoke-PASRestMethod], Exception
    + FullyQualifiedErrorId : PASWS167E,PASWS179E,PASWS011E,Invoke-PASRestMethod

-->

Your Environment Include relevant details about your environment

Additional context Add any other context about the problem here.

pspete commented 1 year ago

Hi @nidhinckgithub

That doesn't sound right for 12.2.... and issue cannot be reproduced here in 12.6 image

The vendor documentation here shows that MemberType is not a parameter for the API function at version 12.2: https://docs.cyberark.com/Product-Doc/OnlineHelp/PAS/12.2/en/Content/WebServices/Add%20Safe%20Member.htm?tocpath=Developer%7CREST%20APIs%7CSafes%7CSafe%20members%7C_____1#Bodyparameters

walidhammad commented 1 year ago

@nidhinckgithub I saw you comment on the ISPSS issue which for that MemberType is required. @hjbotha-cybr has a fork where he added this in here https://github.com/hjbotha-cybr/psPAS/commit/aea05638f36a0efcf926396154c7ac5b33df40f9 which I have been using successfully for adding members to safe in ISPSS environment.

nidhinckgithub commented 1 year ago

@walidhammad Thanks a lot. After making the change you have suggested now I'm able to pass the MemberType and make it work. Thanks @hjbotha-cybr @pspete - Sorry for the confusion. I think i need to mention the cyberark version as cloud

whip113 commented 1 year ago

Yes, the REST API for safe members has different required parameters for the Shared Services Platform Privilege Cloud than the one for self-hosted. I had a docs issue raised to clarify this, but it wouldn't have been applied to the 12.2 docs. Check the later version docs for this as they should have the updated requirements.

pspete commented 1 year ago

Will add an optional MemberType parameter to Add-PASSafeMember in the next module release.

pspete commented 1 year ago

Added memberType parameter