When requests go through one at a time then all works as expected.
Expected behavior
$site = Get-PnPTenantSite -Url $existingUrl -ErrorAction SilentlyContinue;
This should return $null if the site does not exists. Note that I appreciate it may be in the recycle bin - I do check for this separately.
Actual behavior
If multiple requests are triggered at the same time then $site does not return $null as expected. The following is what I see in the Azure function log:
Site already exists - stopping further processing: Url Template Lcid --- -------- ----
If I re-trigger this request with the same URL then it succeeds.
I have tried to reproduce this from a PS console without success. It feels like I get a different response if a site is in the process of being created?
Steps to reproduce behavior
See above comment. I have not been able to reproduce this issue in a PowerShell console - even running two side by side and creating a new site in one and using Get-PnPSite in the other.
Note that sites are created in the function app with a call to the Graph API to create a group.
Which version of the PnP-PowerShell Cmdlets are you using?
[ ] PnP PowerShell for SharePoint 2013
[ ] PnP PowerShell for SharePoint 2016
[ ] PnP PowerShell for SharePoint 2019
[X] PnP PowerShell for SharePoint Online
What is the version of the Cmdlet module you are running?
3.23.2007.1
How did you install the PnP-PowerShell Cmdlets?
[ ] MSI Installed downloaded from GitHub
[ ] Installed through the PowerShell Gallery with Install-Module
2857 # Reporting an Issue or Missing Feature
I am using PnP PowerShell in an Azure Function App to provision new sites/Teams. I use the following to check if a site exists:
$site = Get-PnPTenantSite -Url $existingUrl -ErrorAction SilentlyContinue; if ($null -ne $site) {
Site already exists
}
When requests go through one at a time then all works as expected.
Expected behavior
$site = Get-PnPTenantSite -Url $existingUrl -ErrorAction SilentlyContinue; This should return $null if the site does not exists. Note that I appreciate it may be in the recycle bin - I do check for this separately.
Actual behavior
If multiple requests are triggered at the same time then $site does not return $null as expected. The following is what I see in the Azure function log:
Site already exists - stopping further processing: Url Template Lcid --- -------- ----
If I re-trigger this request with the same URL then it succeeds.
I have tried to reproduce this from a PS console without success. It feels like I get a different response if a site is in the process of being created?
Steps to reproduce behavior
See above comment. I have not been able to reproduce this issue in a PowerShell console - even running two side by side and creating a new site in one and using Get-PnPSite in the other.
Note that sites are created in the function app with a call to the Graph API to create a group.
Which version of the PnP-PowerShell Cmdlets are you using?
What is the version of the Cmdlet module you are running?
3.23.2007.1
How did you install the PnP-PowerShell Cmdlets?