70-465 · Question #122
You have two databases named DB1 and DB2 that are located on the same server. You plan to create a stored procedure named SProc1 in DB1. SProc1 will query a table named Table2 in DB2. You need to…
The correct answer is B. Application roles. This question tests knowledge of SQL Server security mechanisms that allow stored procedures to access cross-database objects without exposing underlying tables directly to users.
Question
Options
- AContained databases
- BApplication roles
- CCross-database ownership chaining
- DDigital certificates
How the community answered
(48 responses)- A6% (3)
- B73% (35)
- C17% (8)
- D4% (2)
Why each option
This question tests knowledge of SQL Server security mechanisms that allow stored procedures to access cross-database objects without exposing underlying tables directly to users.
Contained databases isolate users and authentication within a single database boundary, but they actually restrict cross-database access rather than enabling it, making them unsuitable for this cross-database query scenario.
Application roles in SQL Server allow a stored procedure's execution context to be controlled such that users can execute SProc1 without having direct permissions on Table2 in DB2. By granting the application role permissions on Table2 and having SProc1 activated under that role's context, users interact only through the procedure. This provides the required abstraction layer between end users and the underlying table.
Cross-database ownership chaining can enable cross-database object access without explicit grants, but it requires the ownership chain to be unbroken across both databases and is considered a broader security risk since it implicitly grants access rather than tightly scoping it through a controlled mechanism like an application role.
Digital certificates can be used to sign stored procedures and enable cross-database access by mapping certificate-based users, which is a valid technical approach, but it is more complex to implement and less directly aligned with the goal of controlling user access through a role-based abstraction compared to application roles.
Concept tested: SQL Server cross-database access control without direct table permissions
Source: https://learn.microsoft.com/en-us/sql/relational-databases/security/authentication-access/application-roles
Topics
Community Discussion
No community discussion yet for this question.