mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
28 lines
1.3 KiB
TypeScript
28 lines
1.3 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
/**
|
|
* This sample demonstrates how to Checks if the specified Visual Studio Team Services account name is available. Resource name can be either an account name or an account name and PUID.
|
|
*
|
|
* @summary Checks if the specified Visual Studio Team Services account name is available. Resource name can be either an account name or an account name and PUID.
|
|
* x-ms-original-file: specification/visualstudio/resource-manager/Microsoft.VisualStudio/preview/2014-04-01-preview/examples/CheckNameAvailability.json
|
|
*/
|
|
|
|
import type { CheckNameAvailabilityParameter } from "@azure/arm-visualstudio";
|
|
import { VisualStudioResourceProviderClient } from "@azure/arm-visualstudio";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
|
|
async function checkAvailabilityOfAnAccountName(): Promise<void> {
|
|
const subscriptionId = "0de7f055-dbea-498d-8e9e-da287eedca90";
|
|
const body: CheckNameAvailabilityParameter = {
|
|
resourceName: "ExampleName",
|
|
resourceType: "Account",
|
|
};
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new VisualStudioResourceProviderClient(credential, subscriptionId);
|
|
const result = await client.accounts.checkNameAvailability(body);
|
|
console.log(result);
|
|
}
|
|
|
|
checkAvailabilityOfAnAccountName().catch(console.error);
|