Dream
Dream

Reputation: 11

Azure Management API - Failed to retrieve Data Masking settings

I am calling the below Azure management API and got the "Failed to retrieve Data Masking settings" exception. I don't know why it is occurring.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/Default?api-version=2014-04-01

Can anyone tell, what is the reason for this exception?

Any help will be appreciated.

Upvotes: 0

Views: 268

Answers (1)

Utkarsh Pal
Utkarsh Pal

Reputation: 4544

The data you trying to get using mentioned Azure Management API might be sensitive and therefore need masking of the column in which you are inserting it.

Dynamic data masking helps prevent unauthorized access to sensitive data by enabling customers to designate how much of the sensitive data to reveal with minimal impact on the application layer. It’s a policy-based security feature that hides the sensitive data in the result set of a query over designated database fields, while the data in the database is not changed.

You can apply Dynamic Data Masking in the Azure SQL database using the Azure portal. Please refer the example given below.

Log in to the Azure portal and click on SQL Databases.

Click on the database where you are going to set up Dynamic Data Masking.

enter image description here

Under the Security section, click on Dynamic Data Masking. This page shows the list of tables and columns in the database that is recommended for masking.

enter image description here

Click on Add mask button to mask the column using the default Dynamic Data Masking function. Click on Save to apply the masking.

enter image description here

Now if you run SELECT query to retrieve the data from the database, you still be able to see the unmasked data as you have the appropriate permissions to view data.

Execute the following script to add new user and assign db_datareader rule.

CREATE USER myuser WITH PASSWORD = '<pwd>'

ALTER ROLE [db_datareader] ADD MEMBER [myuser]

Now if you login using the credentials of this new user, and run any SELECT query, you can observe that the column which you have masked showing XXXX. It implies that masking has been applied to this column and an unauthorized user won’t be able to see the data.

enter image description here

I suggest you to please go through Dynamic data masking for more information.

Upvotes: 0

Related Questions