Skip to content

Bug report: m365 team channel add doesn't work with certificate authentication #7045

@JDziurlaj

Description

@JDziurlaj

Priority

(Low) Something is a little off

Description

m365 team channel add doesn't work when cli-m365 is used with certificate authentication. However, this isn't inevitable as the Pnp.PowerShell CmdLet Add-PnpTeamsChannel works OK. This appears to be due to the difference in underlying APIs used.

Steps to reproduce

  1. Login using certificate authentication.
  2. Run m365 team channel add with any required parameters

E.g. m365 teams channel add --teamName "Team 2" --name "mine" --type "standard" --debug

Expected results

A teams channel is created.

Actual results

{"error":"/me request is only valid with delegated authentication flow."}

Diagnostics

Request:

{
  "url": "https://graph.microsoft.com/v1.0/me/joinedTeams",
  "method": "get",
  "headers": {
    "Accept": "application/json;odata.metadata=none",
    "user-agent": "NONISV|SharePointPnP|CLIMicrosoft365/11.1.0",
    "accept-encoding": "gzip, deflate",
    "X-ClientService-ClientTag": "M365CLI:11.1.0",

    "authorization": "Bearer ***REDACTED_TOKEN***"
  },
  "responseType": "json",
  "decompress": true
}

Response:

{
  "url": "https://graph.microsoft.com/v1.0/me/joinedTeams",
  "status": 400,
  "statusText": "Bad Request",
  "headers": {
    "transfer-encoding": "chunked",
    "content-type": "application/json",
    "vary": "Accept-Encoding",
    "strict-transport-security": "max-age=31536000",
    "request-id": "***REDACTED_GUID***",
    "client-request-id": "***REDACTED_GUID***",
    "x-ms-ags-diagnostic": "{\"ServerInfo\":{\"DataCenter\":\"North Central US\",\"Slice\":\"E\",\"Ring\":\"4\",\"ScaleUnit\":\"001\",\"RoleInstance\":\"CH01EPF00084B99\"}}",
    "date": "Fri, 21 Nov 2025 16:19:52 GMT"
  },
  "error": {
    "error": {
      "code": "BadRequest",
      "message": "/me request is only valid with delegated authentication flow.",
      "innerError": {
        "date": "2025-11-21T16:19:52",
        "request-id": "***REDACTED_GUID***",
        "client-request-id": "***REDACTED_GUID***"
      }
    }
  }
}

CLI for Microsoft 365 version

"v11.1.0"

nodejs version

v20.18.1

Operating system (environment)

Windows

Shell

PowerShell

cli doctor

{
  "os": {
    "platform": "win32",
    "version": "Windows 11 Pro",
    "release": "10.0.26200"
  },
  "cliVersion": "11.1.0",
  "nodeVersion": "v20.18.1",
  "cliEntraAppId": "***REDACTED_GUID***",
  "cliEntraAppTenant": "single",
  "authMode": "certificate",
  "cliEnvironment": "",
  "cliConfig": {
    "autoOpenLinksInBrowser": false,
    "copyDeviceCodeToClipboard": false,
    "output": "json",
    "printErrorsAsPlainText": false,
    "prompt": false,
    "showHelpOnFailure": false,
    "helpMode": "options",
    "authType": "browser",
    "clientId": "***REDACTED_GUID***",
    "tenantId": "***REDACTED_GUID***",
    "errorOutput": "stdout"
  },
  "roles": [
    "User.ReadWrite.All",
    "Group.ReadWrite.All",
    "User.ReadWrite.All",
    "Sites.FullControl.All",
    "User.ReadWrite.All",
    "Sites.FullControl.All"
  ],
  "scopes": {}
}

Additional Info

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions