Skip to main content

spo site hubsite connect

Connects the specified site collection to the given hub site


m365 spo site hubsite connect [options]


-u, --siteUrl <siteUrl>

The URL of the site collection to connect to the hub site

-i, --id <id>

The ID of the hub site to which to connect the site collection

-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 for more information and examples.

-o, --output [output]

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


Runs command with verbose logging.


Runs command with debug logging.


If the specified site collection is already connected to a hub site, it will be disconnected and connected to the newly specified hub site.

If the specified id doesn't point to a valid hub site, you will get a ResourceNotFoundException error.


Connect a specific site collection to a hub site

m365 spo site hubsite connect --siteUrl --id 255a50b2-527f-4413-8485-57f4c17a24d1


The command won't return a response on success.

More information