Sp-starter-kit: Apply-PnPTenantTemplate : Action 1 (joinHubSite) is invalid. Parameter hubSiteId has an invalid value.

Created on 27 Mar 2020  Â·  23Comments  Â·  Source: pnp/sp-starter-kit

Category

  • [ ] Question
  • [x] Bug
  • [ ] Enhancement

Expected Behavior
Successful deployment of the solution running the command:
PS S:\Downloads\sp-starter-kit-master\provisioning>Apply-PnPTenantTemplate -Path starterkit.pnp

Observed Behavior
The command cancels with the following error:
PS S:\Downloads\sp-starter-kit-master\provisioning> Apply-PnPTenantTemplate -Path starterkit.pnp
Apply-PnPTenantTemplate : Action 1 (joinHubSite) is invalid. Parameter hubSiteId has an invalid value.
At line:1 char:1
+ Apply-PnPTenantTemplate -Path starterkit.pnp
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Apply-PnPTenantTemplate], ServerException
+ FullyQualifiedErrorId :EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.Tenant.ApplyTenantTemplate

Steps to Reproduce
Followed all pre-requisite steps in the documentation and starter guide

Author Feedback answered

Most helpful comment

Based on the error, my next suggest would be to validate you are a term store admin. The message before access denied in the verbose log is reading collabcommunicationsite.json, which is for a site script. It is possible that you are running into a problem adding the site scripts / site designs.

Quick way to test, in PnP PS, connect to your tenant then use the commands:
Get-PnPSiteScript and Get-PnPSiteDesign to see site scripts and site designs named similar to: {Company Name} Team Site and/or {Company Name} Communication Site. If these are in your tenant, then the process must be failing during the PnP Sequencing, which first step is to add terms.

If the site designs / site scripts are not there, then the provisioning process is unable to apply general tenant settings, meaning your account must not be a tenant admin, or modern authentication is getting in the way.

All 23 comments

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

For what it's worth, I just downloaded the starter-kit last week, and provisioned a developer tenant. I'm getting the same "hubSiteID has an invalid value" error.

Thank you for post. We'll take a look!

We're just experiencing the same issue as well.

Same experience here.

I just tested the starter kit using the latest provisioning template to a fresh SPO tenant, using PnP PS version 3.20.2004.0. I ensured that all pre-reqs had been met from https://github.com/SharePoint/sp-starter-kit#pre-requirements.

The solution provisioned as expected, including the hub association, including without any general errors.

I am not sure why you are receiving this error.

  • What version of PnP PowerShell do you have installed?
  • The solution creates/uses one comm site and two team sites. Are you having the provisioning process create new comm/team sites or are you applying the solution over existing sites?
  • What authentication method is configured for your tenant?
  • What is the primary language of your tenant?
  • Does anything get provisioning, in particular the comm site, and if so, please check its settings, is it a hub site?

In general, the hub association occurs as part of the provisioning via a provisioning template setting:
. Best guess at the moment is that either the comm site is not being properly set as a hub site by the provisioning template, or that the hubsiteurl is not yet available. Assuming all pre-reqs are met.

Either the comm

I've just tried a new tenant and am getting the same error. I'm sure I've completed all Getting Started and Pre-Requisites as per the instructions. I've provided details to your questions below.

  • SharePointPnPPowerShellOnline 3.20.2004.0
  • I'm trying to provision the solution as per default. i.e. create communication site and the two team sites.
  • Modern authentication was enabled by default on new tenant

  • English

  • Nothing appears to provision at all. There is no comms site created after the error is presented.

Appreciate the response and investigation.

I've provisioned a new tenant, using the default Authentication and the default language is English.
SharePointPnPPowerShellOnline - version 3.19.2003.0
I don't believe the Apply-PnPTenantTemplate process added any sites. The sites in my tenant are:

  1. A Communication site that is the default site of the tenant (not a Hub)
  2. The Apps catalog created as part of the prerequisites (..\sites\Apps)
  3. A Team site with the same name as the Tenant (..\sites\tenant) I think this is an Office 365 Group
  4. A Team site called All Company (..\sites\allcompany)
    I don't see any references to "Contoso" anywhere in the tenant.

