40 строки
1.3 KiB
TypeScript
40 строки
1.3 KiB
TypeScript
/*
|
|
* Copyright (c) Microsoft Corporation.
|
|
* Licensed under the MIT License.
|
|
*
|
|
* Code generated by Microsoft (R) AutoRest Code Generator.
|
|
* Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
*/
|
|
|
|
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
import { ConsumptionManagementClient } from "@azure/arm-consumption";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
import * as dotenv from "dotenv";
|
|
|
|
dotenv.config();
|
|
|
|
/**
|
|
* This sample demonstrates how to Gets the budget for the scope by budget name.
|
|
*
|
|
* @summary Gets the budget for the scope by budget name.
|
|
* x-ms-original-file: specification/consumption/resource-manager/Microsoft.Consumption/stable/2021-10-01/examples/Budget.json
|
|
*/
|
|
async function budget() {
|
|
const subscriptionId =
|
|
process.env["CONSUMPTION_SUBSCRIPTION_ID"] ||
|
|
"00000000-0000-0000-0000-000000000000";
|
|
const scope = "subscriptions/00000000-0000-0000-0000-000000000000";
|
|
const budgetName = "TestBudget";
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new ConsumptionManagementClient(credential, subscriptionId);
|
|
const result = await client.budgets.get(scope, budgetName);
|
|
console.log(result);
|
|
}
|
|
|
|
async function main() {
|
|
budget();
|
|
}
|
|
|
|
main().catch(console.error);
|