I have an Azure Python function:
def main(req: func.HttpRequest) -> func.HttpResponse:
return func.HttpResponse('TEST ERROR MESSAGE', status_code=403)
When I call the function through Powershell, I only receive a generic 403 error message: "The remote server returned an error: (403) Forbidden. I cannot extract the message "TEST ERROR MESSAGE" and I'm not sure why. Any help would be appreciated, I cannot find anything online. Is the error in my PowerShell or my Python? I am making the request and capturing the exception below:
try
{$response = Invoke-WebRequest -URI "https/path/to/func" -Method Get -CertificateThumbprint $Thumb -ErrorAction stop}
catch
{$response = $_.Exception}
If I set the status_code to 200 however, I can see the message "TEST ERROR MESSAGE" fine