pnp / PnP-PowerShell

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

Connect-PnpOnline using certificate stopped working in Azure pipeline #2568

Closed toblum closed 4 years ago

toblum commented 4 years ago

Reporting an Issue or Missing Feature

Issue

Expected behavior

Connect-PnpOnline should connect to our tenant using certificate

Actual behavior

We're using PnP powershell for some time without problems using certificate authentication in a azure pipeline. After 24.2.2020 this pipeline stopped working with the following error message (output of Get-PnpException):

2020-03-09T13:08:08.2838357Z     + CategoryInfo          : NotSpecified: (:) [Connect-PnPOnline], TargetInvocationException
2020-03-09T13:08:08.2838721Z     + FullyQualifiedErrorId : System.Reflection.TargetInvocationException,SharePointPnP.PowerShell.Commands.Base.Conne 
2020-03-09T13:08:08.2838982Z    ctOnline
2020-03-09T13:08:08.2839079Z  
2020-03-09T13:08:08.2839154Z 
2020-03-09T13:08:08.2839264Z CorrelationId    : 
2020-03-09T13:08:08.2839449Z TimeStampUtc     : 3/9/2020 1:08:08 PM
2020-03-09T13:08:08.2839682Z Message          : Exception has been thrown by the target of an invocation.
2020-03-09T13:08:08.2839974Z Stacktrace       :    at SharePointPnP.PowerShell.Commands.Base.ConnectOnline.ProcessRecord()
2020-03-09T13:08:08.2840323Z                       at System.Management.Automation.CommandProcessor.ProcessRecord()
2020-03-09T13:08:08.2840562Z ScriptLineNumber : 47

Nothing obvious was changed. When I try it out locally I get "Connect-PnPOnline : Ein Aufrufziel hat einen Ausnahmefehler verursacht." what looks like the german transation of the same error.

I noticed that there is a issue open with the same error message: https://github.com/SharePoint/PnP-PowerShell/issues/2313 but it's related to special characters in the password which is not used here.

Steps to reproduce behavior

Connect using Connect-PnPOnline -ClientId xxx-yyy-zzz -Url https://contoso.sharepoint.com/sites/common -Tenant contoso.onmicrosoft.com -CertificateBase64Encoded "x6y8...=" inside a azure pipeline.

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

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

Latest 3.18.2002.0, but happens also when I target an earlier version 3.17.2001.2

How did you install the PnP-PowerShell Cmdlets?

ghost commented 4 years ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

toblum commented 4 years ago

Note: Managed to get it working by recreating the whole setup. Not sure where the problem was in the end.

saderemipcgus commented 4 years ago

@msftbot Please reopen. I have this issue as well when calling this cmdlet from within a scheduled task with a group-managed service account.