Sign in (MSAL)
cs_loginAuthenticate to Microsoft Copilot Studio cloud tools by acquiring a Microsoft Entra token. Supports interactive browser sign-in or device code flow.
Instructions
Acquire a Microsoft Entra token for the cloud tools (evaluations, environments, agents, publish, chat, drift). mode 'interactive' (default) starts a browser sign-in and returns within waitSeconds: status 'ok' when it completed, otherwise status 'pending' with the sign-in URL. If no browser opened, show the user that URL to open on the machine running this server; the page redirects to localhost and the login completes in the background (check cs_login_status or call any cloud tool). mode 'device_code' returns a code to enter at microsoft.com/devicelogin (some tenants block this flow). Not needed for pac commands, which use 'pac auth create'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Default interactive | |
| scope | No | Which resource to pre-authorise. Default powerplatform (evaluations); 'flow' is the Power Automate service used by the flow-run tools; 'graph' reads the Microsoft 365 agent catalogue and 'graph_write' also blocks and reassigns. Others are acquired silently later when possible. | |
| clientId | No | Entra app (client) id for MSAL. Defaults to CPS_CLIENT_ID, then the first-party VS Code id. | |
| tenantId | No | Entra tenant id. Defaults to the workspace sync metadata, then CPS_TENANT_ID. | |
| workspace | No | Path to (or inside) the agent workspace. Defaults to CPS_WORKSPACE or the current directory. | |
| openBrowser | No | interactive: try to open the browser from the server (default true). Set false when the server runs where no browser can appear. | |
| waitSeconds | No | interactive: how long to wait for the sign-in before returning 'pending' (default 15; keep it below the client's tool timeout) | |
| dataverseUrl | No | Required when scope is dataverse, e.g. https://org.crm.dynamics.com |