Invoke-PSUScript fails when using custom role - PSU version 5.5.1

Invoke-PSUScript fails when using custom role - PSU version 5.5.1

avatar
(anonymous user)

Not sure what’s going on here. I’ve created an app which uses Invoke-PSUScript. Everything works fine when using the built-in administrator role. But if I try to create a custom role and use that to limit access, I get the following error:

Cannot retrieve the dynamic parameters for the cmdlet. Status(StatusCode=“unknown”, Detail=“Bad gRPC response. HTTP status code: 500”)

I’ve tried:

Invoke-PSUScript -name ‘Myfolder/My_script.ps1’ -TrustCertificate

Invoke-PSUScript -name ‘My_script.ps1’ -TrustCertificate

Invoke-PSUScript -script ‘Myfolder/My_script.ps1’ -TrustCertificate

Invoke-PSUScript -script ‘My_script.ps1’ -TrustCertificate

The custom role has all permissions for testing purposes:

MyCustomRole automation.scripts.MyFolder\My_Script.ps1 All

MyCustomRole automation All

MyCustomRole apps All

MyCustomRole apis All

MyCustomRole portal All

MyCustomRole platform All

MyCustomRole home All

MyCustomRole support All

MyCustomRole settings All

MyCustomRole security All

I’ve tried granting this custom role to:

Scripts

Apps,

Variables(secrets)

I’ve tried testing with both a local account and my test SSO/Entra account.

In the same app I’ve also got Get-PSUJob and this works great no matter which role is assigned.

All Comments (3)

avatar

I’ve seen this error a few times with Get-PSUApp command. I managed to work around it using the ‘-Integrated’ parameter.

I’m not sure if the same parameter is valid for Invoke-PSUScript, but if it is it might work around the problem.

avatar
(anonymous user)

Thanks for the suggestion. I did try to use -integrated. This produced a different error.

I’ve just tried to add a different built-in role (Execute) to my test users. This also works. So there seems to be some kind of difference between the built-in roles vs. a new custom role.

avatar

Try adding script reader as a nested role to your custom roles.