Troubleshooting Guide: Error 12818 — RECONFIGURE Failed for ‘Contained Database Authentication’
Why This Error Happens
This error occurs because SQL Server 2025 enforces a safety check that prevents administrators from disabling the contained database authentication server-level setting while one or more contained databases still exist on the instance. The engine blocks the standard RECONFIGURE command because doing so silently could break authentication for users who rely on database-level logins within those contained databases. SQL Server requires an explicit WITH OVERRIDE clause to confirm that the administrator understands this risk and wants to proceed anyway.
Step-by-Step Resolution Guide
Step 1: Identify Existing Contained Databases
- Open SQL Server Management Studio (SSMS) or Azure Data Studio and connect to the target instance.
- Run the following query to list all databases with containment enabled:
SELECT name, containment, containment_desc FROM sys.databases WHERE containment <> 0;- Note down the database names, as you will need to decide whether to keep or convert them before disabling the feature.
Step 2: Decide Whether to Convert or Override
- If the contained databases are no longer needed in contained mode, change them back to
NONEcontainment using:ALTER DATABASE [YourDBName] SET CONTAINMENT = NONE; - If the contained databases must remain as-is, proceed directly to the override method in Step 3 instead of modifying each database.
Step 3: Apply the RECONFIGURE WITH OVERRIDE Command
- Open a new query window in SSMS with sysadmin privileges.
- Execute the following T-SQL block exactly:
EXEC sp_configure 'contained database authentication', 0;RECONFIGURE WITH OVERRIDE;- This forces the server-level setting to apply immediately, bypassing the safety check, even though contained databases still exist.
Step 4: Restart the SQL Server Service (If Required)
- On Windows Server 2025 or Windows 11, open SQL Server Configuration Manager.
- Navigate to SQL Server Services, right-click your instance (e.g.,
SQL Server (MSSQLSERVER)), and select Restart. - This ensures the configuration change is fully propagated to all connected sessions and cached execution plans.
Alternative or Verification Steps
- Verify the setting took effect by running
EXEC sp_configure 'contained database authentication';and confirming therun_valuecolumn now shows0. - If users in contained databases suddenly lose the ability to authenticate after this change, consider reverting with
EXEC sp_configure 'contained database authentication', 1; RECONFIGURE;until you can properly migrate those logins to server-level authentication.