BestPaid guides · Microsoft 365 · SharePoint Online

SharePointOnlineCredentials code stopped working? IDCRL is blocked in SharePoint Online and OneDrive. Move it to MSAL and Microsoft Entra ID

Scripts, services and tools that sign in to SharePoint Online or OneDrive for Business with a username and password through IDCRL now fail: SharePointOnlineCredentials in CSOM, direct calls to rst2.srf and idcrl.svc, and old SharePoint Online Management Shell sign-ins. Microsoft's schedule: blocked by default from February 16, 2026, for good from May 1, 2026. Here is how to find what still depends on IDCRL and move each piece to OAuth tokens from Microsoft Entra ID.

Sources: the Microsoft 365 Developer Blog's IDCRL migration post (October 29, 2025, since updated); Message Center posts MC1184649, MC1028318 and MC1188595 (Microsoft's text, archived on mc.merill.net); the Microsoft Mission Critical Blog's IDCRL retirement post (March 3, 2026); Microsoft's Japan SharePoint Support Blog IDCRL post (November 18, 2025); Microsoft Learn on Set-SPOTenant, Connect-SPOService, a Connect-SPOService troubleshooting article, SharePoint admin API permissions, CSOM for .NET Standard, Entra ID app-only, Sites.Selected, ACS to Entra ID, audit search, audit retention, MSAL.NET interactive sign-in and browsers, daemon tokens, the .default scope and ROPC; PnP's AuthenticationManager, app registration, Connect-PnPOnline and Grant-PnPEntraIDAppSitePermission docs; and a Microsoft Q&A thread. Checked on November 21, 2026. This page is our own summary; follow the vendor's documentation for every detail.

What changed and when

DateWhat Microsoft announced
March 28, 2025From this release, the SharePoint Online Management Shell signs Connect-SPOService in with OAuth instead of IDCRL (MC1028318).
October 29, 2025Microsoft announces the removal of IDCRL from SharePoint Online and OneDrive for Business. MC1184649 follows on November 11.
February 16, 2026Legacy client authentication blocked by default. Admins can take a one-time extension.
April 30, 2026The extension ends.
May 1, 2026Scheduled start of the permanent block: from this date, legacy authentication can't be re-enabled.
May 13, 2026MC1184649 update: the rollout has started and is expected to reach 100% of production within weeks.

The extension set AllowLegacyAuthProtocolsEnabledSetting and LegacyAuthProtocolsEnabled to $true with Set-SPOTenant. That no longer brings IDCRL back: the only fix is to change how each client signs in.

What stops working

People who use SharePoint in a browser or the Microsoft 365 apps typically aren't affected.

1. Find what still uses IDCRL

Errors. Microsoft's Set-SPOTenant reference shows this error when legacy authentication is off:

Cannot contact web site 'https://contoso-admin.sharepoint.com/' or the web site does not support SharePoint Online credentials. The response status code is 'Unauthorized'.

The underlying error is "Access denied. Before opening files in this location, you must first browse to the web site and select the option to login automatically." On Microsoft Q&A, a user reports the first message with the status code 'Forbidden' instead of 'Unauthorized'.

Audit log. In the Microsoft Purview portal, open Audit, enter IDCRLSuccessSignIn in the Activities - operations names field, and search; you need the Audit Logs or View-Only Audit Logs role. Export the results: the account, the timing (hourly or daily hits from a service account) and any client details the records include, such as user agent or client IP, point to the job. The event logs successful IDCRL sign-ins, so it shows what used IDCRL before the block, within your retention (180 days by default with Audit (Standard)).

Code and servers. Search repositories, scheduled tasks and config for SharePointOnlineCredentials, rst2.srf, idcrl.svc, SPOIDCRL, GetAuthenticationCookie, and Get-Credential or -Credential in SharePoint scripts. Check the Management Shell version wherever admin scripts run:

Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select-Object Name, Version

2. The smallest change: useModernAuth

