Hi @ssel ,
I see issue with the body that is being passed to the api call via ps script
Refere this IDN: Update Role Membership using Patch API Call
To change the the body of patch call then try again
For try to share the ps script by removing sensitive data maybe I can help you out there
Thanks in advance
Avinash