Return full Graph API error when called by a Universal API

Product: PowerShell Universal
Version: 1.4.6

All very new to all of this
I am using Default environment (Integrated?)
Installed from PowerShellUniversal.3.8.8.msi

I am using PowerShell Universal to securely proxy calls from a PowerShell script by
connecting to Microsoft Graph and running the following
$uri = ‘xxx://’ + $DeviceRegistrationId + ‘?$expand=deploymentProfile,intendedDeploymentProfile’
$assignedstatus = invoke-GraphRequest -uri $URI

The command works great but, in some cases, the DeviceregistrationID references a device that has been deleted. When running the command in this instance the application script gets the following error. The PU log shows the full error (below) - how can I retrieve the full graph error “404 Not Found” instead of the "(400) Bad Request

What My App Sees
Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
At line:6 char:17

  • … ignStatus = Invoke-RestMethod
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

What the Log Shows on the server (same as if graph call is made in PowerShell)
GET xxx://$expand=deploymentProfile,intendedDeploymentProfile
HTTP/1.1 404 Not Found
Transfer-Encoding: chunked
Vary: Accept-Encoding
Strict-Transport-Security: max-age=31536000
request-id: 9dfbd682-1c14-414f-870b-a87a3324e047
client-request-id: 9dfbd682-1c14-414f-870b-a87a3324e047
x-ms-ags-diagnostic: {“ServerInfo”:{“DataCenter”:“North Central US”,“Slice”:“E”,“Ring”:“3”,“ScaleUnit”:“002”,“RoleInstance”:“CH01EPF0000D369”}}
Date: Fri, 07 Apr 2023 14:15:29 GMT
Content-Type: application/json
Content-Encoding: gzip

{“error”:{“code”:"ResourceNotFound",“message”:“{\r\n "_version": 3,\r\n "Message": "An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 9dfbd682-1c14-414f-870b-a87a3324e047 - Url: xxx://‘c689dfe8-cd85-44e7-95af-d689afc3b370’)?api-version=5022-12-08&$expand=deploymentProfile%2cintendedDeploymentProfile",\r\n "CustomApiErrorPhrase": "",\r\n "RetryAfter": null,\r\n "ErrorSourceService": "",\r\n "HttpHeaders": "{}"\r\n}”,“innerError”:{“date”:“2023-04-07T14:15:30”,“request-id”:“9dfbd682-1c14-414f-870b-a87a3324e047”,“client-request-id”:“9dfbd682-1c14-414f-870b-a87a3324e047”}}}
Status: 400 Content-Type: application/json Length: 1528