Setting up Direct Line

Calibrant uses the Direct Line channel to send test queries to your Copilot Studio agent during optimization runs. You need to enable the channel and copy its secret key.

What is Direct Line? It's a Microsoft Bot Framework channel that lets external apps communicate with your bot via a REST API — the standard way to programmatically interact with Copilot Studio agents outside of Teams.

Step 1: Enable the Direct Line channel

  1. Go to copilotstudio.microsoft.com and open your agent.
  2. Click Channels in the left sidebar.
  3. Find Direct Line in the channel list.
  4. Toggle it on if it isn't already enabled.
If Direct Line isn't visible in Copilot Studio, you can enable it from the Azure portal instead — see Step 2.

Step 2: Get the secret key

From the Azure Portal (recommended)

  1. Go to portal.azure.com.
  2. Search for "Azure Bot" in the top bar.
  3. Select the bot resource for your Copilot Studio agent.
  4. Click Channels in the left nav.
  5. Click on Direct Line (or add it if not listed).
  6. Click Show next to either secret key and copy it.
Keep this secret safe. It grants full access to send messages to your agent. Calibrant encrypts it at rest and never exposes it in client-side code.

From Copilot Studio

  1. Open your agent in Copilot Studio.
  2. Go to SettingsChannelsDirect Line.
  3. Copy the secret key shown.

Step 3: Verify it works

Test the secret by starting a conversation via the Direct Line API:

curl -X POST \
  https://directline.botframework.com/v3/directline/conversations \
  -H "Authorization: Bearer YOUR_SECRET_HERE" \
  -H "Content-Type: application/json"

A 201 Created response with a conversationId means the secret is valid. A 401 means the secret is wrong or the channel isn't enabled.

Troubleshooting

Can't find the Azure Bot resource

Copilot Studio auto-provisions it in a Microsoft-managed resource group. You may need Azure subscription owner permissions to see it. Try searching by the bot's name.

Direct Line returns 403 Forbidden

The channel may be disabled or the bot's messaging endpoint is misconfigured. Check the Azure Bot resource → Configuration → verify the messaging endpoint URL.

Do I need both secret keys?

No — just one. Azure provides two so you can rotate without downtime. Give Calibrant either one.


Next steps

With both the Agent ID and Direct Line secret, you're ready to register your agent in Calibrant.