Add-PnPHubSiteAssociation does not work as expected

LuIs DP 21 Reputation points


I tried to associate a site with a hub site and keep getting this error:

No connection, please connect first with Connect-PnPOnline

Then I tried to connect with Connect-PnPOnline and tried running the cmdlt again

Same error.

Is there a work around?

This is important for the migration project im working on and the documentation online for this is no existent

Any help would be appreciated


A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,546 questions
0 comments No comments
{count} votes

Accepted answer
  1. JoyZ 18,041 Reputation points

    Hi @LuIs DP ,

    Per my test it works well to run following pnp powershell as a global admin:

    Connect-PnPOnline -Url -Credentials (Get-Credential)   
    Add-PnPHubSiteAssociation -Site -HubSite  

    If you have multi-factor authentication (MFA) enabled, please connect to SharePoint with browser based login:

    Connect-PnPOnline -Url -UseWebLogin  
    Add-PnPHubSiteAssociation -Site -HubSite  

    As a workaround, we could associate a SharePoint site with a hub site in UI at site level and SharePoint admin center level:

    Site level:


    SharePoint admin center level:


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Most helpful