Set Content-Type as text/csv instead of text/plain of the blob created using "Create Blob" step in Azure Logic Apps

Shelly Goel 36 Reputation points
2022-02-06T18:19:07.533+00:00

Hello,

I have a "Create Blob" step in my Logic App and I'm trying to create a csv file. I have added the "Blob Content" as the comma separated header value ("assetPath,biddingAgency,campaignType,market") and it works fine but when I check the blob in Azure storage, the blob's content-type is set to text/plain whereas I need it to be text/csv as another action is dependent on this content-type.

I also tried passing below in the blob content but it doesn't help as mentioned here (https://theazureguy.wordpress.com/2020/02/13/setting-blob-content-type-in-logic-apps/comment-page-1/?unapproved=456&moderation-hash=388291d38fa9ea8bf026d0c77c362b4e#comment-456)
{
"$content": "assetPath,biddingAgency,campaignType,market",
"$content-type": "text/csv"
}

When I add "Compose" step with "Content-Type" in it, I get below error on execution
171639-content-type-error.png

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
0 comments No comments
{count} votes

Answer accepted by question author
  1. MayankBargali-MSFT 70,991 Reputation points Moderator
    2022-02-07T11:30:26.887+00:00

    @Shelly Goel The Create blob does accept the Content-Type parameter which you can set it to text/csv as per your requirement.
    The Blob content parameter should only have the content of the blob.

    171903-image.png

    171913-image.png


1 additional answer

Sort by: Most helpful
  1. Ronen Ariely 15,216 Reputation points
    2022-02-06T21:53:01.2+00:00

    Hi,

    (1) Please provide the code you use and not only the error. You can the entire code of the logic apps or image of the flow when all configuration of all operators and trigger are displayed.

    (2) In the following thread I added a full example of how to create csv files, so check if this help in any way please:

    https://learn.microsoft.com/en-us/answers/questions/720189/create-a-folder-and-csv-file-in-sharepoint-based-o.html

    (3) According to the screenshot and the description, your issue is not in the CREATE BLOB but with the Compose action.

    Remove the next action and first fixt this part. Run the app and check that you are getting the right output from the Compose action first.

    By the way, why do you use Compose action !?? What is the input to the Compose action?

    Compose action construct a single output such as a JSON object from multiple inputs. Why do you need JSON in order to CREATE BLOB ?!?

    Take a look at the document: https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-perform-data-operations#compose-action


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.