I have a complex CSOM script that I need to get working for a Tenant that uses Modern Authentication.
This works fine using Basic Authentication. Its not an automated script so an interactive login is fine.
$Cred = Get-Credential $Ctx = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL) $Ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Cred.UserName, $Cred.Password) ... do rest of script...
Any idea how I change this to use modern authentication? Even temporaily switching off MFA still wont work.
I can log in fine using the credentials to the SP site.