Skip to content

Bug Report: Cannot connect to Copilot Studio Agent using SDK sample #327

@Cobra86

Description

@Cobra86

Bug Report: Cannot connect to Copilot Studio Agent using SDK sample

Language / Version

  • Language: C# (.NET 8.0)
  • Package Version: Microsoft.Identity.Client 4.63.1
  • SDK Use: Agents SDK — Copilot Studio Client Sample

Agent Hosting Details

  • Hosting: Local development (on-prem)
  • Deployment Target: N/A (running console client sample)
  • Azure Bot Services: No
  • Client Type: Console Client (from GitHub sample)
  • .NET Runtime: .NET 8.0

Describe the Bug

When attempting to connect the Copilot Studio Client to an agent environment using the provided SDK sample, authentication fails with AADSTS7000218 (“client_assertion or client_secret missing”) followed by a subsequent 403 Forbidden when calling StartConversationAsync.

I’ve tested both:

  • User Login (AD) — using MSAL interactive login
  • Service-to-Service (S2S) — using App registration and secret

Both methods fail to authenticate or authorise the request to the Copilot Studio environment.


Error Details

Exception 1 – Authentication

Microsoft.Identity.Client.MsalServiceException:
A configuration issue is preventing authentication.
Original exception: AADSTS7000218: The request body must contain the following parameter: 'client_assertion' or 'client_secret'.

Exception 2 – Agent Connection

System.Net.Http.HttpRequestException:
Error sending request: Forbidden.

Config Used

"CopilotStudioClientSettings": {
  "DirectConnectUrl": "",
  "EnvironmentId": "[REDACTED]",
  "SchemaName": "[REDACTED]",
  "TenantId": "[REDACTED]",
  "AppClientId": "[REDACTED]",
  "AppClientSecret": "[REDACTED]"
}

To Reproduce

  1. Clone the repo:

    git clone https://github.com/microsoft/Agents
    cd samples/dotnet/copilotstudio-client
  2. Update appsettings.json with environment and Azure AD details.

  3. Attempt to run the console client and connect using:

    • User interactive login, or
    • App registration + Client Secret (S2S).
  4. Observe the authentication failure followed by a 403 Forbidden error when the app calls:

    await foreach (Activity act in copilotClient.StartConversationAsync(...))

Expected Behaviour

The SDK should successfully:

  • Authenticate using either user login or app registration (S2S).
  • Establish a connection to the Copilot Studio hosted agent.
  • Begin streaming messages from the Copilot Agent into the console client.

Screenshots

1. Authentication error (AADSTS7000218)

Image

2. Forbidden error (403) during StartConversationAsync

Image

Additional Context

  • The same app registration credentials successfully authenticate against Microsoft Graph, so the Azure AD configuration is valid.
  • The issue seems specific to the Copilot Studio Client SDK flow.
  • It’s unclear if the SDK sample requires a specific redirect URI, App Role Assignment, or API permission scope setup that differs from documented guidance.

Metadata

Metadata

Labels

TriageNew issue, yet to be triaged

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions