Register your own Entra app (recommended)

teams signs in with a delegated Microsoft Graph identity: it acts as a user, never as an application. By default it uses the Microsoft Graph CLI Tools public client, which many tenants block or restrict. Registering your own app takes a few minutes, needs one admin consent, and gives you a stable client_id you control.

You need an Entra ID tenant, permission to register an application (or an admin who will do it), and one person who can consent on behalf of the tenant.

1. Create the registration

  1. In the Entra admin center open Applications → App registrations → New registration.
  2. Name it something recognisable, for example teams CLI.
  3. Supported account types: Accounts in this organizational directory only. (Use Multitenant only if people outside your tenant will sign in.)
  4. Leave the redirect URI empty for now and create it.

2. Let the CLI sign in

Open the new registration's Authentication page:

  1. Add a platform → Mobile and desktop applications and add http://localhost as a redirect URI. Entra ignores the port for a localhost redirect, so the CLI's ephemeral port works with this one entry.
  2. Under Advanced settings, set Allow public client flows to Yes. Without it, the device-code flow (teams auth login --device) fails.

If the browser flow still answers AADSTS50011, that redirect URI is what is missing.

3. Add the delegated Graph permissions

On API permissions → Add a permission → Microsoft Graph → Delegated permissions, add the set that matches how you will use the CLI. teams doctor tells you which commands each set unlocks.

Preset Delegated permissions
chats User.Read, User.ReadBasic.All, People.Read, Chat.ReadBasic, Chat.Read, Chat.ReadWrite, ChatMessage.Send, Files.ReadWrite
read-only chats without the three writes, plus Team.ReadBasic.All, Channel.ReadBasic.All, ChannelMessage.Read.All, TeamMember.Read.All, Files.Read.All
full read-only plus ChannelMessage.Send, ChannelMessage.ReadWrite, Chat.ReadWrite, ChatMessage.Send, Files.ReadWrite.All

Notes:

Then click Grant admin consent (or send the request to an admin).

4. Keep it maintainable

5. Point the CLI at it

teams config set profiles.me.client_id 00000000-0000-0000-0000-000000000000
teams config set profiles.me.tenant contoso.com        # or the tenant ID
teams config set profiles.me.scopes full               # chats | read-only | full
teams auth login
teams doctor

teams doctor reports the account, the scopes the token carries, and what each command needs; teams auth status --admin-request prints the consent text for anything still missing.

Doing the same for a service account

Register one app (or reuse this one), give the service account a Teams license, and sign in once as that user:

teams auth login --profile bot --device
teams --profile bot chat list

The token cache is stored for that profile on that machine. Reading the cache from an unattended runner (Key Vault) is on the roadmap; TEAMS_ACCESS_TOKEN is the workaround until then, for a token your runner mints itself.