Existing CSOM script modify from basic to modern authentication?

Copper Contributor

I have a big CSOM powershell script which is using basic authentication. This script is scheduled to run every day. This script is using credentials of a serviceaccount without MFA. We would like to disable basic authentication, but this script needs to be modified. I dont want to rewrite the whole CSOM script to Office Dev PnP Powershell because it is a big script.


What is the easiest way to move from basic to modern authentication in a CSOM powershell script?

See below a small part with authentication and some SPO logic:


$lo_ClientContext             = New-Object Microsoft.SharePoint.Client.ClientContext( https://myCompany.sharepoint.com/sites/test )
$lo_ClientContext.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials( Email address removed, myPassword )

$ll_Lijst = $lo_ClientContext.Web.Lists.GetByTitle( "myList" )
$lo_ClientContext.Load( $ll_Lijst )


0 Replies