Files
azure-sdk-for-js/sdk/sql/arm-sql/samples-dev/sensitivityLabelsCreateOrUpdateSample.ts

41 lines
1.3 KiB
TypeScript

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { SqlManagementClient } from "@azure/arm-sql";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to creates or updates the sensitivity label of a given column
*
* @summary creates or updates the sensitivity label of a given column
* x-ms-original-file: 2025-01-01/ColumnSensitivityLabelCreateMax.json
*/
async function updatesTheSensitivityLabelOfAGivenColumnWithAllParameters(): Promise<void> {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-1111-2222-3333-444444444444";
const client = new SqlManagementClient(credential, subscriptionId);
const result = await client.sensitivityLabels.createOrUpdate(
"myRG",
"myServer",
"myDatabase",
"dbo",
"myTable",
"myColumn",
{
clientClassificationSource: "Native",
informationType: "PhoneNumber",
informationTypeId: "d22fa6e9-5ee4-3bde-4c2b-a409604c4646",
labelId: "bf91e08c-f4f0-478a-b016-25164b2a65ff",
labelName: "PII",
rank: "Low",
},
);
console.log(result);
}
async function main(): Promise<void> {
await updatesTheSensitivityLabelOfAGivenColumnWithAllParameters();
}
main().catch(console.error);