How to add Microsoft Entra ID authentication to an add-in for Excel?

Enrico Rossini 206 Reputation points
2025-08-12T15:47:25.12+00:00

I'm creating an add-in for Excel using Blazor following the code I found on GitHub.

Because this add-in is an internal project for my company, I want to authenticate the users before showing any part of the application.

How can I integrate the authentication with Microsoft Entra ID?

Microsoft 365 and Office | Development | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dora-T 3,225 Reputation points Microsoft External Staff Moderator
    2025-08-13T03:11:44.6666667+00:00

    Hi @Enrico Rossini

    Thank you for posting your question on the Microsoft Q&A Forum.  

    Based on my research, Excel Add-ins are displayed inside a task pane, which is essentially hosted inside an iframe. Many identity providers, including Microsoft Entra ID, appear to block sign-in pages from loading inside iframes for security reasons. So if you try to sign in directly within the task pane, it may not work as expected. 

    It also seems that this isn’t limited to Excel on the web. On the desktop version of Excel, the add-in runs inside a built-in browser control called a webview. While it’s not an iframe, it can still have security restrictions that interfere with sign-in flows, especially those involving redirects or cookies. 

    To make authentication work smoothly across both web and desktop platforms, Microsoft recommends using the Office Dialog API. This API lets you open a separate browser window where the sign-in page can load properly. After the user signs in, you can pass the result back to the task pane using a simple messaging method. 

    You can find the article for more information: Authenticate and authorize with the Office dialog API - Office Add-ins | Microsoft Learn 

    I hope this helps you. If you have any other questions, please feel free to let me know.


    If the answer is partially 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.

    0 comments No comments

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.