2 min read

Deploy a custom copilot to SharePoint, with a seamless single sign-on experience

We are excited to share the recent addition to the Copilot Studio Samples repository – a code sample demonstrating how to publish a custom copilot to a SharePoint site, with a seamless single sign-on experience.

Many organizations use SharePoint to power their employee-facing websites, delivering experiences that streamline the way employees interact with the organization and with each other. SharePoint is also the content management platform behind OneDrive, Teams and other Microsoft 365 services.

In 2023, we announced Generative AI features in Microsoft Copilot Studio that transform the traditional model of bot development and allow makers to build copilots that respond to questions, simply by pointing the copilot at knowledge sources like public websites or content stored in SharePoint and OneDrive. Given all the content that is already managed in SharePoint, the Generative Answers capability makes it easier than ever to create an employee-facing, conversational AI experience, that can answer questions on topics like personal time-off, perks and benefits or company policies.

Animated Gif Image

Copilots created with Copilot Studio can be easily published to Microsoft Teams and other channels. However, many use cases would benefit from copilots deployed directly on SharePoint sites, allowing a conversational experience grounded in the sites’ pages and documents. For example, think about a SharePoint site consolidating HR related information, with an embedded copilot answering employee questions and referencing the relevant HR policies.

This can be achieved using the new code sample: the component included in the sample allows copilots created with Microsoft Copilot Studio to be wrapped and published to SharePoint sites as a floating widget. The component also supports SSO, so users would do not have to provide their credentials or use the validation code required by the standard copilot canvas.

The SharePoint Component

How does the new code sample work?

This sample includes a SharePoint Framework Extension (SPFx) component which acts as a wrapper for copilots created with Microsoft Copilot Studio.

A user accessing a SharePoint site has already signed-in using their Microsoft Entra ID credentials. The SPFx component, embedded natively in SharePoint sites, acquires a token for the user, and exchanges the token with the copilot, allowing the copilot to access protected data sources, like SharePoint and OneDrive, on the user’s behalf.

For example, a user with access to a SharePoint site dedicated to Perks and Benefits will be able to interact with an embedded copilot, by asking questions like “do we get reimbursed for professional training?”. The copilot will answer the user’s questions based on the site’s pages and documents, but only those to which the user already has access. Most of this flow is made possible by the Generative Answers capability, with the SPFx component handling single sign-on, so users do not have to enter credentials or a validation code.

How can I deploy the component on my SharePoint site?

Creating a wrapper for Copilot Studio that can be deployed in SharePoint, with SSO support, can be somewhat of an involved process. It requires an understanding of the SPFx framework, as well as setting up the required permissions in Azure.

Luckily, the code sample comes with a step-by-step guide, with detailed instructions on how to:

  • Set up the app registration configurations required for SSO.
  • Set up a Generative Answers node for your copilot, over a SharePoint or OneDrive data source.
  • Build the SPFx component from scratch and bind it to your copilot.
  • Upload the component to the tenant app catalog and deploy on a site.

Suggest feedback or report issues related to the sample here