SQL Server – Allow Users to View Only Accessible Databases

availability-groupssql serversql server 2014

I wonder if there's any way to allow a user to only view the specific databases they have access to. For example.
Let's say we have a alwaysOn with one local only database and 10 databases that is added in the AO. The user need read rights to one of the 10 databases added in AO. But when giving user rights to that database and he connects to the AO he can view every database but only access the one he got rights to of course. And if the AO is active where the local database is located he will also see that one.

We have tried a few things but nothing successful and from what we've been reading it doesn't seem to be a way unless the user is granted dbowner rights.

Anyone got any ideas?

Best Answer

Starting with SQL Server 2012 you can use contained databases as described here: SQL Server 2012 Contained Database Feature

There is no need to create logins, it's a database that authenticates you. As consequence, the user sees nothing but his databases only