Add-PnPHubSiteAssociation does not work as expected

LuIs DP 21 Reputation points
2020-12-17T12:58:15.013+00:00

Hi,

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

thx,
Luis

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

Accepted answer
  1. JoyZ 18,056 Reputation points
    2020-12-18T05:50:55.677+00:00

    Hi @LuIs DP ,

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

    Connect-PnPOnline -Url https://tenant.sharepoint.com -Credentials (Get-Credential)   
    Add-PnPHubSiteAssociation -Site https://tenant.sharepoint.com/sites/NoGroup -HubSite https://tenant.sharepoint.com/sites/Communications  
    

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

    Connect-PnPOnline -Url https://tenant.sharepoint.com -UseWebLogin  
    Add-PnPHubSiteAssociation -Site https://tenant.sharepoint.com/sites/NoGroup -HubSite https://tenant.sharepoint.com/sites/Communications  
    

    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:

    49411-image.png

    SharePoint admin center level:

    49327-image.png


    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