Share via


Deploy your agent to Azure and register with Azure Bot Service manually

The details for deploying your agent depend on how you create your agent.

You can create an agent using the Microsoft 365 Agents SDK in three ways:

  • Start with the Microsoft 365 Agents Toolkit in C#, JS, or Python using Visual Studio or Visual Studio Code
  • Clone from a sample and open in your IDE
  • Use the CLI, as shown in the quickstart

We suggest you start off with the Microsoft 365 Agents Toolkit. The toolkit reduces the manual steps required to create, test, and deploy agents getting you up and running with your agent faster. That said, you might wish to go through the manual steps. This guide covers how to deploy your agent without using the Agents Toolkit, to Microsoft 365 Copilot and Microsoft Teams.

Create your agent with Agents SDK

To deploy your agent, you need to create your agent and be ready to deploy it. This means having access to your target deployment channel—for example, Microsoft 365 Copilot or Microsoft Teams.

You also need access to set up Azure Resources, and admin access to Microsoft 365 Admin Center (MAC) or Teams Admin Center (TAC).

You also need to manually upload a manifest to either MAC or TAC.

This process is commonly referred to as side-loading.

Create an Azure Bot Service app and app registration

Create your Azure Bot Service (ABS) app and ensure it has the same App ID as your ABS record.

An agent can work with either single or multitenant configurations. However, for this test, it's best to stay with single-tenant.

In your app registration, create a client ID and secret.

Ensure the configuration file in your Agents SDK agent (for example, appSettings.json in .NET agents) is updated with the client ID, secret and tenant information:

  "TokenValidation": {
    "Audiences": [
      "{ClientID}" // this is the Client ID used for the Azure Bot Service
    ],
    "TenantId": "{TenantID}"
  },

  "Connections": {
    "BotServiceConnection": {
      "Settings": {
        "AuthType": "ClientSecret", // this is the AuthType for the connection, valid values can be found in Microsoft.Agents.Authentication.Msal.Model.AuthTypes.  The default is ClientSecret.
        "AuthorityEndpoint": "https://login.microsoftonline.com/common", // common is used for multi tenant. If single tenant replace 'common' with tenantID
        "ClientId": "{ClientID}", // this is the Client ID used for the connection.
        "ClientSecret": "{ClientSecret}", // this is the Client Secret used for the connection.
        "Scopes": [
          "https://api.botframework.com/.default"
        ]
      }
    }
  },

Publish your agent to a web app

Publish your agent into your web app so that you have an endpoint like example.azurewebsites.net.

Once your app is published, navigate to your ABS instance and under the Configuration heading change the Messaging endpoint to https://{yourwebsite}/api/messages.

Test in Web Chat

To see your message in web chat, select Test in Web Chat in your ABS instance and trigger your agent.

Test using Dev Tunnels

If your website isn't deployed, but you want to test from your local host, run your code, and get the port number it runs on (for example, port 5000).

Open DevTunnels and enter:

host -a -p port {portnumber}

In the console that opens, you should see a URL to paste into your ABS app under the Messaging Endpoint section in the configuration.

Prepare your Teams and Microsoft 365 Copilot .zip package

For Microsoft Teams and Microsoft 365 Copilot, you need to create and upload a manifest file with two images.

  1. Create an empty folder, and make a copy of the Microsoft 365 Copilot manifest template file from the Agents SDL GitHub.

  2. In the template, replace the Client IDs with your Client ID. This is the Client ID agent you made earlier. The manifest file references the bot ID and runs it from where it's hosted.

Note

This manifest file may change.

  1. Add in the color and outline images and name them correctly. Ensure the name of your app is how you expect it to show up in Microsoft 365 Copilot and Teams. Also, ensure you review all the related information in the manifest and update it from the templates. The template should contain information related to your agent, such as terms and privacy policy.

Deploy to Microsoft 365

  1. In the ABS instance in Azure, select Channels and turn on Microsoft Teams.

  2. Navigate to the Microsoft Admin Portal (MAC). Under Settings and Integrated Apps, select Upload Custom App.

  3. Upload your app. The manifest should pass and you should be able to deploy your app.

  4. After a short period of time, the app shows up in Microsoft Teams and Microsoft 365 Copilot. You need to have the $30 SKU for Microsoft 365 Copilot at the moment to support CEAs and have a tenant enabled for private preview.

Summary

You have successfully deployed your agent. You can now test the agent directly from the deployed channel.