Troubleshooting Guide: SQL Server Error 2818 – External Governance Not Enabled
Why This Error Happens
This error occurs because the stored procedure being executed relies on an external governance feature (such as external language extensibility, policy-based governance hooks, or external REST/data endpoints) that requires explicit server-level enablement. SQL Server 2025 introduces stricter default security postures, so these external governance capabilities are disabled out-of-the-box to prevent unauthorized external calls. Until the external governance enabled configuration option is turned on at the instance level, any stored procedure attempting to invoke this functionality will be blocked and raise Error 2818.
Step-by-Step Resolution Guide
Step 1: Verify Current Configuration State
- Open SQL Server Management Studio (SSMS) or Azure Data Studio and connect to the instance.
- Run the following query to check the current state:
EXEC sp_configure 'external governance enabled';
- Confirm the
run_valueandconfig_valuecolumns both show0, indicating the feature is disabled.
Step 2: Enable External Governance at the Server Level
- Execute the following commands with sysadmin privileges:
EXEC sp_configure 'show advanced options', 1;
RECONFIGURE;
EXEC sp_configure 'external governance enabled', 1;
RECONFIGURE;
- Ensure you are logged in with an account that has the
ALTER SETTINGSserver-level permission.
Step 3: Restart the SQL Server Service
- On Windows Server 2025 / Windows 11, open SQL Server Configuration Manager.
- Navigate to SQL Server Services, right-click your instance (e.g.,
MSSQLSERVER), and select Restart. - Alternatively, use PowerShell as Administrator:
Restart-Service -Name 'MSSQLSERVER' -Force
Step 4: Validate Governance Policy File Path (If Applicable)
- If your organization uses a custom governance policy file, confirm it exists at the expected path, typically:
C:\Program Files\Microsoft SQL Server\MSSQL17.MSSQLSERVER\MSSQL\Governance\policy.json - Check that the SQL Server service account has Read permissions on this directory via File Explorer > Properties > Security.
Step 5: Re-run the Stored Procedure
- Reconnect to the instance and execute the originally failing stored procedure.
- Confirm no further Error 2818 messages appear in the SQL Server Error Log (viewable in SSMS under Management > SQL Server Logs).
Alternative or Verification Steps
- Verify success by re-running
EXEC sp_configure 'external governance enabled';and confirming bothrun_valueandconfig_valueare set to1. - If the error persists after enabling the setting, check the Windows Event Viewer (Applications and Services Logs > MSSQLSERVER) for related permission-denied entries, as a Group Policy Object (GPO) on Windows Server 2025 may be overriding or blocking the governance feature at the OS level.