Creates or updates a database data masking policy.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/servers/{serverName}/databases/{databaseName}/dataMaskingPolicies/Default?api-version=2023-08-01
URI Parameters Name In Required Type Description
databaseName
path Truestring
The name of the database.
dataMaskingPolicyName
path TrueThe name of the database for which the data masking policy applies.
resourceGroupName
path Truestring
The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
serverName
path Truestring
The name of the server.
subscriptionId
path Truestring
The subscription ID that identifies an Azure subscription.
api-version
query Truestring
The API version to use for the request.
Request Body Name Required Type Description properties.dataMaskingState TrueThe state of the data masking policy.
properties.exemptPrincipalsstring
The list of the exempt principals. Specifies the semicolon-separated list of database users for which the data masking policy does not apply. The specified users receive data results without masking for all of the database queries.
Responses Name Type Description 200 OKSuccessfully created database data masking policy.
201 CreatedSuccessfully created database data masking policy..
Other Status Codes*** Error Responses: ***
PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-2080/databases/sqlcrudtest-331/dataMaskingPolicies/Default?api-version=2023-08-01
{
"properties": {
"dataMaskingState": "Enabled",
"exemptPrincipals": "testuser;"
}
}
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Sql.Models;
using Azure.ResourceManager.Sql;
// Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/stable/2023-08-01/examples/DataMaskingPolicyCreateOrUpdateMax.json
// this example is just showing the usage of "DataMaskingPolicies_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this DataMaskingPolicyResource created on azure
// for more information of creating DataMaskingPolicyResource, please refer to the document of DataMaskingPolicyResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "sqlcrudtest-6852";
string serverName = "sqlcrudtest-2080";
string databaseName = "sqlcrudtest-331";
DataMaskingPolicyName dataMaskingPolicyName = DataMaskingPolicyName.Default;
ResourceIdentifier dataMaskingPolicyResourceId = DataMaskingPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, dataMaskingPolicyName);
DataMaskingPolicyResource dataMaskingPolicy = client.GetDataMaskingPolicyResource(dataMaskingPolicyResourceId);
// invoke the operation
DataMaskingPolicyData data = new DataMaskingPolicyData
{
DataMaskingState = DataMaskingState.Enabled,
ExemptPrincipals = "testuser;",
};
ArmOperation<DataMaskingPolicyResource> lro = await dataMaskingPolicy.UpdateAsync(WaitUntil.Completed, data);
DataMaskingPolicyResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
DataMaskingPolicyData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-2080/databases/sqlcrudtest-331/dataMaskingPolicies/Default",
"name": "Default",
"type": "Microsoft.Sql/servers/databases/dataMaskingPolicies",
"location": "Central US",
"kind": null,
"properties": {
"dataMaskingState": "Enabled",
"applicationPrincipals": "",
"exemptPrincipals": "testuser;",
"maskingLevel": ""
}
}
{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-2080/databases/sqlcrudtest-331/dataMaskingPolicies/Default",
"name": "Default",
"type": "Microsoft.Sql/servers/databases/dataMaskingPolicies",
"location": "Central US",
"kind": null,
"properties": {
"dataMaskingState": "Enabled",
"applicationPrincipals": "",
"exemptPrincipals": "testuser;",
"maskingLevel": ""
}
}
Create or update data masking policy min. Sample request
PUT https://management.azure.com/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-2080/databases/sqlcrudtest-331/dataMaskingPolicies/Default?api-version=2023-08-01
{
"properties": {
"dataMaskingState": "Enabled"
}
}
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.Sql.Models;
using Azure.ResourceManager.Sql;
// Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/stable/2023-08-01/examples/DataMaskingPolicyCreateOrUpdateMin.json
// this example is just showing the usage of "DataMaskingPolicies_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this DataMaskingPolicyResource created on azure
// for more information of creating DataMaskingPolicyResource, please refer to the document of DataMaskingPolicyResource
string subscriptionId = "00000000-1111-2222-3333-444444444444";
string resourceGroupName = "sqlcrudtest-6852";
string serverName = "sqlcrudtest-2080";
string databaseName = "sqlcrudtest-331";
DataMaskingPolicyName dataMaskingPolicyName = DataMaskingPolicyName.Default;
ResourceIdentifier dataMaskingPolicyResourceId = DataMaskingPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName, dataMaskingPolicyName);
DataMaskingPolicyResource dataMaskingPolicy = client.GetDataMaskingPolicyResource(dataMaskingPolicyResourceId);
// invoke the operation
DataMaskingPolicyData data = new DataMaskingPolicyData
{
DataMaskingState = DataMaskingState.Enabled,
};
ArmOperation<DataMaskingPolicyResource> lro = await dataMaskingPolicy.UpdateAsync(WaitUntil.Completed, data);
DataMaskingPolicyResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
DataMaskingPolicyData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-2080/databases/sqlcrudtest-331/dataMaskingPolicies/Default",
"name": "Default",
"type": "Microsoft.Sql/servers/databases/dataMaskingPolicies",
"location": "Central US",
"kind": null,
"properties": {
"dataMaskingState": "Enabled",
"applicationPrincipals": "",
"exemptPrincipals": "",
"maskingLevel": ""
}
}
{
"id": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/sqlcrudtest-6852/providers/Microsoft.Sql/servers/sqlcrudtest-2080/databases/sqlcrudtest-331/dataMaskingPolicies/Default",
"name": "Default",
"type": "Microsoft.Sql/servers/databases/dataMaskingPolicies",
"location": "Central US",
"kind": null,
"properties": {
"dataMaskingState": "Enabled",
"applicationPrincipals": "",
"exemptPrincipals": "",
"maskingLevel": ""
}
}
Definitions DataMaskingPolicy
Object
A database data masking policy.
Name Type Description idstring
Resource ID.
kindstring
The kind of Data Masking Policy. Metadata, used for Azure portal.
locationstring
The location of the data masking policy.
namestring
Resource name.
properties.applicationPrincipalsstring
The list of the application principals. This is a legacy parameter and is no longer used.
properties.dataMaskingStateThe state of the data masking policy.
properties.exemptPrincipalsstring
The list of the exempt principals. Specifies the semicolon-separated list of database users for which the data masking policy does not apply. The specified users receive data results without masking for all of the database queries.
properties.maskingLevelstring
The masking level. This is a legacy parameter and is no longer used.
typestring
Resource type.
DataMaskingPolicyNameEnumeration
The name of the database for which the data masking policy applies.
Value Description Default DataMaskingStateEnumeration
The state of the data masking policy.
Value Description Enabled Disabled ErrorAdditionalInfoObject
The resource management error additional info.
Name Type Description infoobject
The additional info.
typestring
The additional info type.
ErrorDetailObject
The error detail.
Name Type Description additionalInfoThe error additional info.
codestring
The error code.
detailsThe error details.
messagestring
The error message.
targetstring
The error target.
ErrorResponseObject
Error response
Name Type Description errorThe error object.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4