Skip to main content

connection use

Activate the specified Microsoft 365 tenant connection

Usage

m365 connection use [options]

Options

-n, --name [name]

The name of the connection to switch to.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Remarks

tip

If you haven't disabled the "prompt" setting, running this command without options will show a list of available connections. You can then select the connection to activate it.

You can update the name of a connection by running m365 connection set.

Examples

Switch to a different connection

m365 connection use --name '6e70c8ea-571d-4daf-bc48-9e1b49ac3390'

Switch to another connection by a custom connection name

m365 connection use --name 'myworkaccount'

Response

{
"connectedAs": "alexw@contoso.com",
"connectedName": "028de82d-7fd9-476e-a9fd-be9714280ff3",
"authType": "DeviceCode",
"appId": "31359c7f-bd7e-475c-86db-fdb8c937548e",
"appTenant": "common",
"cloudType": "Public"
}
CTRL + M