Activity: Implementing DDM
With RLS implemented in the previous activity, Mike has ensured that the customer can only view their own data; however, to take data security to the next level, he wants to mask some of the sensitive data that is shared by the customer. In order to do this, he has to implement DDM. In this activity, we'll implement DDM to mask the credit card number, phone number, and email ID of a customer:
- Execute the following query to create a new user and grant select access to the user on the
dpl.Customers
table:CREATE USER TestUser WITHOUT LOGIN; GO GRANT SELECT ON dpl.Customers TO TestUser
- Execute the following query to mask the
CreditCardNumber
,Phone
, andEmail
columns using different masking functions:ALTER TABLE dpl.Customers ALTER COLUMN Phone VARCHAR(100) MASKED WITH (FUNCTION = 'default()') GO ALTER TABLE dpl.Customers ALTER COLUMN Email VARCHAR(100) MASKED WITH (FUNCTION = 'email()') GO ALTER TABLE dpl.Customers ALTER...