
Explanation:
The provided row-level security (RLS) predicate function works as follows:
CREATE FUNCTION Security.fn_securitypredicate(@SalesRep AS sysname)
RETURNS TABLE
WITH SCHEMABINDING
AS
RETURN SELECT 1 AS fn_securitypredicate_result
WHERE @SalesRep = USER_NAME() OR USER_NAME() = 'Manager';
CREATE FUNCTION Security.fn_securitypredicate(@SalesRep AS sysname)
RETURNS TABLE
WITH SCHEMABINDING
AS
RETURN SELECT 1 AS fn_securitypredicate_result
WHERE @SalesRep = USER_NAME() OR USER_NAME() = 'Manager';
This function returns rows where either:
SalesRep column value equals the current user's name (USER_NAME())When SalesUser1 queries the table:
USER_NAME() returns 'SalesUser1'@SalesRep = 'SalesUser1' OR 'SalesUser1' = 'Manager'SalesRep = 'SalesUser1' are returnedOption D is correct because the RLS filter predicate specifically allows users to see only rows where they are listed as the SalesRep, unless they are the Manager user who can see all rows.
This implementation follows the standard RLS pattern in Azure Synapse Analytics where users can only access data they "own" (where they are the assigned representative), while managers have broader access. This maintains data isolation while allowing necessary administrative oversight.
Ultimate access to all questions.
No comments yet.
You have an Azure Synapse Analytics dedicated SQL pool named Pool1 containing a table named Sales. Row-level security (RLS) is applied to the Sales table with the following predicate filter:
CREATE FUNCTION Security.fn_securitypredicate(@SalesRep AS sysname)
RETURNS TABLE
WITH SCHEMABINDING
AS
RETURN SELECT 1 AS fn_securitypredicate_result
WHERE @SalesRep = USER_NAME() OR USER_NAME() = 'Manager';
GO
CREATE SECURITY POLICY SalesFilter
ADD FILTER PREDICATE Security.fn_securitypredicate(SalesRep)
ON dbo.Sales
WITH (STATE = ON);
CREATE FUNCTION Security.fn_securitypredicate(@SalesRep AS sysname)
RETURNS TABLE
WITH SCHEMABINDING
AS
RETURN SELECT 1 AS fn_securitypredicate_result
WHERE @SalesRep = USER_NAME() OR USER_NAME() = 'Manager';
GO
CREATE SECURITY POLICY SalesFilter
ADD FILTER PREDICATE Security.fn_securitypredicate(SalesRep)
ON dbo.Sales
WITH (STATE = ON);
A user named SalesUser1 is assigned the db_datareader role for Pool1.
Which rows from the Sales table will be returned when SalesUser1 executes a query against it?

A
only the rows for which the value in the User_Name column is SalesUser1
B
all the rows
C
only the rows for which the value in the SalesRep column is Manager
D
only the rows for which the value in the SalesRep column is SalesUser1