Issue invoking script from within app page

Hello!

I am trying to use Invoke-PSUScript from within an application page to get a return string. The script lives in the default repository at the root and is set to run in Integrated mode. The script is simply fetching app version information from the web, so no credentials are necessary. No roles are assigned to it, and when run manually from the Scripts page, the job completes without issue.

When invoking the script from within an app page using this command:

$OnlineVersion = Invoke-PSUScript -Script 'Get-LatestAppVersion.ps1' -App "Chrome" -Integrated -TrustCertificate

I get the following error:

Cannot retrieve the dynamic parameters for the cmdlet. Unauthenticated. Specify an app token, use default credentials or enable permissive security model.

I’ve configured the appsettings.json to enable “Permissive” mode and to trust certificates:

"Api": {
    "OpenAPI": {
      "Name": "Endpoints",
      "Description": "Endpoints defined within the PowerShell Universal admin console.",
      "Url": "v2",
      "Version": "v2"
    },
    "Url": "",
    "SecurityModel": "Permissive",
    "TrustCertificate": true
  }

It is my understanding that invoking a script from within the same server should work here without authentication so long as the security model is set to permissive, but I may be missing something. If it matters, I am logged in as ‘admin’. Any insight is greatly appreciated!

Product: PowerShell Universal
Version: 5.0.14 (initially on 5.0.13)

One of my scripts was having the same error, no matter where I was running it from. It seemed to be coming from the line where I retrieved cached items (get-psucache).

Is your script doing something similar?

The script I am referencing had no PSU commands, actually. Although I did just re-design it to use the PSU cache and was able to accomplish what I needed, thank you! I will still need to call scripts from apps in the future so I’m hoping this issue can be solved.