pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
985 stars 665 forks source link

[BUG] New-PnPTenantSite fails with SSL/TLS error #2927

Open priteshmohanty opened 3 years ago

priteshmohanty commented 3 years ago

Reporting an Issue or Missing Feature

Intermittent Error occurs in Pnp Scripts used for automation. For e.g. New-PnPTenantSite throws Error occured: Message - Could not establish secure channel for SSL/TLS with authority '...msoprd.msft.net'

Expected behavior

New site should be created without an error. Observed in Remove-PnPTenantSite as well

Actual behavior

Site gets created in the background but cmdlet throws error

Steps to reproduce behavior

Connect-PnpOnline -Url $adminUrl New-PnPTenantSite -Url $newSiteFullURL -Title $newSiteName -Template 'STS#3' -Owner $adminUserName -TimeZone $timeZone -Force

Which version of the PnP-PowerShell Cmdlets are you using?

What is the version of the Cmdlet module you are running?

3.24.2009.1

How did you install the PnP-PowerShell Cmdlets?

tvahk commented 3 years ago

Same issue with me.

arunkumarperumal commented 3 years ago

Same issue in one of the tenant but with CSOM and also in pnp powershell.

aravindvaishnavam commented 3 years ago

Having same issue here...

brhlavinka commented 3 years ago

This is happening to me intermittently while using CSOM.

brhlavinka commented 3 years ago

CallStack.txt Error call stack attached for reference.

Here is a snippet of code that is failing:

internal static void CreateSite(BuildContext context, ISiteRequest request) { var tenant = new Tenant(context.Admin); var siteCreationProperties = new SiteCreationProperties() { Url = request.SiteUrl, Owner = GetClientOwnerUserEmail(context), Title = request.Name, Template = SP_TEMPLATE, TimeZoneId = 11 }; ExecuteAndWaitForCompletion(context.Admin, tenant, tenant.CreateSite(siteCreationProperties)); }

khamphou commented 3 years ago

same here since a few days, it worked without issues since many monthes

ToddKlindt commented 3 years ago

If you run this before the cmdlet, does it work?

aravindvaishnavam commented 3 years ago

@ToddKlindt no, i have tried this as well bit didnt work.. Its very intermittent..

andygjones-nz commented 3 years ago

Same here but in CSOM and even when trying to just read a tenant site e.g. tenant.GetSitePropertiesByUrl(siteUrl, true) Returns error: Could not establish secure channel for SSL/TLS with authority 'gm.ylo001.msoprd.msft.net'. Usually if retried for long enough it eventually works.

Code running from Azure functions and has been fine for over a year - seen this intermittently in last few days.

brhlavinka commented 3 years ago

Similarly to @andygjones-nz, my logic is hosted in Azure and has been working perfectly for over a year. My comment from two days ago with the CallStack.txt attached is happening less frequently. The logic which is failing more frequently is reading from tenant: tenant.GetSiteProperties(0, true).

@KoenZomers and @erwinvanhunen do we have an ETA on a fix? Or at least understand a potential workaround?

erwinvanhunen commented 3 years ago

At first hand this seems to be a server side issue as the servers are the changing variables here. If it works sometimes and sometimes not, our code has not changed in between those calls. I can see what we can figure out, it is however rather difficult to debug given that we cannot reproduce it. Hence its not possible to provide an ETA for a fix or if it something we from PnP can fix at all...

arunkumarperumal commented 3 years ago

For the powershell graph API call, the solution we got from Microsoft Premier support was to install a certificate on the server where we have the job running. This seems to have solved the issue with powershell.

We still have the intermittent issue with CSOM code.

brhlavinka commented 3 years ago

@erwinvanhunen thank you for commenting! A couple follow-up questions:

  1. Can you get in touch with the team that has made server variable changes to let them know the intermittent problem we're seeing? If not, who can we reach out to in order to voice our concern?
  2. The primary call that's failing intermittently is tenant.GetSiteProperties(0, true). I found a potential workaround to use tenant.GetSitePropertiesFromSharePointByFilters(filters) instead. It seems to be working and not failing. Is this a viable approach or have I just got lucky? I am wondering if perhaps under-the-hood if those methods do the same thing and will have the same intermittent problem?

Thanks again!!!

ruruzhanzhan commented 3 years ago

image the app deployed on Azure, in recent 5 days, it failed to provisioning site, is there any change on the API? employees in our company cannot create any site, it's urgent!! @ToddKlindt @erwinvanhunen

image image

balakrishna-D commented 3 years ago

is this issue got fixed yet?

priteshmohanty commented 3 years ago

Hi all, we haven't been seeing this issue now since yesterday. Not sure if there was any change done to address this. We tried with CSOM and PNP and dont get that error any more. New-PnPTenantSite -Url $newSiteFullURL -Title $newSiteName -Template 'STS#3' -Owner $adminUserName -TimeZone $timeZone -Force

brhlavinka commented 3 years ago

I have not been experiencing this issue anymore. Will report back if it happens again.