mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
/**
|
|
* This sample demonstrates how to Returns a list of all linked subscriptions under current resource group.
|
|
*
|
|
* @summary Returns a list of all linked subscriptions under current resource group.
|
|
* x-ms-original-file: specification/azurestack/resource-manager/Microsoft.AzureStack/preview/2020-06-01-preview/examples/LinkedSubscription/List.json
|
|
*/
|
|
|
|
import { AzureStackManagementClient } from "@azure/arm-azurestack";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
|
|
async function returnsAListOfAllLinkedSubscriptions(): Promise<void> {
|
|
const subscriptionId = "dd8597b4-8739-4467-8b10-f8679f62bfbf";
|
|
const resourceGroup = "azurestack";
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new AzureStackManagementClient(credential, subscriptionId);
|
|
const resArray = new Array();
|
|
for await (const item of client.linkedSubscriptions.listByResourceGroup(resourceGroup)) {
|
|
resArray.push(item);
|
|
}
|
|
console.log(resArray);
|
|
}
|
|
|
|
returnsAListOfAllLinkedSubscriptions().catch(console.error);
|