SQL 2017 - Granting unmask access to security group not working getting errors

Kevin 0 Reputation points
2024-04-15T15:38:23.29+00:00

Hi All,

I am trying to grant unmask access for a security group for a specific table and for a specific column however im getting a the below error message.

query executed.

GRANT UNMASK ON schemaName.tablename(ColumnName) TO [Account that requires access, in my case a security group]

error message :

Msg 102, Level 15, State 1, Line 0

Incorrect syntax near 'UNMASK'.

Anyone experience this issue and how does one resolve this?

Regards

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,742 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 40,896 Reputation points
    2024-04-15T16:30:06.1566667+00:00

    See

    https://learn.microsoft.com/en-us/sql/t-sql/statements/grant-object-permissions-transact-sql?view=sql-server-ver16

    => example G. Grant UNMASK permission on a column for the correct syntax.


  2. MikeyQiao-MSFT 560 Reputation points Microsoft Vendor
    2024-04-16T08:12:38.8666667+00:00

    Hi,Kevin

    Starting from SQL Server 2022, dynamic data masking supports granting UNMASK permission at the column level.

    Details refer to https://learn.microsoft.com/en-us/sql/relational-databases/security/dynamic-data-masking?view=sql-server-ver16#granular

    So in SQL Server 2017, you cannot grant UNMASK permission on a specific column.

    The executable statement is as follows:

    GRANT UNMASK TO [UserOrGroupName];