@azure/provisioning-coreAzure 프로비저닝 리소스 라이브러리의 공유 저작 모델을 제공합니다.
시작하기
배포 스택을 생성한 후 자원을 스택이나 다른 프로비저닝 컴포넌트에 연결합니다:
import { Stack, ResourceGroup, fn } from "@azure/provisioning-core";
const stack = new Stack("application");
new ResourceGroup(stack, {
name: fn.concat("rg-", fn.uniqueString("application")),
location: "eastus",
});
핵심 Resource API를 사용하여 Key Vault 리소스를 리소스 그룹에 직접 연결하세요:
import { Stack, ResourceGroup, Resource, fn } from "@azure/provisioning-core";
const stack = new Stack("keyvault-deployment");
const resourceGroup = new ResourceGroup(stack, {
name: "rg-keyvault",
location: "eastus",
});
new Resource(resourceGroup, {
type: "Microsoft.KeyVault/vaults",
apiVersion: "2024-11-01",
name: fn.concat("kv-", fn.uniqueString(resourceGroup.id)),
location: resourceGroup.location,
properties: {
tenantId: "00000000-0000-0000-0000-000000000000",
sku: { family: "A", name: "standard" },
},
});
서비스별 타입 리소스 클래스에 대해서는 Key Vault 프로비저닝 예제를 참조하세요.
프로비저닝 정의는 배포 전에 작성됩니다. 읽기 전용 리소스 속성은 배선 출력 및 의존 자원에 대한 표현식으로 남아 있으며, 작성 가능한 속성만 할당할 수 있습니다.
배치 시간 판별 장치
판별자 속성은 리터럴 타입을 사용하여 TypeScript가 올바른 유니언 멤버를 선택할 수 있도록 합니다. 판별자가 배포 시간 표현식에서 나올 경우, 타 asDiscriminator 입을 유지하면서 다른 속성은 확인하면서 의도된 변형을 선택합니다:
import { ParameterCollection, asDiscriminator } from "@azure/provisioning-core";
type Rule =
| {
kind: "cache";
cacheKind: "long" | "short";
days: number;
}
| {
kind: "redirect";
url: string;
};
const ruleKind = new ParameterCollection().add("ruleKind", "string", {
allowed: ["cache"],
});
const widget: {
properties: {
primaryRule?: Rule;
};
} = {
properties: {},
};
widget.properties.primaryRule = {
kind: asDiscriminator(ruleKind),
cacheKind: "long",
days: 7,
};
가능하면 문자 그대로 판별자를 선호하세요.
asDiscriminator 배포 시간 값을 검증하지 않습니다; 매개변수를 의도된 리터럴 allowed로 제한하여 .
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
Azure SDK for JavaScript