pnp / powershell

PnP PowerShell
https://pnp.github.io/powershell
MIT License
684 stars 351 forks source link

[Bug] Current site is not a tenant administration site #4496

Closed llgjermeni closed 3 weeks ago

llgjermeni commented 3 weeks ago

Hello,

We have updated the module SharePointPnPPowerShellOnline with PnP.PowerShell. Deploying to SharePoint using AzureADAppOnly authentication.

PowerShell version: 7.4.6

In the command: Connect-PnPOnline -CertificatePath $certificatePath -ClientId $appId -Url $url -Tenant "tenant.com" -ErrorAction Stop -ValidateConnection -Verbose getting the error in pipeline ( yaml pipeline in Azure DevOps):

pwsh Error: 0 : 2024-10-31 11:26:20.4377    [PnP.Framework] [0] [Error] ExecuteQuery threw following exception: Microsoft.SharePoint.Client.ServerException: Current site is not a tenant administration site.
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
   at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServerAsync(ChunkStringBuilder sb)
   at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryAsync()
   at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQueryAsync()
   at Microsoft.SharePoint.Client.ClientContext.ExecuteQueryAsync()
   at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount, String userAgent)
ServerErrorCode: -1
ServerErrorTypeName: Microsoft.Online.SharePoint.Common.SpoException
ServerErrorTraceCorrelationId: <trace correlation id>
ServerErrorValue: 
ServerErrorDetails: 
.   0ms 

Logs from -Verbose

VERBOSE: PnP PowerShell Cmdlets (2.12.0)
VERBOSE: Connecting using Entra ID App-Only using a certificate
VERBOSE: Using ClientID <client id>
VERBOSE: Reading certificate from file 'certificate-path\certificate-name.pfx'
VERBOSE: Opening certificate in file 'certificate-path\certificate-name..pfx' without a certificate password
...........continue 

VERBOSE: Connected
VERBOSE: Validating if the site at <our sharepoint site> exists
VERBOSE: Site at <our sharepoint site> exists

Running the same command locally we have the same error.

The strange thing is, that it is connected and actually applying the changes.

Kind regards,