Set-PSUCache Failing

I am new to PowerShell Universal and am planning on utilizing the cache to lookup data. I am testing this feature out and receiving an error. Any suggestions?

Set-PSUCache -Key “CurrentDate” -Value (Get-Date)

[Error] [7/9/2025 4:18:58 PM] An error occurred while sending the request.

Powershell host log:
2025-07-09 16:18:58.267 -05:00 [ERR] Job failed. An error occurred while sending the request. at System.Management.Automation.Runspaces.AsyncResult.EndInvoke()
at System.Management.Automation.PowerShell.EndInvoke(IAsyncResult asyncResult)
at UniversalAutomation.Host.JobService.d__8.MoveNext() in D:\a\universal\universal\src\Host\JobService.cs:line 232

Edit:
Just wanted to add, in PowerShell on the server itself I was able to run Set and Get-PSUCache without any issues after running Connect-PSUServer with an app token. I cannot run Get-PSUCache on a script in PSU.

Does Connect-PSUServer need to be ran on the script? If so, I am struggling to find a way to grab the app token from the secret variables without first connecting to PSUServer.

Product: PowerShell Universal
Version: 5.5.4

I solved this myself. Turns out when you use a custom hostname/certificate, you also need to update the API_URL in appsettings.json. Once I updated that, no need to connect-psuserver, I can just hit the cache directly.

1 Like