How to fix Error 5371 on Windows Server 2025 / Windows 11

Why This Error Happens

Error 5371 occurs when SQL Server 2025’s PolyBase or external data source connector detects a mismatch between the location prefix (such as abfss://, wasbs://, s3://, or odbc://) and the FORMAT type declared in the CREATE EXTERNAL FILE FORMAT or CREATE EXTERNAL TABLE statement. This typically happens because certain connector prefixes are only compatible with specific file formats (e.g., Delta Lake requires abfss:// or s3a://, while flat-file CSV formats support a narrower set of prefixes). The issue is also triggered by outdated PolyBase connectors that haven’t been patched to recognize newer prefix/format combinations introduced in SQL Server 2025.

Step-by-Step Resolution Guide

Step 1: Verify the External File Format Definition

  • Open SSMS and query sys.external_file_formats to inspect the FORMAT_TYPE currently bound to your external table.
  • Confirm the format type (e.g., PARQUET, DELTA, CSV) explicitly supports the connector prefix used in your LOCATION string.
  • Cross-check against Microsoft’s supported matrix: Delta format only supports abfss:// and s3a://; CSV/PARQUET support wasbs://, abfss://, s3://, and https://.

Step 2: Correct the Connector Prefix or FORMAT Clause

  • Edit the CREATE EXTERNAL DATA SOURCE statement to use a supported prefix. Example fix:
  CREATE EXTERNAL DATA SOURCE MyDataSource
  WITH (
      LOCATION = 'abfss://container@account.dfs.core.windows.net/path',
      CREDENTIAL = MyCredential
  );
  • If the prefix cannot change (due to storage account type), instead alter the FILE_FORMAT to one compatible with that prefix.
  • Drop and recreate the external table only after confirming the prefix/format pairing is valid.

Step 3: Update PolyBase and Connector Components

  • On Windows Server 2025/Windows 11, open PowerShell as Administrator and run:
  Get-Service MSSQLSERVER, MSSQLLaunchpad | Restart-Service
  • Check for and apply the latest Cumulative Update (CU) for SQL Server 2025, since connector-prefix validation logic is frequently patched.
  • Reinstall the PolyBase feature via SQL Server Setup if the connector DLLs (Microsoft.SqlServer.DataWarehouse.Connectivity.*) appear outdated in C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Binn\Polybase\.

Step 4: Validate Credential and Data Source Scope

  • Ensure the DATABASE SCOPED CREDENTIAL used matches the authentication method required by the prefix (e.g., SAS token for wasbs://, Managed Identity for abfss://).
  • Mismatched credentials can sometimes surface as Error 5371 instead of a standard authentication failure, so re-validate this mapping before re-testing.

Alternative or Verification Steps

  • Run a lightweight test query against the external table (SELECT TOP 10 * FROM MyExternalTable;) to confirm the prefix/format combination resolves without throwing Error 5371.
  • If the error persists, bypass the native connector and use OPENROWSET with the BULK option as an alternative method to read the external file directly, which uses a different validation path.