I have a multitenant application which stores certain custom assemblies for each tenant in blobs in their Azure storage account. These assemblies contain custom code to run reports for the specific tenant who is logged in.
The most straightforward approach I think would be to have the Azure function download the DLLs into it's local workspace and load & execute from there (we use MEF to do this).
Is it possible for an Azure function or a webapp to execute code directly from that blob container?
Azure websites can run out of Azure storage so curious if an azure function can dynamically load and run those assemblies remotely. Obviously, there are security risks to doing so but that what would be the workarounds?
Also, Azure functions actually execute code out of blob storage I discovered while chatting with an Azure rep on a support call though I don't know how they do so and haven't done a POC.
Just looking if this is even possible before running POCs.
You can simply download a blob from a blob storage as byte array, load it as assembly, and use it.
This is a naive implementation of a static function:
I created a class library project
ClassLibrary1and defined a class:Then I uploaded it to Azurite (Local Storage Account Emulator) to blob container
dlls:Result
When I run the Azure Function app and open the URL
http://localhost:7208/api/LoadDllin browser, the result is: