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

34 lines
997 B
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 lists sync groups under a hub database.
*
* @summary lists sync groups under a hub database.
* x-ms-original-file: 2025-01-01/SyncGroupListByDatabase.json
*/
async function listSyncGroupsUnderAGivenDatabase(): Promise<void> {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-1111-2222-3333-444444444444";
const client = new SqlManagementClient(credential, subscriptionId);
const resArray = new Array();
for await (const item of client.syncGroups.listByDatabase(
"syncgroupcrud-65440",
"syncgroupcrud-8475",
"syncgroupcrud-4328",
)) {
resArray.push(item);
}
console.log(resArray);
}
async function main(): Promise<void> {
await listSyncGroupsUnderAGivenDatabase();
}
main().catch(console.error);