With Reference to my old Thread How to implement My Azure function for using it in PowerApps
Im still struggling with implementing my function to powerapps I dont really know what I have to do next. The function itself is already working. But If I want to execute it over an url it does not work (401 http error)
MY Url: https://XXX.azurewebsites.net/api/XXX/?blobname1=image1.png&blobname2=image2.png
[FunctionName("ConvertMe")]
public async static Task RunASync([HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
[Blob("test", FileAccess.ReadWrite)] CloudBlobContainer blobContainer,
[Blob("test/out3.png", FileAccess.ReadWrite)] CloudBlockBlob outputBlob, ILogger log)
{
try
{
ConvertMe Converter = new ConvertMe();
MemoryStream stream1 = new MemoryStream();
MemoryStream stream2 = new MemoryStream();
log.LogInformation($"Containername: {blobContainer.Name} \nPublic Access: {blobContainer.Properties.PublicAccess} \nOriginal Path: {blobContainer.Uri.OriginalString}");
string name1 = req.Query["blobname1"];
string name2 = req.Query["blobname2"];
CloudBlob blob1 = blobContainer.GetBlobReference(name1);
CloudBlob blob2 = blobContainer.GetBlobReference(name2);
await blob1?.DownloadToStreamAsync(stream1);
stream1.Position = 0;
await blob2?.DownloadToStreamAsync(stream2);
stream2.Position = 0;
MagickImage _Main = new MagickImage(stream1, MagickFormat.Png);
MagickImage _Overlay = new MagickImage(stream2, MagickFormat.Png);
using (MemoryStream memory = new MemoryStream())
{
Converter.ComebineBitmap(_Main, _Overlay).Write(memory, MagickFormat.Png);
memory.Position = 0;
outputBlob.Properties.ContentType = "image/png";
await outputBlob?.UploadFromStreamAsync(memory);
}
}
catch (System.Exception e)
{
log.LogError(e.Message);
}
finally
{
log.LogInformation("Wuhu ich bin durch");
}
}
This is how I want to compose the images in PowerApps OnClick Event
"AzureFunction.ConvertMe(Input1:PictureBox.Image, Input2:PenInput; Output:CDS_Image.OUTputfield)"
So I think I dont really need blobobjects as Inputs or am I misunderstanding something ?
Im trying to follow this guide, but I dont really know how to build/setup the correct swagger.json for my example