Actual behavior
Get-PnPHubSite currently returns a not-null respons when calling using a valid URL to a site that is not a hub site. I would expect a null value
Steps to reproduce behavior
part of an Azure Function:
$SPOAdminUrl = "the URL of the SP admin site"
$siteUrl = "contoso.sharepoint.com/sites/nothubsite"
$adminConn = Connect-PnPOnline -Url $SPOAdminUrl -Interactive -ClientId $PnPClientId -ReturnConnection
$hubSite = Get-PnPHubSite -Identity $siteUrl -Connection $adminConn -ErrorAction Stop
if($hubSite) #this fails as $hubSite is not null
{
$body += "The site $siteUrl is already registered as a hub site"
$StatusCode = [HttpStatusCode]::AlreadyReported
}
What is the version of the Cmdlet module you are running?
3.1.0
Which operating system/environment are you running PnP PowerShell on?