Microsoft Copilot Studio enables organizations to build intelligent, secure, and context-aware bots that can be embedded directly into Dynamics 365. These bots can assist users by surfacing relevant data, automating responses, and improving case resolution efficiency without leaving the application.
In this blog, we will walk through the end-to-end process of creating a Case Assistant bot using Copilot Studio and embedding it into a Dynamics 365 side pane. The bot will leverage Dataverse knowledge to suggest similar cases, authenticate securely using Microsoft Entra ID, and provide real-time assistance within the Case form.
Access Copilot Studio
Navigate tohttps://copilotstudio.microsoft.com

Click on the New Agent button.
Provide a suitable name for your bot.
Enter a prompt/description outlining the purpose and type of bot you wish to build.
If required, provide additional details or specifications to further tailor the bot to your business needs.

Once the configuration is complete, click Publish to make the bot available.
Then, navigate to Settings.
Select Security to manage and configure access, permissions, and other security-related settings for your bot.
In Security and select Authentication.

Choose Authenticate Manually, and under Service Provider, select Microsoft Entra ID V2 (Client Secret).
Use the Client ID and Client Secret from the Azure App Registration that is automatically created when the bot is provisioned.

To generate a Client Secret, open the App Registration in the Azure Portal, navigate to Certificates & Secrets, create a new secret, and copy the generated value to use in Copilot Studio.

Copy the Redirect URL provided in Copilot Studio Security and add it to the Redirect URI section of the App Registration in the Azure Portal under Authentication.

After adding the redirect URL, save the authentication settings and publish the bot again to apply the changes.
In the Knowledge tab of your bot, add the entity you want to work on as a knowledge source. I am adding the Case entity as a knowledge source. Since I am creating a Case Assistant bot, this will allow the bot to retrieve and suggest similar cases that already exist in the system, helping users resolve issues more quickly.

Navigate to the Channels tab in Copilot Studio, open your bot, and select the Web App.

After selecting the Web App, the embed HTML code will be available for use. Copy this code and create a new HTML Web Resource within your solution in Power Apps. You can also apply customizations to adjust the size of the side pane in your app.

Add a JavaScript web resource to open the bot in the side pane when the form loads. Additionally, upload an image web resource to represent the bot. In the JavaScript code, reference the HTML web resource created earlier and set the image source to the uploaded bot image.

//CaseAssistant.js
const botPaneId = "caseBotPane"; |
Now, navigate to your app, open any Case record, and click on the bot in the side pane

When you click Login, a code will be generated in a separate tab. Enter this code as the input, and once authenticated, you will be logged in and can start asking for similar cases.

Now, you can see the bot actively responding and providing relevant answers within the side pane.

Frequently Asked Questions (FAQ’s):
1. Can I use the bot in entities other than Case?
Yes. You can add any Dataverse entity as a knowledge source based on your business requirements, such as Leads, Opportunities, or Bookings.
2. Where does the bot appear inside Dynamics 365?
The bot appears in a side pane within the form, allowing users to interact with it without navigating away from the record.
3. Can the bot suggest similar records automatically?
Yes. When configured with a knowledge source, the bot can analyze input and suggest similar existing records to help users resolve queries faster.
4. Is it possible to control when the bot opens?
Yes. Using JavaScript, you can configure the bot to open on form load, button click, or any custom event.
5. What happens if I update the bot content later?
You need to publish the bot again in Copilot Studio for the updates to reflect in Dynamics 365.
6. Can the bot be closed by users?
Yes. The side pane can be configured to allow users to close or reopen the bot as needed.
7. Is it possible to change the bot name and branding later?
Yes. You can update the bot name, icon, and description anytime in Copilot Studio and reflect those changes in your app.



