Azure SQL Server Database - Deny View Any Database Error

Cherise D Woods 1 Reputation point
2022-02-10T17:29:31.633+00:00

Context:
I had two azure sql server databases on an azure sql server. I created a user and login and need to deny the user from seeing one of the databases. I tried to use the following tsql via ssms:
REVOKE VIEW ANY DATABASE TO [public]
DENY VIEW ANY DATABASE TO [public]

Got this error message when I tried either:
Msg 40521, Level 16, State 1, Line 18
Securable class 'server' not supported in the server scope in this version of SQL Server.

I'm the Azure Active Directory Admin on the server.

Please advise how I can restrict the user access from seeing all other databases on the server including with the master.
Thanks

Azure SQL Database
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Alberto Morillo 32,896 Reputation points MVP
    2022-02-10T20:13:40.523+00:00

    In Azure SQL Database and SQL Server, users can be authenticated at the database level without a server-level login. For example, in the context of the Team1 database:

    CREATE USER User1 WITH PASSWORD='<complex-password-here>';
    

    Then user must specify the desired database when connecting and the sys.databases catalog view return only the current database. They cannot see other databases.

    You can create the user on the databases he is suppossed to have access. You don't have to create the user at master database level, you don't have to create a server login for that user.

    1 person found this answer helpful.