Oct 01 2020 01:13 AM
Hi,
One of our tenant has enabled MFA for administrator account, can I get help on how to execute the PowerShell script with MFA enabled
Oct 01 2020 08:59 AM
It should be a matter of connecting to SP online by running the below as Administrator in Powershell:
$orgName="<name of your Office 365 organization, example: contosotoycompany>"
Connect-SPOService -Url https://$orgName-admin.sharepoint.com
And then signing in with the Admin details + the 2FA code in the prompts when they pop up.
This is covered in more detail here https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-online/connect-sharepoint-online?v...
I'm not entirely sure why the more usual,
$adminUPN="<the full email address of a SharePoint administrator account, example: jdoe@contosotoycompany.onmicrosoft.com>"
$orgName="<name of your Office 365 organization, example: contosotoycompany>"
$userCredential = Get-Credential -UserName $adminUPN -Message "Type the password."
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
, doesn't seem to work with 2FA even though it's the same basic command but with more details provided up front.