I am able to log in to my SharePoint online site using my credential but when I am connecting to the same SharePoint online site using the same credentials using PowerShell CSOM - getting the invalid credential error - tried to connect to the same site using sharegate tool it works but only with powershell it fails. Connection sample code : $UserName="[email protected]" $Password ="MyPassword" #Setup Credentials to connect $Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName,(ConvertTo-SecureString $Password -AsPlainText -Force)) #Set up the context $Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl) $Context.Credentials = $credentials Thanks in advance - any help is greatly appreciated.