Open blanghorst opened 5 years ago
Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.
New-PnPSite -Type CommunicationSite -Title $name -Description $description -Url $fullSiteUrl -Wait:$true
Add-PnPHubSiteAssociation -Site $fullSiteUrl -HubSite $hubSiteUrl
sometimes results in file not found, sometimes association works, i think it is some kind of race condtition
I get 403 error on New-PnPSite so might be related?
powershell.exe Error: 0 : 2021-01-06 17:55:00.0681 [OfficeDevPnP.Core] [0] [Error] ExecuteQuery threw following exception: System.Net.WebException: The remote server returned an error: (403) Forbidden.
at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func
2 endFunction, Action1 endAction, Task
1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.SPWebRequestExecutor.1.FromAsyncCoreLogic(IAsyncResult iar, Func
2 endFunction, Action1 endAction, Task
1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.SPWebRequestExecutor.
### Reporting an Issue or Missing Feature When using PnP powershell commands with a tenant with MFA, you must use the -UseWebLogin switch when authenticating in order to log in with your password and trigger the MFA (in this case, Microsoft Authenticator). However, when doing so, the Add-PnPHubSiteAssociation command always fails.
When using the -UseWebLogin switch in the Connect-PnPOnline, the command functions as expected.
### Expected behavior The Add-PnPHubSiteAssociation command should register the site to the hub without issue after authenticating.
### Actual behavior Following authentication, the command errors out with the following error (debug logging was enabled):
powershell.exe Error: 0 : 2019-07-10 09:27:53.8866 [OfficeDevPnP.Core] [0] [Error] ExecuteQuery threw following exception: System.Net.WebException: The remote server returned an error: (403) Forbidden. at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactoryd0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.ClientContext.d b.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.ClientContext.d8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.ClientContext.d 4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.SharePoint.Client.ClientContextExtensions.d__7.MoveNext(). 0ms
Add-PnPHubSiteAssociation : The remote server returned an error: (403) Forbidden.
1.FromAsyncCoreLogic(IAsyncResult iar, Func
2 endFunction, Action1 endAction, Task
1 promise, Boolean requiresSynchronization) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.SharePoint.Client.SPWebRequestExecutor.### Steps to reproduce behavior On any tenant (even one without MFA enabled), executing the following script results in the error above:
$siteURL= site's address $hubURL=hub site's address Connect-PnPOnline -Url $siteURL -UseWebLogin Add-PnPHubSiteAssociation -Site $siteUrl -HubSite $hubURL
### Which version of the PnP-PowerShell Cmdlets are you using?
### What is the version of the Cmdlet module you are running? (you can retrieve this by executing
Get-Module -Name *pnppowershell* -ListAvailable
) 3.11.19.xx is installed### How did you install the PnP-PowerShell Cmdlets?