We have migrated Users from ADFS to Azure AD. The following code is working for connecting ADFS users to the SharePoint site using the C# console program. I am able to log in to the SharePoint site from the browser with Azure AD user.
Can anyone suggest to me how to connect the Sharepoint on-premises site with AZURE AD user through the console program?
ClientContext clientContext;
OfficeDevPnP.Core.AuthenticationManager am = new OfficeDevPnP.Core.AuthenticationManager();
//Following code is to connect ADFS users to the SharePoint site.
clientContext = am.GetADFSUserNameMixedAuthenticatedContext(strSiteURL, strLoginUser, strLoginPassword, strDomainName, strSTSName, strRealm);
FieldCollection fields = clientContext.Web.Fields;
IEnumerable<Field> results = clientContext.LoadQuery<Field>(fields.Where(item => item.Hidden != false));
clientContext.ExecuteQuery();