OK, just found out a reason why I cannot get the solution working. This is a (part of) the code I'm using. I ran the code also on an on-prem instance, and it worked flawlessly:
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
# Interact with query parameters or the body of the request.
$name = $Request.Body.Name
$base64String = $Request.Body.base64String
[System.IO.File]::WriteAllText($env:TEMP + "\SomeFile.txt", "My value")
Get-ChildItem -Path $env:TEMP
$bmp = [System.Drawing.Bitmap]::FromStream((New-Object System.IO.MemoryStream (@(, [Convert]::FromBase64String($base64String)))))
$memory = New-Object System.IO.MemoryStream
$null = $bmp.Save($env:TEMP + "\temp.png", [System.Drawing.Imaging.ImageFormat]::Png)
$memory.Position = 0
But when it runs in Azure Functions, it shows this error:
"A generic error occurred in GDI+."
I searched for it on the internet, and found some years old threads for on-prem problems, but none of them were solving my problem.
Any solutions would be highly appreciated!