Thanks for all y'all do.

I think this issue could be related to the Microsoft outage in relation to managing Site Information.

If you look to this article, this includes the settings for Hub Site as I cannot currently join Site to Hub at present using the GUI Hub Settings.

SP209373, SharePoint Online, Last updated: April 21, 2020 12:15 AM
Start time: March 16, 2020 8:28 AM, End time: April 20, 2020 8:02 PM

I would advise to retry it now that it's resolved

@pragdigi - I was hoping that would be the answer. I tried again this morning and got the same error.

PS C:\Users\CastleS\SharePoint Framework\sp-starter-kit-master\provisioning> Apply-PnPTenantTemplate -Path .\starterkit.pnp -Parameters @{"Company"="Castleberry Enterprises";"SiteUrlPrefix"="TDAppsDev";"WeatherCity"="Dallas"}
Apply-PnPTenantTemplate : Action 1 (joinHubSite) is invalid. Parameter hubSiteId has an invalid value.
At line:1 char:1

  • Apply-PnPTenantTemplate -Path .\starterkit.pnp -Parameters @{"Company ...
  • ~~~~~~~~~~~~~~~~~

    • CategoryInfo : WriteError: (:) [Apply-PnPTenantTemplate], ServerException

    • FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.Tenant.ApplyTenantTemplate

@RSCastleS are you able to confirm that you can create a hub site in the browser? Then can you join another site to that new hub site? All in the browser?

I’ll give that a shot and let you know.

Scott Castleberry
IT Applications Manager
972-888-9500

From: Eric Overfield notifications@github.com
Sent: Wednesday, April 22, 2020 10:28 AM
To: SharePoint/sp-starter-kit sp-starter-kit@noreply.github.com
Cc: Castleberry, Scott Scott.Castleberry@TDIndustries.com; Mention mention@noreply.github.com
Subject: Re: [SharePoint/sp-starter-kit] Apply-PnPTenantTemplate : Action 1 (joinHubSite) is invalid. Parameter hubSiteId has an invalid value. (#383)

Caution: The email is from an external sender, not from TDIndustries. Please do not open attachments or click links unless you know the content is safe. If in doubt, forward this email to [email protected]SpamCheck@tdindustries.com for verification.

@RSCastleShttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FRSCastleS&data=01%7C01%7Cscott.castleberry%40tdindustries.com%7Cf4185ed603254e9031ca08d7e6d1b70a%7C590ab1a81803401c979648117d6a9baa%7C0&sdata=YLWBo0IoD5VsPMmmipJhUQpWnx8bDyKvEF06zT5rz9U%3D&reserved=0 are you able to confirm that you can create a hub site in the browser? Then can you join another site to that new hub site? All in the browser?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FSharePoint%2Fsp-starter-kit%2Fissues%2F383%23issuecomment-617849363&data=01%7C01%7Cscott.castleberry%40tdindustries.com%7Cf4185ed603254e9031ca08d7e6d1b70a%7C590ab1a81803401c979648117d6a9baa%7C0&sdata=VAwF4ZmIzcLLthggpXDwg8E0H5bWn74AQNOMtmTj7iY%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAO63QLCXWPF63TNVTY6SAK3RN4EHHANCNFSM4LU7Y7TA&data=01%7C01%7Cscott.castleberry%40tdindustries.com%7Cf4185ed603254e9031ca08d7e6d1b70a%7C590ab1a81803401c979648117d6a9baa%7C0&sdata=p4drZeZx39U6rWVnkrBsBl5Sv2JCFhBwARH4juG8u%2FE%3D&reserved=0.

Eric,

From the tenant-admin.sharepoint.com page, I was able to create a Communications site and a Team site. Next, I Registered the Communications site as a Hub and associated the Team site with the new Hub.

Thanks for following up!

Scott Castleberry
IT Applications Manager
972-888-9500

From: Eric Overfield notifications@github.com
Sent: Wednesday, April 22, 2020 10:28 AM
To: SharePoint/sp-starter-kit sp-starter-kit@noreply.github.com
Cc: Castleberry, Scott Scott.Castleberry@TDIndustries.com; Mention mention@noreply.github.com
Subject: Re: [SharePoint/sp-starter-kit] Apply-PnPTenantTemplate : Action 1 (joinHubSite) is invalid. Parameter hubSiteId has an invalid value. (#383)

Caution: The email is from an external sender, not from TDIndustries. Please do not open attachments or click links unless you know the content is safe. If in doubt, forward this email to [email protected]SpamCheck@tdindustries.com for verification.

@RSCastleShttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FRSCastleS&data=01%7C01%7Cscott.castleberry%40tdindustries.com%7Cf4185ed603254e9031ca08d7e6d1b70a%7C590ab1a81803401c979648117d6a9baa%7C0&sdata=YLWBo0IoD5VsPMmmipJhUQpWnx8bDyKvEF06zT5rz9U%3D&reserved=0 are you able to confirm that you can create a hub site in the browser? Then can you join another site to that new hub site? All in the browser?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FSharePoint%2Fsp-starter-kit%2Fissues%2F383%23issuecomment-617849363&data=01%7C01%7Cscott.castleberry%40tdindustries.com%7Cf4185ed603254e9031ca08d7e6d1b70a%7C590ab1a81803401c979648117d6a9baa%7C0&sdata=VAwF4ZmIzcLLthggpXDwg8E0H5bWn74AQNOMtmTj7iY%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAO63QLCXWPF63TNVTY6SAK3RN4EHHANCNFSM4LU7Y7TA&data=01%7C01%7Cscott.castleberry%40tdindustries.com%7Cf4185ed603254e9031ca08d7e6d1b70a%7C590ab1a81803401c979648117d6a9baa%7C0&sdata=p4drZeZx39U6rWVnkrBsBl5Sv2JCFhBwARH4juG8u%2FE%3D&reserved=0.

I'm facing the same issue. It was working fine sometime back. I've used it multiple times.
But it seems something have changed in last couple of days. Please confirm if you get the root cause.

Error:
Apply-PnPTenantTemplate : Action 1 (joinHubSite) is invalid. Parameter hubSiteId has an invalid value.

Hi all, making possible progress. This error looks to be generated by the site scripts included with the kit. The site scripts are used to apply the app customizer on both comm and team sites related to the kit, as well as create the hub association. The site scripts use an internal token {SiteCollectionId} that is supposed to be replaced. Still investigating where this is breaking down as in my dev tenants I use to test, including one recently created, I am not seeing the general issue myself.

Thanks for the update!!

I appreciate your work on this.

Scott Castleberry
IT Applications Manager
972-888-9500

From: Eric Overfield notifications@github.com
Sent: Tuesday, April 28, 2020 11:53 AM
To: SharePoint/sp-starter-kit sp-starter-kit@noreply.github.com
Cc: Castleberry, Scott Scott.Castleberry@TDIndustries.com; Mention mention@noreply.github.com
Subject: Re: [SharePoint/sp-starter-kit] Apply-PnPTenantTemplate : Action 1 (joinHubSite) is invalid. Parameter hubSiteId has an invalid value. (#383)

Caution: The email is from an external sender, not from TDIndustries. Please do not open attachments or click links unless you know the content is safe. If in doubt, forward this email to [email protected]SpamCheck@tdindustries.com for verification.

Hi all, making possible progress. This error looks to be generated by the site scripts included with the kit. The site scripts are used to apply the app customizer on both comm and team sites related to the kit, as well as create the hub association. The site scripts use an internal token {SiteCollectionId} that is supposed to be replaced. Still investigating where this is breaking down as in my dev tenants I use to test, including one recently created, I am not seeing the general issue myself.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FSharePoint%2Fsp-starter-kit%2Fissues%2F383%23issuecomment-620728978&data=01%7C01%7Cscott.castleberry%40tdindustries.com%7C42e909a237f640bc58f608d7eb948e47%7C590ab1a81803401c979648117d6a9baa%7C0&sdata=Lgz%2FV8Ku40geyCQ2VTFPJBD8ywLF1M8q7mBDVksXrAA%3D&reserved=0, or unsubscribehttps://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAO63QLGGSBGR6WSB6OMFFVLRO4CVHANCNFSM4LU7Y7TA&data=01%7C01%7Cscott.castleberry%40tdindustries.com%7C42e909a237f640bc58f608d7eb948e47%7C590ab1a81803401c979648117d6a9baa%7C0&sdata=AFaJfMuXMX%2B2KdbqneuZwXFzWfoKWRgkBh0%2F06Co6kw%3D&reserved=0.

Please download starterkit.pnp from https://github.com/SharePoint/sp-starter-kit/tree/dev-site-scripts/provisioning and provision the kit as your normally would with this candidate pnp tenant template. This is a temporary dev branch that updates the pnp template to remove the hub site association in the installed site scripts.

When the tenant template is applied, two site scripts are added, one for a team site design and another for a communication site design. The tenant template then deploys three sites, (1 comm, 2 team). When provisioning these three sites, the template sets the comm site as a hub, and has the two team sites join the hub. Site designs are not used for this action, there is not a reason for the site scripts to attempt join a hub.

This new pnp template provided above tested out well for me. If we receive additional positive feedback, it will be pushed to the master branch.

Best guess is that the SP service has been updated to validate site scripts more vigorously for some tenants. We are removing the root issue in the scripts.

@eoverfield - Next steps... I've downloaded the updated pnp template, and tried to provision the kit one more time. This time, I got a permission denied error. I'm not sure what more permissions I could have - I created the tenant, and am the Global Admin and the only user in the tenant. I suspect the updated template has fixed the problem but I need a pointer on the security configuration.

Thanks

What authentication method do you have configured for your tenant? Also, could you provide a screenshot of the error in PS that includes the Apply command?

@eoverfield ,
I have "Modern Authentication" enabled in the tenant.
I've Set-PnPTraceLog -On -Debug and re-run the Apply-PnPTenantTemplate. here are the results:

PS C:\Users\CastleS\SharePoint Framework\sp-starter-kit-master\provisioning> Apply-PnPTenantTemplate -Path starterkit.pnp -Parameters @{"Company"="Castleberry Enterprises";"SiteUrlPrefix"="TDAppsDev";"WeatherCity"="Dallas"}
powershell_ise.exe Information: 0 : 2020-05-03 22:09:44.4194 [OfficeDevPnP.Core] [0] [Information] File starterkit.pnp retrieved from folder 0ms
powershell_ise.exe Information: 0 : 2020-05-03 22:09:44.5364 [OfficeDevPnP.Core] [0] [Information] File starterkit.pnp retrieved from folder 0ms
powershell_ise.exe Information: 0 : 2020-05-03 22:09:45.4925 [OfficeDevPnP.Core] [0] [Information] File starterkit.xml retrieved from folder 0ms
powershell_ise.exe Information: 0 : 2020-05-03 22:09:45.8738 [Provisioning] [13] [Information] ProgressDelegate registered 0ms db732372-591a-4b91-a387-b74d719b0e5f
powershell_ise.exe Information: 0 : 2020-05-03 22:09:45.8738 [Provisioning] [13] [Information] MessagesDelegate registered 1ms db732372-591a-4b91-a387-b74d719b0e5f
powershell_ise.exe Information: 0 : 2020-05-03 22:09:45.8738 [OfficeDevPnP.Core] [0] [Information] File resources\resources-core.en-us.resx retrieved from folder 0ms
powershell_ise.exe Information: 0 : 2020-05-03 22:09:45.8738 [OfficeDevPnP.Core] [0] [Information] File resources\resources-core.es-es.resx retrieved from folder 0ms
powershell_ise.exe Information: 0 : 2020-05-03 22:09:45.8894 [OfficeDevPnP.Core] [0] [Information] File resources\resources-core.fr-fr.resx retrieved from folder 0ms
powershell_ise.exe Information: 0 : 2020-05-03 22:09:45.8894 [OfficeDevPnP.Core] [0] [Information] File resources\resources-core.de-de.resx retrieved from folder 0ms
powershell_ise.exe Information: 0 : 2020-05-03 22:09:45.8894 [OfficeDevPnP.Core] [0] [Information] File resources\resources-core.nl-nl.resx retrieved from folder 0ms
powershell_ise.exe Information: 0 : 2020-05-03 22:09:45.8894 [OfficeDevPnP.Core] [0] [Information] File resources\resources-core.nb-no.resx retrieved from folder 0ms
powershell_ise.exe Information: 0 : 2020-05-03 22:09:45.8894 [OfficeDevPnP.Core] [0] [Information] File resources\resources-core.sv-se.resx retrieved from folder 0ms
powershell_ise.exe Information: 0 : 2020-05-03 22:09:45.8894 [OfficeDevPnP.Core] [0] [Information] File resources\resources-core.tr-tr.resx retrieved from folder 0ms
powershell_ise.exe Information: 0 : 2020-05-03 22:09:46.3750 [OfficeDevPnP.Core] [0] [Information] File sharepoint-starter-kit.sppkg retrieved from folder ..\package 0ms
powershell_ise.exe Information: 0 : 2020-05-03 22:12:45.5297 [OfficeDevPnP.Core] [0] [Information] File collabteamsite.json retrieved from folder resources 0ms
powershell_ise.exe Information: 0 : 2020-05-03 22:12:48.9725 [OfficeDevPnP.Core] [0] [Information] File collabcommunicationsite.json retrieved from folder resources 0ms
**Apply-PnPTenantTemplate : Access denied. You do not have permission to perform this action or access this resource.
At line:1 char:1

  • Apply-PnPTenantTemplate -Path starterkit.pnp -Parameters @{"Company"= ...
  • ~~~~~~~~~~~~~~~~~

    • CategoryInfo : WriteError: (:) [Apply-PnPTenantTemplate], ServerUnauthorizedAccessException

    • FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.Tenant.ApplyTenantTemplate**

Hope this helps.

Based on the error, my next suggest would be to validate you are a term store admin. The message before access denied in the verbose log is reading collabcommunicationsite.json, which is for a site script. It is possible that you are running into a problem adding the site scripts / site designs.

Quick way to test, in PnP PS, connect to your tenant then use the commands:
Get-PnPSiteScript and Get-PnPSiteDesign to see site scripts and site designs named similar to: {Company Name} Team Site and/or {Company Name} Communication Site. If these are in your tenant, then the process must be failing during the PnP Sequencing, which first step is to add terms.

If the site designs / site scripts are not there, then the provisioning process is unable to apply general tenant settings, meaning your account must not be a tenant admin, or modern authentication is getting in the way.

@eoverfield Bang!! you nailed it. I added myself as the Taxonomy Administrator, and everything's working. I really appreciate your patience and help with this.

Thanks

Closing issue as "answered". If you encounter similar issue(s), please open up a NEW issue. Thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonasbjor picture jonasbjor  Â·  8Comments

tchagan picture tchagan  Â·  4Comments

88naveen picture 88naveen  Â·  8Comments

esjimenezp picture esjimenezp  Â·  9Comments

karigeir picture karigeir  Â·  5Comments