Files

40 lines
1.5 KiB
TypeScript

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/**
* This sample demonstrates how to Create or update a monitored GitHub Connector resource.
*
* @summary Create or update a monitored GitHub Connector resource.
* x-ms-original-file: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorCreateOrUpdate.json
*/
import type { GitHubConnector } from "@azure/arm-securitydevops";
import { MicrosoftSecurityDevOps } from "@azure/arm-securitydevops";
import { DefaultAzureCredential } from "@azure/identity";
import "dotenv/config";
async function gitHubConnectorCreateOrUpdate(): Promise<void> {
const subscriptionId =
process.env["SECURITYDEVOPS_SUBSCRIPTION_ID"] || "00000000-0000-0000-0000-000000000000";
const resourceGroupName = process.env["SECURITYDEVOPS_RESOURCE_GROUP"] || "westusrg";
const gitHubConnectorName = "testconnector";
const gitHubConnector: GitHubConnector = {
location: "West US",
properties: { code: "00000000000000000000" },
};
const credential = new DefaultAzureCredential();
const client = new MicrosoftSecurityDevOps(credential, subscriptionId);
const result = await client.gitHubConnectorOperations.beginCreateOrUpdateAndWait(
resourceGroupName,
gitHubConnectorName,
gitHubConnector,
);
console.log(result);
}
async function main(): Promise<void> {
await gitHubConnectorCreateOrUpdate();
}
main().catch(console.error);