We have a lot of .Net console applications which run inside windows on-premises servers, which connect to SharePoint online using ClientID & ClientSecret and perform some background tasks, as follow:-
static void Main(string[] args)
{
string siteUrl = "https://*****.sharepoint.com/sites/HR/";
string clientId = "1***";
string clientSecret = ""******";
using (ClientContext context = new OfficeDevPnP.Core.AuthenticationManager().GetAppOnlyAuthenticatedContext(siteUrl, clientId, clientSecret))
try {
{
context.Load(context.Web);
context.Load(context.Site.RootWeb.ContentTypes);
context.ExecuteQuery();
Now this code will not work on any tenant unless we set DisableCustomAppAuthentication to false
as follow:-
Set-SPOTenant -DisableCustomAppAuthentication $false
Now on some tenants the admin refuse to enable the custom app authentication, so what are the other approaches that we have in this case, to authenticate our .Net console applications?
Set the property DisableCustomAppAuthentication to false.
which i do not want to have