Grant new app token failure

Product: PowerShell Universal
Version: 3.9.15

Trying to dynamically create app tokens for access to authenticated api endpoints and I keep getting the following error when attempting to use “Grant-PSUAppToken”

[error] Status(StatusCode="Unknown", Detail="Exception was thrown by handler.", DebugException="Grpc.Core.Internal.CoreErrorDetailException: {"created":"@1691095900.321000000","description":"Error received from peer ipv6:[::1]:59044","file":"..\..\..\src\core\lib\surface\call.cc","file_line":953,"grpc_message":"Exception was thrown by handler.","grpc_status":2}") 

Here is how I am attempting to create the app token

$date = $($(get-date).AddHours(24))

Grant-PSUAppToken -IdentityName "Test" -Role "Operator" -Expiry $date -Integrated -Verbose

The Test identity is already created

Got this working with a slight work around, I wrapped the grant code into a scriptblock and ran it as a job and was able to get it to work that way.

For anyone else running into this issue make sure you use UTC time if you are setting an expiry time