Azure Uploader for Power Platform is here

Azure Storage with its high availability and numerous features has always been a storage of choice for many requirements. When it comes to Power Platform we should carefully weigh the options that we have for storing files. Besides the native Dataverse that is fully integrated with the platform, but comes with the highest costs, there are other alternatives like SharePoint and Blob storage in Azure Storage.

Diagram displays a horizontal line with three logos displayed on top. On the left, the line points to Best integration,
Power Platform storage options comparison

Azure Uploader is a PCF control that is built to reduce the effort of integrating with Azure’s Blob storage. It makes it easy to upload files with virtually no limit in size, directly to blob storage in a secure way.

You might be wondering why directly from the browser and what about the security. To store files in blob container you have two major options.

  • The first option is to upload the file to a proxy service and the proxy service would then upload the file to the storage behind the scene. This gives you the advantage of being able to do some processing (e.g. validate the content) before storing the file. But it comes with the extra effort required to build the service and maintain it over time. In addition to that you need to make sure this new service has the required availability (or SLA) required for your application. As the old saying goes, you will have one more layer that things can go wrong.
  • The second option is to have a very simple proxy service (that you might already have) generate a short-lived SAS token with limited access, share it with the client and the client would take care of uploading the file. This way you can rely on the availability and capacity of Azure Storage service.

You should consider that files coming from the client cannot be trusted, so you might need to put in place a process to validate them before use. In the first approach the proxy service is able to validate files during the transfer, but in the second approach you should do this validation later. For example a Power Automate flow, a Logic App, or an Azure Function App can be triggered and do this asynchronously.

Azure Uploader relies on the second approach. This means that you just need to generate a SAS token in your app and share it with the uploader. Generating a SAS token is very easy thanks to the out-of-the-box Azure Storage Blob connector.

The following Power FX code, generates a new SAS token using Azure Storage Blob connector (called AzureBlobStorage) and stores it in a variable called SasToken.

Set(
    SasResult,
    AzureBlobStorage.CreateShareLinkByPathV2(
        "mystorageaccount",
        "/mycontainer",
        {
            AccessProtocol: "HttpsOnly",
            ExpiryTime: DateAdd(Now(), Hours, 1),
            Permissions:"Write,Add,Create"
        }
    )
);
Set(
    SasToken,
    Mid(SasResult.WebUrl, Find("?", SasResult.WebUrl) + 1)
);
  • The above code, generates a code that is valid only for one hour DateAdd(Now(), Hours, 1) and only has Write,Add,Create permissions.
  • The SasResult variable that is set in the first step contains a property WebUrl which holds a URL that has the SAS token in its query string. That is why the line Mid(SasResult.WebUrl, Find("?", SasResult.WebUrl) +1) is used to extract only the part after “?” store it in SasToken variable.

Posted

in

by

Comments

2 responses to “Azure Uploader for Power Platform is here”

  1. agudelod Avatar

    Hi, im tried to use the component in the Power Apps mobile version but i’m having a little issue. When I clicks the upload button from a android device, the photo gallery doesn’t list a video files, only show image files, but if tried from a IOS device works fine.

    ¿Maybe do you know how to resolve this Android issue?

    1. Reza Avatar

      I have not tried in with Android, but my guess is that it can be an issue with the Power Apps app in Android. In the component I don’t do any filtering of the files.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: