Evolvous | How to Deploy Your Custom Microsoft Copilot on SharePoint? Deploy Your Custom Microsoft Copilot on SharePoint - Evolvous
How to Deploy Your Custom Microsoft Copilot on SharePoint? - Evolvous
Looking for the right solution to your challenges?

How to Deploy Your Custom Microsoft Copilot on SharePoint? 

Microsoft Copilot Studio offers users an excellent opportunity to create a custom AI assistant, based on the robust Microsoft Copilot AI model. Businesses can design their own assistants and deploy them on various channels, including applications like SharePoint. In this article, we will look at how you can deploy Custom Copilot on SharePoint. 

What You Will Learn  

In this article, we will try to cover the important aspects you must be aware of to deploy Copilot on SharePoint. Here are the topics that we will be covering in this article: 

  • Advantages of Copilot in SharePoint 
  • About the Code Sample 
  • How the Code Sample Works 
  • The Process of Deployment. 
  • Common Issues 
  • How Can a SharePoint Consultant Help 

Advantages of Copilot in SharePoint

The ‘standardized’ version of Microsoft Copilot comes pre-installed in SharePoint. However, to have a custom version of the AI assistant, you will need to design it on Microsoft Copilot Studio and then deploy it in your SharePoint environment. Here are some of the advantages of using a custom Microsoft Copilot in SharePoint.

Personalized support: Your users can easily interact with SharePoint and get personalized answers on company policies, HR inquiries, or even tech support issues.  

Improved knowledge management: It can improve knowledge search, by providing context aware recommendations and insights based on user queries. This vastly reduces the time spent searching for information. 

Better document management: Here are some of the ways in which it can help you summarize documents according to your specific requirements. You can also gain useful insights from the documents and get work done faster. 

Read More: The Different Ways You Can Use Copilot for SharePoint 

Discover More About Copilot Studio  

Find out how Copilot Studio can be utilized to design your personalized AI assistant and help you to execute tasks more productively. 

Embrace the Power of AI 

Discover our Microsoft Copilot Services 

About the Code Sample 

Microsoft recently announced the creation of a code sample that demonstrates how users can publish a custom Copilot to their SharePoint sites, with a seamless single sign-on experience. 

The component included in the same allows the copilots created with Copilot Studio to be wrapped and published to SharePoint sites as a floating widget. It is interesting to note that the component also supports Single Sign-On (SSO). This means that users do not have to provide their credentials or use their validation code to use Copilot AI assistant. 

How the Code Sample Works 

The code sample includes a SharePoint Framework extension (SPFx) component. This component can be used to wrap the Copilots created with Microsoft Copilot Studio 

If you, or any other user is accessing a SharePoint site using an Entra ID, then this component acquires a token for the user, exchanges the token with the Copilot. This allows the Copilot to access protected data on SharePoint, on behalf of the user. 

Users can only ask questions on subjects relevant to them. For example, a user can ask ‘Give the sales trends for Q4’, only if the user has access to SharePoint sites for reporting. This prevents unauthorized access to information. 

How to Deploy Custom Copilot for SharePoint – The Process 

The overall process for deploying SharePoint Copilot for SharePoint involves the following phases: 

  • PHASE 1: Configuring Microsoft Entra ID authentication for your copilot. 
  • PHASE 2: Registering your SharePoint site as a canvas app. This is the application that will host your copilot and handle the single sign-on flow. 
  • PHASE 3: Building the SharePoint component and configure its properties  
  • PHASE 4: Uploading the component to SharePoint and add the component to your site. 

Let us now look at the individual steps that you need to take at each of the phases. 

PHASE 1 – Configure Microsoft Entra ID Authentication for Your Copilot 

This step can be completed by following the standard procedure for configuring user authentication with Microsoft Entra ID. However, you will need get some added configuration: 

  • Populate the token exchange URL in the copilot’s authentication settings. Your copilot will send this URL to any custom application hosting it, instructing the custom application it should sign users in by acquiring a token matching this custom scope. The value for “token exchange URL” is the full URI for the custom scope you have added when configuring a custom API. 
  • Add scopes for SharePoint and OneDrive. For your copilot to use the Generative Answers capability over a SharePoint or OneDrive data source, you would need to configure additional scopes for the API permissions assigned to your app. 

PHASE 2 – Register your SharePoint Site as a Custom Canvas

A custom canvas is a custom application that hosts your copilot. In this case, it is also the application that will take care of the sign-in experience. 

Here too, you will need to follow the standard process to configure single sign-on with Microsoft Entra ID. However, when you are configuring canvas app registration, you need to pay attention to the following details: 

  • When adding a platform to the canvas app registration, select “Single-page application” and not “Web.” Web redirect URIs only support the implicit grant flow for authentication, which is considered less secure and cannot be used with MSAL.js 2.x, which is the authentication library included in the code sample provided  
  • The redirect URI should be the same as the URL for your SharePoint site that will host the copilot.  
  • The canvas app registration will need permissions for the custom API that was configured in Step 1. To add this permission, select an API from “APIs my organization uses” and search for the name you have given your copilot app registration in Step 1.  

PHASE 3 – Download and configure the SharePoint SPFx component

Here, you must choose whether to configure and build the component yourself or use the pre-built package included with the code sample. If you choose to deploy the pre-built package, you can skip this step and move directly to Phase 4 

Before you proceed, make sure your development environment includes the following tools and libraries: 

  • VS Code (or a similar code editor) 
  • A version of Node.JS which is supported by the SPFx framework (for this sample, use either v16 or v18) 
  • A Git client for your OS 

If the prerequisites above are satisfied, clone CopilotStudioSamples (github.com) into a local folder. 

  1. Using Visual Studio Code, open the local folder to which you have cloned the repository. 
  2. Locate elements.xml under SharePointSSOComponent/sharepoint/assets, and update the values in the file, using one of the two following options: 

Option 1: You can run the following python script and provide values-based values from Steps 1 & 2 

python .\populate_elements_xml.py 

Option 2: You can manually replace placeholders in elements.xml with actual values. ClientSideComponentProperties accepts an escaped JSON string. 

ClientSideComponentProperties="{"botURL":"YOUR_BOT_URL","customScope":"YOUR_CUSTOM_SCOPE","clientID":"YOU_CLIENT_ID","authority":"YOUR_AAD_LOGIN_URL","greet":TRUE,"buttonLabel":"CHAT_BUTTON_LABEL","botName":"BOT_NAME"}" 

  • Now, after you have populated properties in elements.xml, or if you have left elements.xml untouched and plan to run Configure-MCSForSite.ps1 after building and deploying the component, you will need to open a new terminal in VS Code and navigate to the solution folder (the SharePointSSOComponent folder).  

Here, you will need to run the following commands: 

npm install
gulp bundle --ship
gulp package-solution --ship 

if gulp is not available, install it by running: 

npm install gulp-cli --global 

The gulp package-solution command should create a packaged solution (.sppkg) in the sharepoint/solution folder 

Phase 4: Upload the Component to SharePoint 

Whether you have built the component yourself, or opted to use the pre-built package, you should see a file called pva-extension-sso.sppkg under sharepoint/solution. 

  • You will need to upload the sppkg file using your SharePoint admin center. After uploading the sppkg file, choose Enable App and not Enable this app and add it to all sites. 
  • Once the app has been successfully uploaded and enabled, make sure that it is visible under “Apps for SharePoint” 
  • Add the app to a site where your copilot should be available for users. This should be the same site as the one you provided in Phase 2 above. 
  • Next, you will need to add an app to your site. 
  • If you left elements.xml untouched, or if you are uploading the pre-built package, or even in case you would like to override the values configured in elements.xml for the site on which the component has been deployed, you can now run Configure-MCSForSite.ps1: 

.\Configure-McsForSite.ps1 -siteUrl "<siteUrl>" -botUrl "<botUrl>" -botName "<botName>" -greet $True -customScope "<customScope>" -clientId "<clientId>" -authority "<authority>" -buttonLabel "<buttonLabel>" 

After adding the app (and running Configure-MCSForSite.ps1 in case elements.xml has been left untouched), a button will appear at the bottom of all the pages under the target site. Clicking on the button will open a dialog with a chat canvas for your copilot. Based on the logic of your copilot, users will be signed in automatically at the beginning of the conversation, or when a specific event occurs. 

And that is it you are done! You can now use your smart AI assistant on your SharePoint Environment 

Common Issues that You Might Face 

While using your custom Copilot in your SharePoint environment, there might be a few challenges that you might face. Here are some of the key ones: 

  • Accessing Data and Managing Complex Permissions 

SharePoint security model is sophisticated, to say the least. Most SharePoint environments have permissions at the site, list, library and even item levels. You need to make sure that your custom Copilot has the required permissions. If it does not, then it can provide incomplete or incorrect responses. 

  • Contextual Accuracy and Understanding Queries 

It is obvious that custom Copilots need to interpret user queries correctly. Your SharePoint metadata and search indexes might not be optimized for AI retrieval. In some cases, training the model with custom prompts might be required. In specific scenarios, you might be able to Azure Open AI along with SharePoint Syntex to enhance document understanding and classification. 

  • Latency and Performance Issues 

If Copilot queries trigger expensive API calls or attempts to retrieve large datasets, then it can slow down performance. It can be solved by batch requests and caching frequently accessed data. In some cases, custom Azure functions or Power Automate can also be leveraged to pre-process large datasets, before they are retrieved by Copilot. 

How Can a SharePoint Consultant Help? 

A SharePoint consultant can help you use Copilot more productively within SharePoint. For example, they can help you identify case studies and help you make your data structured for AI Search. 

At Evolvous, we possess in-depth expertise in both SharePoint and Microsoft Copilot Studio. This enables us to deliver tailored solutions that maximize the impact of Copilot in SharePoint.

Boost Productivity with Copilot in SharePoint 

Contact our specialist SharePoint and Copilot consultants and discover how you can improve productivity and derive more value from your SharePoint Data 

Deploy Copilot in SharePoint with Experts – Contact Evolvous Today!