Hello, @Peter Salmon,
Great to know that the issue has already been resolved and thanks for sharing the solution so that others experiencing the same thing can easily reference this!
Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others(https://docs.microsoft.com/en-us/answers/support/accepted-answers#why-only-one-accepted-answer)", I'll repost your solution in case you'd like to "Accept (https://learn.microsoft.com/en-us/answers/support/accept-answer#accepted-answer-in-a-question-thread)" the answer).
Issue Symptom:
The author wanted to be able to enable an Exchange Online account (the same account that is registered with Azure Accounts) to send emails from the Azure Functions application. When running the MS Graph API to perform this, it persistently failed to authenticate with credentials and the following exception occurred:
Having tried to run it within the Visual studio dev environment, he has published the app to online staging environment as well and tried it there, with exactly the same results.
Resolution:
The issue was the Type of API permissions given to the app for Microsoft.Graph.Mail.Send. Anyone who wants to send an email from an Azure function app this must be an Application (not Delegated) permission.
Hope you can consider accepting the answer as it could help other members of the Microsoft Q&A community who have similar questions and are looking for solutions.
Thank you for helping to improve Microsoft Q&A!
Best Wishes,
Alex Zhang