pspete / psPAS

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

Invalid parameter `ExpirationDate` when adding application #501

Closed pspete closed 7 months ago

pspete commented 8 months ago

Describe the issue User reports issue adding application with an expiration date

To Reproduce Steps to reproduce the behavior:

  1. Add application using Add-PASApplication specifying an expiration [datetime] value

Expected behavior New Application should be added, with expiration date set.

Screenshots & Console Output If applicable, add screenshots and/or console output to help explain your problem.

> Add-PASApplication -AppID SomeApp -Location "\Applications" -ExpirationDate $((Get-Date).AddDays(3)) 
Invoke-PASRestMethod : [400] Cannot add application. Reason: invalid parameter (parameter: ExpirationDate)
At line:111 char:3
+         Invoke-PASRestMethod -Uri $URI -Method POST -Body $Body -WebS ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: ({"ErrorCode":"C...pirationDate)"}:ErrorRecord) [Invoke-PASRestMethod], Exception
    + FullyQualifiedErrorId : CAWS00001E,Invoke-PASRestMethod

Your Environment Include relevant details about your environment

Additional context Received report via email. Current date format aligns with vendor documentation: https://docs.cyberark.com/PAS/Latest/en/Content/WebServices/Add%20Application.htm?tocpath=Developer%7CREST%20APIs%7CApplications%7C_____4#Bodyparameters

ELANDJEA commented 8 months ago

I can confirm that your fix (date format: mm/dd/yyyy) is also applicable to version 12.2 thanks for your swift responses. I reported this to Cyberark (case: 03657324) and asked them to get their documentation corrected. (I am still a little worried that some other APIs could be affected with the same behaviour if the JSON requires a date format)