exam questions

Exam DP-300 All Questions

View all questions & answers for the DP-300 exam

Exam DP-300 topic 2 question 19 discussion

Actual exam question from Microsoft's DP-300
Question #: 19
Topic #: 2
[All DP-300 Questions]

HOTSPOT -
You have an Azure SQL database named db1 that contains an Azure Active Directory (Azure AD) user named user1.
You need to test impersonation of user1 in db1 by running a SELECT statement and returning to the original execution context.
How should you complete the Transact-SQL statement? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.
Hot Area:

Show Suggested Answer Hide Answer
Suggested Answer:
Box 1: USER -
Using EXECUTE AS and REVERT to switch context.
The following example creates a context execution stack using multiple principals. The REVERT statement is then used to reset the execution context to the previous caller.
**
EXECUTE AS USER = 'user2';
--The following REVERT statements will reset the execution context to the previous context.
REVERT;
**
Reference:
https://docs.microsoft.com/en-us/sql/t-sql/statements/execute-as-transact-sql?view=sql-server-ver15 https://docs.microsoft.com/en-us/sql/t-sql/functions/suser-sname-transact-sql?view=sql-server-ver15

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
JustAnotherDBA
Highly Voted 1 year, 11 months ago
The answer is correct.
upvoted 6 times
...
wyindualizer
Most Recent 1 year, 6 months ago
https://en.dirceuresende.com/blog/sql-server-how-to-use-execute-as-to-execute-commands-as-another-impersonate-user-and-how-to-prevent-it/
upvoted 1 times
igorclapa
8 months, 3 weeks ago
your link doesn't work anymore
upvoted 2 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...