Forum Discussion
AshishJ640
Dec 14, 2021Copper Contributor
Unable to login using PowerShell (Connect-SPOService -Url <url-admin> -Cred) SharePoint Online
Hello, Quick suggestion would be helpful. I have 2 MFA enabled on sharepoint online. Looking to pass the credentials to avoid manual touch in script. I have noticed that when we use the c...
R0_365
Dec 14, 2021Copper Contributor
Hi Ashish,
As i know, you can't automate a connection to SPOService with MFA using "-credential" parameter.
You will have to remove MFA if you want to automate your script with this parameter.
I would suggest you create a service account without MFA, deactivate it, and activate it only when you need to run your script.
Or, look on PnP side if you can. PnP support App authentication which can achieve your goal.
Regards
As i know, you can't automate a connection to SPOService with MFA using "-credential" parameter.
You will have to remove MFA if you want to automate your script with this parameter.
I would suggest you create a service account without MFA, deactivate it, and activate it only when you need to run your script.
Or, look on PnP side if you can. PnP support App authentication which can achieve your goal.
Regards