mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
Configurations: 'specification/developerhub/resource-manager/Microsoft.DevHub/DeveloperHub/tspconfig.yaml', API Version: 2025-03-01-preview, SDK Release Type: beta, and CommitSHA: '4270ac9d4ba3f3bb031b01f5773208d7d4827a9e' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6392787 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --------- Co-authored-by: Jiao Di (MSFT) <[email protected]>
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
// Copyright (c) Microsoft Corporation.
|
|
// Licensed under the MIT License.
|
|
|
|
import { DeveloperHubServiceClient } from "@azure/arm-devhub";
|
|
import { DefaultAzureCredential } from "@azure/identity";
|
|
|
|
/**
|
|
* This sample demonstrates how to creates or updates a IacProfile
|
|
*
|
|
* @summary creates or updates a IacProfile
|
|
* x-ms-original-file: 2025-03-01-preview/IacProfile_CreateOrUpdate.json
|
|
*/
|
|
async function createIacProfile(): Promise<void> {
|
|
const credential = new DefaultAzureCredential();
|
|
const subscriptionId = "a0a37f63-7183-4e86-9ac7-ce8036a3ed31";
|
|
const client = new DeveloperHubServiceClient(credential, subscriptionId);
|
|
const result = await client.iacProfiles.createOrUpdate("resourceGroup1", "profile1", {
|
|
location: "location1",
|
|
githubProfile: {
|
|
repositoryMainBranch: "main",
|
|
repositoryName: "localtest",
|
|
repositoryOwner: "owner",
|
|
},
|
|
stages: [
|
|
{ dependencies: [], gitEnvironment: "Terraform", stageName: "dev" },
|
|
{ dependencies: ["dev"], gitEnvironment: "Terraform", stageName: "qa" },
|
|
{ dependencies: ["qa"], gitEnvironment: "Terraform", stageName: "prod" },
|
|
],
|
|
templates: [
|
|
{
|
|
instanceName: "contoso",
|
|
instanceStage: "dev",
|
|
sourceResourceId: "/subscriptions/xxxx/resourceGroups/xxxx",
|
|
templateDetails: [
|
|
{ count: 1, namingConvention: "$sitid-hci", productName: "HCI" },
|
|
{ count: 1, namingConvention: "$sitid-aks", productName: "AKSarc" },
|
|
],
|
|
templateName: "base",
|
|
},
|
|
],
|
|
terraformProfile: {
|
|
storageAccountName: "hybridiac",
|
|
storageAccountResourceGroup: "hybrid-iac",
|
|
storageAccountSubscription: "subscription",
|
|
storageContainerName: "hybridiac",
|
|
},
|
|
tags: { appname: "testApp" },
|
|
});
|
|
console.log(result);
|
|
}
|
|
|
|
async function main(): Promise<void> {
|
|
await createIacProfile();
|
|
}
|
|
|
|
main().catch(console.error);
|