Inconsistent Teams Connector Behavior Between Tenants: "Too many base64 images" Error

Leonardo Valério 0 Reputation points
2025-07-02T19:26:53.3333333+00:00

We are encountering a 400 - BadArgument: "Too many base64 images in the message" error when using the "Post message in a chat or channel" action in Power Automate to send a message with embedded Base64 images to Microsoft Teams.

The crucial point is that an identical flow works perfectly in our development tenant (Tenant A) but consistently fails in our client's tenant (Tenant B), even when sending a single 13 KB image.

Solution Architecture:

Our Power Automate flow has a daily recurrence trigger. It uses the "Get items" SharePoint action to fetch scheduled communications. For each communication, it runs a loop that:

  1. Uses "Get attachments" to retrieve the image files from the SharePoint item.

Enters a nested "Apply to each" loop for each attachment.

Inside the loop, it uses "Get attachment content" and converts the file content to a Base64 string.

This Base64 string is used to build an HTML tag: <img src="data:image/jpeg;base64,...">.

All image tags are concatenated into a single String variable.

Finally, the "Post message in a chat or channel" action sends the message, with the HTML body containing the embedded images.

Observed Behavior:

Tenant A (Our Environment - Success): The flow executes perfectly, even with 3 or more images, and the message is posted in Teams with all images rendered correctly.

Tenant B (Client's Environment - Failure): The same flow, whether imported or rebuilt from scratch, consistently fails with the "Too many base64 images" error, even with a single 13 KB image.

Analysis and Investigation Done:

Our analysis of the API response headers shows that successful requests in Tenant A are processed by data centers in the US (headers indicate wus), while the failing requests in Tenant B are processed in Brazil (headers indicate sbr).

This leads us to believe the issue is not with our flow's logic, but rather with a service policy or an API protection limit that is applied differently in the Teams infrastructure for the Brazil region compared to the US region.

Direct Questions for the Microsoft Team:

Is the Too many base64 images error a documented service limit for the Teams message API? If so, what is the exact limit (e.g., number of images, total payload size), and where can we find this documentation?

Is this limitation a policy that can be configured by a Teams or M365 administrator, or is it a non-configurable, fixed service protection limit?

Can you confirm if the behavioral difference we are observing between our tenants is likely due to different service protection policies being enforced in different Microsoft data center regions (e.g., US vs. Brazil)?

Considering our use case (a user attaches multiple files to a SharePoint item, and they must be displayed as rendered images in a single Teams message), what is Microsoft's officially recommended architecture to achieve this reliably across all tenants, avoiding this error?

Thank you for any clarification you can provide. This inconsistency is currently a blocker for a key project deployment for our client.User's image

Microsoft Teams | Development
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Prasad-MSFT 9,236 Reputation points Microsoft External Staff Moderator
    2025-07-03T05:29:45.34+00:00

    There is no official public documentation specifying the exact number of base64 images or total payload size allowed in a Teams message. The Teams messaging limits documentation only covers overall message size (typically 28 KB), not the number or size of base64 images. In practice, the limit is often 1–3 base64 images per message or a much lower total payload size when base64 images are present, but this is not officially published and may differ by region.

    No, this is a non-configurable, fixed service protection limit enforced by Microsoft Teams backend. It cannot be changed or overridden by Teams or M365 administrators.

    Microsoft’s Recommended Approach:

    • Do not embed images as base64 in Teams messages for production scenarios.
    • Instead, upload images to SharePoint, OneDrive, or Teams Files, get the image URLs, and reference them in your message using <img src="URL"> tags.

    Thanks, 

    Prasad Das

    ************************************************************************* 

    If the response is helpful, please click on "upvote" button. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.

    0 comments No comments

  2. Tammy-Ng 1,490 Reputation points Microsoft External Staff Moderator
    2025-07-03T05:50:26.3666667+00:00

    Hi Leonardo Valério 

    Thanks for reaching out to the Microsoft Q&A forum and bring this valuable discussion to our attention Your detailed description helped narrow down my research and allowed me to provide the most helpful response possible:   
    1. Is the Too many base64 images error a documented service limit for the Teams message API?  If so, what is the exact limit (e.g., number of images, total payload size), and where can we find this documentation? 
    From my research, there is no official Microsoft documentation that directly references a “Too many base64 images” error. However, related documentation suggests that using base64-encoded images can contribute to exceeding the maximum message size limits in Microsoft Teams. 

    • Such as the note below when using base64-encoded images in Adaptive cards. You can find it here Image - Adaptive Cards 

    undefined

    + Teams Message Size Limits: Indicates a limit of approximately 40 KB per post per channel: Limits and specifications for Microsoft Teams - Microsoft Teams | Microsoft Learn 
    + Connector Message Size Limit: Shows a 28 KB limit for messages sent via connectors: https://learn.microsoft.com/en-us/connectors/teams/?tabs=text1%2Cdotnet#known-issues-and-limitations-with-actions 

    + Content Throughput Limits: Provides general guidance on payload limits across Microsoft services. https://learn.microsoft.com/en-us/power-automate/limits-and-config#content-throughput-limits  

    2. Is this limitation a policy that can be configured by a Teams or M365 administrator, or is it a non-configurable, fixed service protection limit?    This limitation is a non-configurable, fixed service protection limit. It is enforced by Microsoft to maintain platform stability and performance. Administrators do not have the ability to modify or override these constraints.   

    3. Can you confirm if the behavioral difference we are observing between our tenants is likely due to different service protection policies being enforced in different Microsoft data center regions (e.g., US vs. Brazil)?   

    As part of general Microsoft support, we do not have access to internal databases or infrastructure due to privacy and compliance constraints. Therefore, we cannot confirm whether regional differences in service protection policies are responsible for the behavior you're observing.    4. Considering our use case (a user attaches multiple files to a SharePoint item, and they must be displayed as rendered images in a single Teams message), what is Microsoft's officially recommended architecture to achieve this reliably across all tenants, avoiding this error?  Given our limited access to controlled testing environments, we are unable to provide a definitive architectural recommendation tailored to your use case.  That said, for user-specific scenarios, relate to Power Automate, I highly recommend posting your question in the Power Platform Community. This forum includes experienced developers and members who can offer practical, tested solutions specific to your situation. 

    I sincerely hope this information helps you clarify your situation. If you have any updates or additional information, please don't hesitate to share.   


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".          

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.   


Your answer

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