Logic app creates unreadable base64 encoded files using HTTP action on Azure Blob Storage
Published Dec 21 2020 12:26 AM 7,428 Views
Microsoft

When the logic app creates a file using HTTP action PUT method on Azure Blob Storage, the file cannot be read as it appears as corrupted when trying to open the file.

 

The main reason for this is that in order to avoid problems with special characters, Logic app uses Base64 encoding to encode files while processing, as a result the created files are Base64 encoded and in order for the files to be created correctly to Azure Blob Storage, it needs to be converted to binary.

 

For example, the following line of text:
Test 1234 as Base64!
would instead appear as:
VGVzdCAxMjM0IGFzIEJhc2U2NCE

 

To resolve this, use base64toBinary() function when creating files on Azure Blob Storage, so we apply this function to the file content passed in the body field of the HTTP action.

 

You will need to switch to code view to apply this function manually, final HTTP body should look like the following:

 

"body": "@{base64ToBinary(items('For_each')?['ContentBytes'])}",
1 Comment
Version history
Last update:
‎Dec 21 2020 12:26 AM
Updated by: