Enabling Database Containment for an Instance – #SQLNewBlogger

Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers. This is also a part of a basic series on git and how to use it.

I wanted to test a contained database feature the other day and ran this:

ALTER DATABASE [sandbox2] SET CONTAINMENT = PARTIAL WITH NO_WAIT
GO

However, this didn’t work. I ended up with an error:

Msg 12824, Level 16, State 1, Line 3

The sp_configure value 'contained database authentication' must be set to 1 in order to alter a contained database.  You may need to use RECONFIGURE to set the value_in_use.

The issue is that the server instance needs to have contained authentication enabled in order to pass any authentication requests to the database

EXEC sys.sp_configure N'contained database authentication', N'1'
GO
RECONFIGURE WITH OVERRIDE
GO

Now I can run the code again to alter the database for containment.

SQLNewBlogger

The issue was obvious to me since I’d dealt with it in the past, but this is something you could solve and write up in 10-15 minutes.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , , , . Bookmark the permalink.