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:
- 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.