mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
/**
|
|
* This sample demonstrates how to Get the server's threat detection policies.
|
|
*
|
|
* @summary Get the server's threat detection policies.
|
|
* x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsListByServer.json
|
|
*/
|
|
|
|
import { PostgreSQLManagementClient } from "@azure/arm-postgresql";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
|
|
async function listTheServerThreatDetectionPolicies(): Promise<void> {
|
|
const subscriptionId = "00000000-1111-2222-3333-444444444444";
|
|
const resourceGroupName = "securityalert-4799";
|
|
const serverName = "securityalert-6440";
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new PostgreSQLManagementClient(credential, subscriptionId);
|
|
const resArray = new Array();
|
|
for await (const item of client.serverSecurityAlertPolicies.listByServer(
|
|
resourceGroupName,
|
|
serverName,
|
|
)) {
|
|
resArray.push(item);
|
|
}
|
|
console.log(resArray);
|
|
}
|
|
|
|
listTheServerThreatDetectionPolicies().catch(console.error);
|