0

I have a (.net core C#) API to handle image upload, retrieve, delete, etc. Images are uploaded to blob containers, that are dynamically created from the code, with a name given with the POST request when uploading an image. There is also a blob trigger function deployed in Azure to create resized low-quality image for each image uploaded for a given blob container. There is a need to duplicate this image resize function app for each new container that is created. IF duplicated, I need to bind the new container names as the source and destination containers of the new instance of the image-resize function app, AND deploy it in the same resource group as the first function app.

Is there any way I can achieve all of this from the C# code? If not from the code, how can I do this?

7
  • If you want to create new azure function for each blob container dynamically? I think that is not the correct idea. How you will update code? Commented Apr 2, 2020 at 14:39
  • @PankajRawat Azure function code will remain the same, only the container names have to be passed to the bindings. Is it possible at all? Commented Apr 3, 2020 at 3:14
  • I don't think you do this kind of activity with Azure function, Azure function run under sandbox with limited permission. Commented Apr 3, 2020 at 5:19
  • Somehow If you are able to achieve, how you will deploy new code? If you're deploying code through CI/CD or manually that will deploy in single function? how rest of functiion will update? Commented Apr 3, 2020 at 5:20
  • I would recommend, to handle all blob storage changes through single function. You can use EventGrid to listen changes from your blob and take appropriate action. Commented Apr 3, 2020 at 5:22

1 Answer 1

1

I think you should try EventGrid for your requirement. Below image give you a high idea you can change some component according to your business requirement.

enter image description here

EventGrid Topic built-in with storage account so you don't need to create separately.

enter image description here

You can filter which event you want to listen.

enter image description here

Then you can route your message to the appropriate endpoint (Azure Function Or Queue)

enter image description here

If you're storing resize images in the same storage account you will get an event for those images, You can put some logic to filter those image from your Function.

You will not face any latency issue with EventGrid while Blob trigger has some latency issue.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! I switched to an event grid trigger function app as you have suggested and managed to get the task done.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.