@azure/provisioning-core package
Classes
| DefaultNamingPolicy |
Default workload-based naming policy. Generates names by composing the resource type abbreviation, workload,
environment, region, label, and an ordinal suffix for repeated types.
Global-scope resources get a |
| OutputCollection |
Authoring-time collection of a stack's deployment outputs. Backed by an ordered private array; supports add/get/delete/iteration. Outputs are terminal sinks (no expression handle), so iteration yields metadata. |
| ParameterCollection |
Authoring-time collection of a stack's deployment parameters. Backed by an ordered private array; supports add/get/delete/iteration. Look parameters up by name via ParameterCollection.get. |
| ProvisioningComponent |
Base class for all tree nodes in the library object model. Example
|
| Resource |
Base class for all Azure resources. Example
|
| ResourceDeclaration |
Shared base for resource declaration implementations. |
| ResourceGroup |
An Azure resource group that establishes a deployment boundary. Example
|
| Stack |
A Stack defines a deployment unit. |
| VariableCollection |
Authoring-time collection of a stack's deployment variables. Backed by an ordered private array; supports add/get/delete/iteration. Look variables up by name via VariableCollection.get. |
Interfaces
| ManagementGroupScope |
Typed shape of Bicep's |
| ResourceGroupScope |
Typed shape of Bicep's |
| SubscriptionScope |
Typed shape of Bicep's |
| TenantScope |
Typed shape of Bicep's |
| AnyShape |
A TypeSpec scalar rendered as TypeScript |
| ArrayAccessExpressionNode | |
| ArrayShape |
An array-of-T property/container shape. |
| BinaryExpressionNode | |
| BooleanLiteralShape |
A terminal TypeSpec boolean literal. |
| BooleanShape |
A scalar whose client-side JavaScript representation is |
| BooleanStringEncodingDescriptor | |
| BytesEncodingDescriptor | |
| BytesShape |
A scalar whose client-side JavaScript representation is |
| DateShape |
A scalar whose client-side JavaScript representation is |
| DateTimeTextEncodingDescriptor | |
| DeferredShape |
Deferred reference to a shape value. The thunk is called on dereference so the actual shape lookup is deferred. Why this exists instead of embedding the shape directly. Model shapes frequently reference each other — a model's properties can point to other models, and ARM types include both self- referential (tree-like) and mutually-referential (cyclic) structures. If we embedded a ModelShape value directly inside another model shape's value field, both shapes would need to be fully initialized when the parent is constructed. That's impossible whenever:
In all three cases the second constant is in the Temporal Dead Zone
when the first one's literal evaluates, and the runtime throws
Wrapping the reference in a thunk solves it. The closure captures the binding name, not its current value. The lookup happens later when the thunk is called — by which time the module graph has finished evaluating and both shapes are fully constructed. Only the model variant of ValueShape carries a reference —
container shapes ( |
| DeploymentContext |
Inherited environment that flows down the component tree. |
| DiscriminatedModelShape |
A name-discriminated group of variants that share one parent key
(an ARM |
| DiscriminatorNames |
The two names a discriminator field goes by. Usually identical — ARM discriminators are |
| DurationIso8601EncodingDescriptor | |
| DurationNumericEncodingDescriptor | |
| EnumShape |
A terminal TypeSpec enum. Enums cannot carry |
| ExistingResourceProps |
Public-facing props for a reference to an existing (pre-deployed) Azure
resource. This is strictly narrower than the deployable resource props —
Bicep Read-side access on the returned resource handle is unrestricted —
Symbolic parent/extension scopes are expressed by passing the parent
resource as the ProvisioningComponent |
| ExpressionBrand | |
| ExpressionTag | |
| FlatModelShape |
The standard single-model shape. |
| FlatVariantPin |
One discriminator pinned to a fixed value by a concrete flat variant. |
| FunctionCallExpressionNode | |
| IdentifierExpressionNode | |
| InputOf |
Carries an optional Expression brand on an Input-shaped interface. This is the asymmetric-brand trick that makes the Input type system work without discriminated unions:
Net effect: a single |
| InputRecord |
Writable input form for a |
| InstanceFunctionCallExpressionNode | |
| InterpolatedStringExpressionNode | |
| NamingContext | |
| NamingPolicy |
Strategy for generating Azure resource names when a resource is created
without an explicit Implement this interface to provide a custom naming convention. Two built-in implementations are provided:
|
| NamingPolicyOptions | |
| NullShape |
The TypeSpec |
| NumberLiteralShape |
A terminal TypeSpec numeric literal. |
| NumberShape |
A scalar whose client-side JavaScript representation is |
| NumericStringEncodingDescriptor | |
| OutputMetadata |
Pure declaration data for a deployment output. Stored on the stack and read by the serializer at emit time. An output is a terminal sink — it has no expression handle. |
| ParameterMetadata |
Pure declaration data for a deployment parameter. Stored on the stack (paired with the returned expression handle in <xref:ParameterEntry>); read by the serializer at emit time. Not part of the value-level handle. |
| PlainDateEncodingDescriptor | |
| PrimitiveTypeMap |
Maps each Bicep primitive type name to its TypeScript authoring value type. Generated from TypeSpec and emitter mappings. Do not edit. |
| PropertyAccessExpressionNode | |
| PropertyShape |
A single property's shape entry. |
| QueryOptions |
Options accepted by the |
| RecordShape |
A |
| ResourceGroupProps | |
| ResourceNamingRules | |
| ResourceOptions |
Optional third-argument bag passed to every resource constructor. Holds authoring flags that affect how the resource declaration is emitted but are not ARM-modeled properties of the resource body. Fields:
|
| ResourceProps |
Internal props accepted by the base |
| ResourceState |
Internal representation used to construct resource handle objects. The proxy converts these into the public Resource shape. |
| StackOptions | |
| StringLiteralShape |
A terminal TypeSpec string literal. Literals cannot carry |
| StringShape |
A scalar whose client-side JavaScript representation is |
| SymbolicValueExpressionNode | |
| TernaryExpressionNode | |
| TupleShape |
A fixed-length heterogeneous tuple property/container shape. |
| UnaryExpressionNode | |
| UnionShape |
A terminal TypeSpec union for which no single structural shape can be
selected. Unions cannot carry |
| UnixTimestampEncodingDescriptor | |
| VariableMetadata |
Pure declaration data for a deployment variable. Stored on the stack (paired with the returned expression handle in <xref:VariableEntry>); read by the serializer at emit time. Not part of the value-level handle. |
Type Aliases
| ArrayAccessIndex |
The index stored on an ArrayAccessExpressionNode: a literal
|
| BinaryOperator |
Binary operators supported in Bicep expressions. |
| BooleanValueEncodingDescriptor |
Encoding supported by a client-side JavaScript |
| BytesValueEncodingDescriptor |
Encoding supported by a client-side JavaScript |
| ContainerShape |
A container through which property navigation can continue. |
| DateValueEncodingDescriptor |
Encodings whose client-side value is a JavaScript
|
| Deref | |
| Expression |
An opaque deploy-time expression wrapping type For object types, properties of Function-typed keys on
|
| ExpressionNode | |
| ExpressionOrValue |
Accepts either a plain value Use this on scalar/leaf Input sites (primitives, enums, literal-only
unions) where a full |
| ExpressionShape | |
| ExpressionValue | |
| FlatVariantSelector |
Pins selecting one concrete flat variant. |
| InferParamType | |
| IntegerScalarName | |
| ModelShape |
A single model's shape — either flat or discriminated. |
| NumberValueEncodingDescriptor |
Encodings whose client-side value is a JavaScript |
| NumericScalarName | |
| OutputOptions | |
| OutputType |
Primitive Bicep type names supported by deployment outputs. |
| OutputValue |
A value accepted as a deployment output's value: any JSON literal (scalar,
|
| OutputValueFor | |
| Parameter | |
| ParameterOptions | |
| PrimitiveTypeName |
The set of Bicep primitive type names. |
| PropertySegment |
A single member access segment: an object property name or an array index. |
| ProvisioningComponentConstructor | |
| ResourceCtor |
A
|
| ScalarOutputType | |
| ScopeExpression |
A Bicep Typed as |
| StringValueEncodingDescriptor |
Encodings whose client-side value is a JavaScript The source TypeSpec scalar can be a date/time, duration, byte sequence,
numeric value, or boolean. |
| TargetScope |
The deployment scope for a Bicep file. |
| TerminalValueShape |
Concrete terminal values in the generated client API. Scalar kinds describe the JavaScript value accepted by the generated
TypeScript surface, not necessarily the semantic TypeSpec scalar. For
example, a numeric |
| UnaryOperator |
Unary operators supported in Bicep expressions. |
| ValueShape | |
| Variable | |
| VariableOptions | |
| VariableValue |
A value accepted as a deployment variable's value: any JSON literal
(scalar, |
Functions
| as |
Asserts that a deploy-time expression resolves to a specific literal, so it can be used where a discriminator is expected. Discriminator properties on a When the discriminator genuinely isn't known until deployment, wrap the expression with this to state which variant you mean. See the deploy-time discriminator example. Every other property is still fully checked — only the discriminator's type safety is waived. Note that the runtime cannot dispatch on a non-literal discriminator, so serialization falls back to structural variant inference; prefer a literal wherever possible. The literal is inferred from the expression's own type argument. If the
expression is loosely typed ( |
| create |
A deployment output, compiled to a Bicep Example
|
| create |
A deploy-time input to a stack, compiled to a Bicep Example
|
| create |
A computed value evaluated at deploy time, compiled to a Bicep Example
|
| deref<T>(T) | |
| is |
Tests whether a value is an |
| is |
Is |
| is |
Is |
| is |
Type guard: is Accepts any value ( Matches scalar resource declarations (from a constructor / query /
collection). It does NOT match a |
Variables
| INTEGER_SCALAR_NAMES | |
| NUMERIC_SCALAR_NAMES | |
| naming |
Naming policy that requires every resource to provide an explicit Throws an error when asked to generate a name. Use this on a stack to disable auto-naming entirely. |
Function Details
asDiscriminator<L>(ExpressionOrValue<L>)
Asserts that a deploy-time expression resolves to a specific literal, so it can be used where a discriminator is expected.
Discriminator properties on a @discriminator model are typed as bare
literals (kind: "cache") rather than ExpressionOrValue<"cache">.
That is deliberate: TypeScript only treats a property as a discriminant
when its type is a unit type in every constituent of the union, and a
single widened arm disables narrowing for the whole union — completions
then offer every variant's properties and excess-property checking
degrades to "allowed if the property exists in any variant".
When the discriminator genuinely isn't known until deployment, wrap the expression with this to state which variant you mean. See the deploy-time discriminator example.
Every other property is still fully checked — only the discriminator's type safety is waived. Note that the runtime cannot dispatch on a non-literal discriminator, so serialization falls back to structural variant inference; prefer a literal wherever possible.
The literal is inferred from the expression's own type argument. If the
expression is loosely typed (Expression<string>), name the variant
explicitly: asDiscriminator<"cache">(param).
function asDiscriminator<L>(value: ExpressionOrValue<L>): L
Parameters
- value
Returns
L
createOutput<T>(Stack, string, T, OutputValueFor<NoInfer<T>>, OutputOptions)
A deployment output, compiled to a Bicep output declaration.
Example
import { Stack } from "@azure/provisioning-core";
import { KeyVault } from "@azure/provisioning-keyvault";
const stack = new Stack("my-app", { targetScope: "resourceGroup" });
const vault = new KeyVault(stack, {
name: "kv-my-app",
location: "eastus",
properties: {
tenantId: "11111111-1111-1111-1111-111111111111",
sku: { family: "A", name: "standard" },
},
});
stack.outputs.add("vaultUri", "string", vault.properties.vaultUri);
function createOutput<T>(stack: Stack, name: string, type: T, value: OutputValueFor<NoInfer<T>>, options?: OutputOptions): OutputMetadata
Parameters
- stack
- Stack
- name
-
string
- type
-
T
- value
-
OutputValueFor<NoInfer<T>>
- options
- OutputOptions
Returns
createParameter<T, A>(Stack, string, T, ParameterOptions<T, A>)
A deploy-time input to a stack, compiled to a Bicep param declaration.
Example
import { Stack, createParameter } from "@azure/provisioning-core";
const stack = new Stack("my-app", { targetScope: "resourceGroup" });
const env = createParameter(stack, "env", "string", {
allowed: ["dev", "staging", "prod"] as const,
defaultValue: "dev",
});
function createParameter<T, A>(stack: Stack, name: string, type: T, options?: ParameterOptions<T, A>): Parameter<T, A>
Parameters
- stack
- Stack
- name
-
string
- type
-
T
- options
-
ParameterOptions<T, A>
Returns
Parameter<T, A>
Remarks
The returned value is an Expression that can be passed to resource
properties. At deploy time, the user supplies the actual value. The
declaration metadata is stored separately on the stack, keyed by name.
createVariable<TValue>(Stack, string, TValue, VariableOptions)
A computed value evaluated at deploy time, compiled to a Bicep var declaration.
Example
import { Stack, createVariable } from "@azure/provisioning-core";
const stack = new Stack("my-app");
const suffix = createVariable(stack, "suffix", "prod");
function createVariable<TValue>(stack: Stack, name: string, value: TValue, options?: VariableOptions): Variable<TValue>
Parameters
- stack
- Stack
- name
-
string
- value
-
TValue
- options
- VariableOptions
Returns
Variable<TValue>
deref<T>(T)
isExpression(unknown)
Tests whether a value is an Expression<T> — the typed, branded handle
for a deploy-time expression (proxy-backed). Returns false for raw
ExpressionNode data; use <xref:isExpressionNode> from ./ast-nodes.js
for that.
function isExpression(value: unknown): value is Expression<unknown>
Parameters
- value
-
unknown
Returns
value is Expression<unknown>
isResource(unknown)
Is x a scalar Resource (not a looped declaration)?
function isResource(x: unknown): x is Resource<string>
Parameters
- x
-
unknown
Returns
x is Resource<string>
isResourceDeclaration(unknown)
Is x a Bicep resource declaration — either a scalar Resource or
a <xref:LoopedResource>?
function isResourceDeclaration(x: unknown): x is ResourceDeclaration<string>
Parameters
- x
-
unknown
Returns
x is ResourceDeclaration<string>
isResourceOf<T>(unknown, ResourceCtor<T>)
Type guard: is x an instance of the resource class ctor?
Narrows x to the class's instance type, so callers can access
subclass-specific accessors (e.g. kv.secrets) inside the guarded
block.
Accepts any value (unknown), like the other brand guards. A
LoopedResource<T> is not a Resource, so instanceof ctor returns
false for it — the narrowing is safe. instanceof alone is sufficient
(and stricter than a brand + ARM-type-string check: a base-Resource
impostor carrying the same type/apiVersion is correctly rejected), so
no isResource pre-check is needed.
Matches scalar resource declarations (from a constructor / query /
collection). It does NOT match a parent.at(i) element reference of a
looped declaration: that proxy intentionally keeps LoopedResource's
prototype (no getPrototypeOf trap), so instanceof is false for it
even though its ARM reads work. If we ever need cross-realm subclass
matching (per-subclass Symbol.for brands, mirroring the base
RESOURCE_BRAND), this is the one place to swap.
function isResourceOf<T>(x: unknown, ctor: ResourceCtor<T>): x is T
Parameters
- x
-
unknown
- ctor
-
ResourceCtor<T>
Returns
x is T
Variable Details
INTEGER_SCALAR_NAMES
INTEGER_SCALAR_NAMES: readonly ["integer", "safeint", "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64"]
Type
readonly ["integer", "safeint", "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64"]
NUMERIC_SCALAR_NAMES
NUMERIC_SCALAR_NAMES: readonly ["integer", "safeint", "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", "numeric", "decimal", "decimal128", "float", "float32", "float64"]
Type
readonly ["integer", "safeint", "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", "numeric", "decimal", "decimal128", "float", "float32", "float64"]
namingRequiredPolicy
Naming policy that requires every resource to provide an explicit name.
Throws an error when asked to generate a name. Use this on a stack to disable auto-naming entirely.
namingRequiredPolicy: NamingPolicy