Legacy / Basic Authentication in SharePoint Online deaktivieren

Bekanntlich plant die PnP Community am 9. September die PnP PowerShell Multi-Tenant App in Entra ID zu entfernen.

💡 Nachlesen:  Ende der PnP PowerShell Multi-Tenant App ab September 2024

Über die Sign-in Logs der PnP PowerShell Multi-Tenant App können Administratoren erkennen welche Konten die App nutzen.

Sign-in Logs der PnP PowerShell App
Sign-in Logs der PnP PowerShell App

Die Sign-in Logs der PnP PowerShell Multi-Tenant App können Konten übersehen. Ich nenne sie Blindgänger. Die Blindgänger nutzen für den Zugriff auf SharePoint veraltete PnP Module. Mit Basic Authentication wenden diese Konten weiterhin eine veraltete, unsichere Methode zur Authentifizierung an und sind von der PnP PowerShell Multi-Tenant App unabhängig.

Mit eigenen Tests simulierte ich die Situationen.


Ursache

Die Ursache für die Blindgänger hat zwei Gründe.

  1. Betroffene Konten können das alte SharePointPnPPowerShellOnline Modul nutzen. Die letzte Version ist von Januar 2021. Benutzer werden laufend informiert dieses Modul ist veraltet. Sie werden nicht daran gehindert die alte Version einzusetzen.
  2. Im SharePoint Tenant ist Legacy Authentication aktiv.
PowerShell
# PowerShell 5 only
Import-Module Microsoft.Online.SharePoint.PowerShell
Connect-SPOService -Url "https://<Tenant>-admin.sharepoint.com"
Get-SPOTenant | select LegacyAuthProtocolsEnabled

PowerShell

In der Dokumentation beschreibt Microsoft das Property LegacyAuthProtocolsEnabled.

LegacyAuthProtocolsEnabled
By default this value is set to $True, which means that authentication using legacy protocols is enabled.

Setting this parameter to $False prevents Office clients using non-modern authentication protocols from accessing SharePoint Online resources.

  • True – Enables Office clients using non-modern authentication protocols (such as, Forms-Based Authentication (FBA) or Identity Client Runtime Library (IDCRL)) to access SharePoint resources.
  • False – Prevents Office clients using non-modern authentication protocols from accessing SharePoint Online resources.

This may also prevent third-party apps from accessing SharePoint Online resources.
Also, this will also block apps using the SharePointOnlineCredentials class to access SharePoint Online resources. For additional information about SharePointOnlineCredentials, see SharePointOnlineCredentials class.

Für meinen Test simulierte ich mit PnP PowerShell zwei Optionen. Bei Option 1 ist LegacyAuthProtocolsEnabled True, bei Option 2 False.
Eine Änderung von LegacyAuthProtocolsEnabled kann im SharePoint Tenant jeweils bis zu 24 Stunden dauern. Während meiner Tests dauerte die Änderung von True auf False mehrfach weniger als 10 Minuten.

Option 1: LegacyAuthProtocolsEnabled True
PowerShell

Für PnP PowerShell bedeutet True ein altes PnP PowerShell Modul (in meinem Test SharePointPnPPowerShellOnline) nutzt in SharePoint die Möglichkeit von Legacy Authentication. Die PnP PowerShell Multi-Tenant App muss im Tenant nicht verfügbar sein.

In den Sign-ins wird der Zugriff als “User sign-in (non-interactive)” notiert. Filtere nach der Application “Office 365 SharePoint Online” und Client App “Other clients”.

Sign-in Logs
Sign-in Logs

Als Test erstellte ich mir eine Conditional Access Policy um den Zugriff zu blockieren.
Bedenke, mit der Policy blockierst du interaktive, non-interaktive und andere Sign-in Methoden. Die Policy kannst du im Report-only Modus aktivieren und auswerten welche Konten betroffen sind.

  • Include Client App > Office 365 SharePoint Online
  • Conditions > Client Apps > Other clients
  • Grant > Block access
Conditional Access Policy
Conditional Access Policy

