I have multi-factor authentication activated for my SharePoint Tenant. I am trying to connect to one of a site via release pipeline in Azure DevOps. I googled a bit and found that it might be possible using App password. So, I set this up and now I am trying to use this password to authenticate but I am getting the following error:

Connect-PnPOnline : AADSTS50126: Error validating credentials due to invalid username or password.

Any idea on what is going on. I want to be able to connect to SharePoint from my release pipeline so, I can deploy and do not want to deactivate my MFA.

1 Answer 1


MFA enabled account can not run in background and it must require interactive login.

In order to access SharePoint through app you will require certificate thumbprint that would not be feasible in release pipe line.

Connect-PnPOnline -ClientId fa1a81f1-e729-44d8-bb71-0a0c339c0f62 -Url "https://tenant.sharepoint.com" -Tenant tenant.onmicrosoft.com -Thumbprint $thumbprint

I would suggest create one service account (Exclude MFA Login require) and use it either with Office 365 CLI or PnP PowerShell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.