Microsoft released an updated Microsoft.SharePointOnline.CSOM package (version 16.1.26615.12013 or later, per Microsoft's Japan SharePoint support blog) in which SharePointOnlineCredentials can switch to OAuth. This is for .NET Framework code: CSOM for .NET Standard doesn't support the class.

ctx.Credentials = new SharePointOnlineCredentials(userName, securePassword, useModernAuth: true, interactiveAuth: false);

// tenant with MFA: a person completes the sign-in
ctx.Credentials = new SharePointOnlineCredentials(userName, securePassword, useModernAuth: true, interactiveAuth: true);

Microsoft says GetAuthenticationCookie is being deprecated in the newer package and replaced by AcquireTokenAsync, which gets an OAuth token. This route still keeps a password in your code or config and needs a person once MFA applies, so treat it as a bridge. For unattended jobs, Microsoft points to app-only authentication.

3. Delegated sign-in with MSAL

Use this for tools a person runs. Register an app in Microsoft Entra ID, add the Mobile and desktop applications platform with the redirect URI http://localhost, add a SharePoint delegated permission such as AllSites.Read or AllSites.Manage, and have an admin grant consent. Users still need their own access to each site.

var pca = PublicClientApplicationBuilder.Create(clientId)
    .WithAuthority(new Uri($"https://login.microsoftonline.com/{tenantId}"))
    .WithRedirectUri("http://localhost")   // needed for the system browser
    .Build();
var result = await pca
    .AcquireTokenInteractive(new[] { "https://contoso.sharepoint.com/.default" })
    .WithUseEmbeddedWebView(false)         // system browser, also on .NET Framework: password and MFA happen there
    .ExecuteAsync();

using var ctx = new ClientContext("https://contoso.sharepoint.com/sites/finance");
ctx.ExecutingWebRequest += (s, e) =>
    e.WebRequestExecutor.RequestHeaders["Authorization"] = "Bearer " + result.AccessToken;

Add a token cache and call AcquireTokenSilent first, so users aren't prompted on every run. Skip the password-grant (ROPC) sample in Microsoft's CSOM for .NET Standard article: Microsoft recommends against ROPC because it's incompatible with MFA.

4. App-only with an Entra ID app and a certificate

For services and scheduled jobs, the app signs in as itself. SharePoint's CSOM and REST APIs need a certificate for that: Microsoft says other options, such as a client secret, end in Access Denied. Upload the certificate's .cer file to the app registration, add the SharePoint application permission Sites.Selected, and have an admin grant consent. Anyone with the certificate and its private key can use the app, so keep the key out of source control.

var cca = ConfidentialClientApplicationBuilder.Create(clientId)
    .WithCertificate(certificate)          // X509Certificate2 with the private key
    .WithAuthority(new Uri($"https://login.microsoftonline.com/{tenantId}"))
    .Build();
string[] scopes = { "https://contoso.sharepoint.com/.default" };

using var ctx = new ClientContext("https://contoso.sharepoint.com/sites/finance");
ctx.ExecutingWebRequest += (s, e) =>
{
    // AcquireTokenForClient checks MSAL's app token cache itself
    var token = cca.AcquireTokenForClient(scopes).ExecuteAsync().GetAwaiter().GetResult();
    e.WebRequestExecutor.RequestHeaders["Authorization"] = "Bearer " + token.AccessToken;
};

5. Limit the app with Sites.Selected

With Sites.Selected, the app reaches no site until an admin grants it one, as read, write, manage or fullcontrol, through Microsoft Graph (POST https://graph.microsoft.com/v1.0/sites/{site-id}/permissions, which takes Sites.FullControl.All) or PnP PowerShell:

Grant-PnPEntraIDAppSitePermission -AppId <client-id> -DisplayName "Nightly export" -Permissions Write -Site https://contoso.sharepoint.com/sites/finance

SharePoint and Microsoft Graph each have a Sites.Selected permission; CSOM and SharePoint REST need SharePoint's. Microsoft calls Graph the primary choice, with SharePoint REST as the alternative. Our guide to moving SharePoint app-only code off Azure ACS covers the same setup in more detail.

PnP Framework, PnP PowerShell and the Management Shell

The same two kinds of sign-in, in PnP and in Microsoft's admin module:

// PnP Framework (C#)
var auth = AuthenticationManager.CreateWithCertificate(clientId, certificate, "contoso.onmicrosoft.com");
// a person at the keyboard: AuthenticationManager.CreateWithInteractiveLogin(clientId, tenantId: "contoso.onmicrosoft.com")
using var ctx = await auth.GetContextAsync("https://contoso.sharepoint.com/sites/finance");
# PnP PowerShell
Connect-PnPOnline -Url https://contoso.sharepoint.com/sites/finance -Interactive -ClientId <client-id>
Connect-PnPOnline -Url https://contoso.sharepoint.com/sites/finance -ClientId <client-id> -Tenant contoso.onmicrosoft.com -CertificatePath .\job.pfx

# SharePoint Online Management Shell
Connect-SPOService -Url https://contoso-admin.sharepoint.com
Connect-SPOService -Url https://contoso-admin.sharepoint.com -ClientId <client-id> -TenantId <tenant-id> -CertificateThumbprint <thumbprint>

Then delete stored passwords and app passwords from code, config, scheduled tasks and credential stores, and run every job, upload and refresh end to end, scheduled runs included.

Still have SharePoint jobs that sign in with a password? We move apps and scripts like these to Microsoft Graph and Microsoft Entra ID at a fixed price: a script or scheduled job from $690, an app or service from $1,490. One app gets a free estimate within 2 business days. We never ask for passwords, secrets or admin access: your admin registers the app and grants consent.
See the Microsoft 365 migration offer