Multi-tenant SQL Server environments face an architectural problem the place uncovered database names can reveal delicate tenant data. On-premises or self-managed SQL Server operating on Amazon Elastic Compute Cloud (Amazon EC2) can tackle this problem by manually denying server-level permissions to particular logins. In Amazon Relational Database Service (Amazon RDS) for SQL Server, database visibility is configured utilizing a devoted saved process.
By default, SQL Server’s PUBLIC function permits authenticated customers to view all database names, a characteristic meant for transparency that may develop into a big concern in multi-tenant structure. For unbiased software program distributors (ISVs) and software program as a service (SaaS) suppliers internet hosting a number of buyer databases on the identical occasion, this default conduct requires cautious consideration and mitigation methods to guard tenant identities.
On this submit, we reveal tenant isolation on the visibility degree, stopping tenants from seeing database names belonging to different prospects whereas sustaining their entry to their very own assets.
Resolution overview
This answer addresses an necessary architectural consideration in multi-tenant SQL Server environments the place database names would possibly reveal tenant data. By utilizing the Amazon RDS for SQL Server customized saved process msdb.dbo.rds_manage_view_db_permission, customers can successfully management database visibility on a per-login foundation whereas sustaining full utility performance.
Importantly, this answer solely manages database visibility; logins with acceptable database permissions can nonetheless totally entry and use the databases in line with their granted permissions, even once they can’t see the database names in SQL Server Administration Studio (SSMS) or different SQL Server shoppers. That is significantly worthwhile for SaaS suppliers and ISVs internet hosting multi-tenant databases on shared cases.
The implementation follows these high-level steps:
- Put together the RDS for SQL Server occasion with multi-tenant databases and logins.
- Apply the customized saved process to disclaim database visibility for particular logins.
- Validate the configuration by confirming restricted visibility.
- Preserve the power to revert modifications when wanted.
This answer enhances safety posture by lowering the danger of knowledge disclosure and gives a clear tenant expertise with out exposing the database names to tenants. The next diagrams illustrate the safety posture earlier than and after implementation.
Stipulations
You should have the next stipulations:
- Entry to an AWS account
- Primary understanding of SQL Server and safety ideas
- An RDS for SQL Server DB occasion and login data to connect with it
Deploying Amazon RDS for SQL Server will incur costs. Overview AWS Pricing earlier than continuing.
Put together RDS for SQL Server occasion
Create two new databases and two logins and grant acceptable permissions:
- Create an RDS for SQL Server occasion utilizing the AWS CLI or AWS Administration Console.
- Connect with the RDS for SQL Server occasion utilizing the
Majorlogin. - Create two databases,
Tenant1DBandTenant2DB: - Create two logins,
Tenant1andTenant2: - Grant
Tenant1permissions toTenant1DB: - Grant
Tenant2permissions to theTenant2DB:
Overview database permissions
Log in utilizing every tenant’s login and validate the default conduct that each one database names are seen:
- Open SSMS.
- Log in utilizing
Tenant1. - Develop the
Databasesfolder. - Verify that
Tenant1can see all of the database names.

- Equally, log in to the occasion utilizing
Tenant2. - Verify
Tenant2can see all database names.

Modify view database title permissions
On this part, you apply the Amazon RDS for SQL Server customized saved process to alter database visibility for logins:
- Connect with the occasion utilizing the
Majorlogin. - Execute the next script:
As acknowledged earlier, the saved process doesn’t management database permissions; as a substitute, it solely hides database names.
Validate view database title permissions
Now you can validate that Tenant1 can not see database names:
- Open SSMS.
- Log in utilizing
Tenant1. - Develop the
Databasesfolder. - Verify that
Tenant1can’t see any of the database names.

Database names are hidden. Nevertheless, when you hook up with the occasion with the Tenant2 login, it is best to see the database names. The reason being that the customized saved process was not utilized to the Tenant2 login.
Database names are seen.
Revert modifications
To revert the modifications, full the next steps:
- Revert the modifications by operating the next command:
- Sign off and open a brand new question session to the RDS occasion utilizing the
Tenant1login. - Verify you’ll be able to see the database names once more.

Database names are seen.
Limitations
The answer has the next key limitations and operational issues:
- When a login is dropped and recreated, the saved process have to be re-executed to reapply the permission.
- This saved process doesn’t handle database entry permission; database entry permissions should nonetheless be managed individually via acceptable safety measures.
- Database names would possibly stay seen in SQL Server traces, error logs, and particular dynamic administration views (DMVs), even when this permission is utilized.
- When the permission is revoked, the database names will likely be seen to that login.
- Permissions are set on the server degree. When a database is restored to a brand new occasion utilizing the restore methodology, the permissions have to be reapplied.
- The database title visibility management can’t be utilized to the
Majorlogin; all database names all the time will likely be seen for theMajorlogin.
Clear up
When you created a check database to comply with together with this demonstration, be certain that to clear up assets to keep away from pointless costs. Take away the check customers, logins, and databases out of your RDS for SQL Server occasion. When you particularly created an RDS occasion or EC2 host for this demo, delete these assets via the Amazon RDS and Amazon EC2 consoles, respectively, in the event that they’re not getting used. This can assist keep away from incurring undesirable costs.
Conclusion
On this submit, we demonstrated tips on how to handle database title visibility in a multi-tenant atmosphere utilizing Amazon RDS for SQL Server. We walked via the method of hiding database names utilizing the Amazon RDS for SQL Server customized saved process, which helps stop different tenants on the identical host from seeing doubtlessly delicate buyer data that could be revealed via database names. You’ll be able to apply this answer to manage database title visibility in your Amazon RDS for SQL Server environments whereas sustaining the required entry permissions to your purposes.
To be taught extra about Amazon RDS particular frequent DBA duties, consult with Frequent DBA duties for Amazon RDS for Microsoft SQL Server.
In regards to the Authors