Nach Aktivierung der Policy wird PnP melden das Konto sei falsch.

PowerShell

Das Sign-in wird blockiert.

Sign-in Logs
Sign-in Logs

Statt der CA-Policy bevorzuge ich Option 2.


Option 2: LegacyAuthProtocolsEnabled False
PowerShell
Set-SPOTenant -LegacyAuthProtocolsEnabled $false

PowerShell

Für PnP PowerShell bedeutet False ein altes PnP PowerShell Modul (in meinem Test SharePointPnPPowerShellOnline) kann die Möglichkeit von Legacy Authentication in SharePoint nicht nutzen. PnP PowerShell fordert die Einrichtung der PnP PowerShell Multi-Tenant App oder nutzt diese, sofern die Enterprise App bereits registriert ist.

Ich nutze mit einem Konto dasselbe Command wie in Option 1.
PnP PowerShell kann Legacy Authentication nicht nutzen und sucht nach der PnP Management Shell App. Die App soll am 9. September entfernt werden.

PowerShell

Im Tenant notiert es das Sign-in als unterbrochen.

Sign-in Logs
Sign-in Logs

Nachdem die PnP PowerShell Multi-Tenant App im Tenant registriert wurde funktioniert das Command wieder. Die Azure App registriert die Sign-ins als erfolgreich.

Sign-in Logs
Sign-in Logs

PnP.PowerShell vs. SharePointPnPPowerShellOnline Authentication

GitHub Copilot erklärt die Unterschiede zwischen PnP.PowerShell und SharePointPnPPowerShellOnline für dieses Command.

PowerShell
Connect-PnPOnline -Url <SharePointUrl> -Credentials <Credentials>

When using Connect-PnPOnline with the -Credentials parameter in SharePointPnPPowerShellOnline and PnP.PowerShell, different authentication methods are employed in the background.

SharePointPnPPowerShellOnline

In SharePointPnPPowerShellOnline, the Connect-PnPOnline cmdlet with the -Credentials parameter uses basic authentication. This method sends the username and password directly to SharePoint Online for authentication.

PnP.PowerShell

In PnP.PowerShell, the Connect-PnPOnline cmdlet with the -Credentials parameter uses modern authentication (OAuth 2.0) by default. This method involves obtaining an access token from Entra ID using the provided credentials.

Key Differences

  1. Authentication Method:
    • SharePointPnPPowerShellOnline: Uses basic authentication, which is less secure and may be deprecated in the future.
    • PnP.PowerShell: Uses modern authentication (OAuth 2.0), which is more secure and recommended by Microsoft.

  2. Security:
    • SharePointPnPPowerShellOnline: Sends credentials directly, which can be intercepted if not using HTTPS.
    • PnP.PowerShell: Uses tokens, reducing the risk of credential interception.

  3. Compatibility:
    • SharePointPnPPowerShellOnline: Limited to Windows PowerShell (5.x) and SharePoint Online.
    • PnP.PowerShell: Cross-platform (Windows, macOS, Linux) and supports both SharePoint Online and SharePoint On-Premises.

Summary

  • SharePointPnPPowerShellOnline: Uses basic authentication with the -Credentials parameter.
  • PnP.PowerShell: Uses modern authentication (OAuth 2.0) with the -Credentials parameter.
Share
Avatar-Foto

Tobias Asböck

Tobias ist ein Senior System Engineer mit rund 10 Jahren Berufserfahrung für Microsoft 365 Produkte wie SharePoint Online, OneDrive for Business, Teams Collaboration, Entra ID, Information Protection, Universal Print und Microsoft 365 Lizenzierung. Aus der Vergangenheit kennt er über einen Zeitraum von 15+ Jahren die Planung, Administration und den Betrieb von SharePoint Server Umgebungen. Tobias ist ein PowerShell Scripter mit Zertifizierungen für Microsoft 365 Produkte. In seiner Freizeit beschäftigt sich Tobias mit Aktualisierungen in der M365-Welt, ist mit seinem Rennvelo unterwegs und anderen sportlichen Aktivitäten beschäftigt.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert