mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
41 lines
1.3 KiB
TypeScript
41 lines
1.3 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
/**
|
|
* This sample demonstrates how to
|
|
*
|
|
* @summary
|
|
* x-ms-original-file: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoList.json
|
|
*/
|
|
|
|
import { MicrosoftSecurityDevOps } from "@azure/arm-securitydevops";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
import "dotenv/config";
|
|
|
|
async function azureDevOpsRepoList(): Promise<void> {
|
|
const subscriptionId =
|
|
process.env["SECURITYDEVOPS_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
|
|
const resourceGroupName = process.env["SECURITYDEVOPS_RESOURCE_GROUP"] || "westusrg";
|
|
const azureDevOpsConnectorName = "testconnector";
|
|
const azureDevOpsOrgName = "myOrg";
|
|
const azureDevOpsProjectName = "myProject";
|
|
const credential = new DefaultAzureCredential();
|
|
const client = new MicrosoftSecurityDevOps(credential, subscriptionId);
|
|
const resArray = new Array();
|
|
for await (const item of client.azureDevOpsRepoOperations.list(
|
|
resourceGroupName,
|
|
azureDevOpsConnectorName,
|
|
azureDevOpsOrgName,
|
|
azureDevOpsProjectName,
|
|
)) {
|
|
resArray.push(item);
|
|
}
|
|
console.log(resArray);
|
|
}
|
|
|
|
async function main(): Promise<void> {
|
|
await azureDevOpsRepoList();
|
|
}
|
|
|
|
main().catch(console.error);
|