Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Azure Developer CLI (azd) supports Bicep templates with the @metadata decorator. Add metadata to Bicep input parameters to improve deployment with intelligent defaults, automatic value generation, and better parameter prompting.
Adding metadata
Input parameters in Bicep support @metadata as a schema-free object. Add azd metadata by including the azd field in the parameter metadata:
@metadata({
azd: {}
})
param someInput <param-type>
Azure Developer CLI metadata doesn't depend on the parameter's type, and you can add it to any parameter.
Supported metadata
The supported configuration fields for azd metadata are:
| Field | Description |
|---|---|
type |
Defines how azd prompts for this parameter. For example, location. |
config |
Describes settings for some metadata types, like generate. |
default |
Defines a value for azd to highlight first during a select prompt. |
usageName |
Controls quota check for AI model location selection. |
Each field is described in more detail in the following sections.
Type
This configuration defines how azd prompts for an input parameter. Supported types include:
location
Use the
locationtype to tellazdthat an input parameter handles an Azure location. Whenazdfinds thelocationtype in the metadata, it prompts for a value using the location selection list. For example:@metadata({ azd: { type: 'location' } }) param someInput stringPrompt flow:
Combine the
locationtype with thedefaultfield to control which location is highlighted first during the prompt flow. For example:@metadata({ azd: { type: 'location' default: 'westus' } }) param someInput stringPrompting flow:
The highlighted default option matches the
defaultfield from the metadata. This approach lets template authors recommend a location while users can confirm or change it. Setting a default value for the input parameter in Bicep skips the prompt flow and uses the default value without user confirmation.generate
Use the
generatetype to tellazdto automatically create the value for the input parameter. This type is often used to generate passwords or unique identifiers:@metadata({ azd: { type: 'generate' config: { length: 10 } } }) param someInput stringNote
The
configfield is required withtype: 'generate'.When
azdruns, it generates a 10-character value for the input parameter without prompting for input. See the config section for options to configure auto-generation values.resourceGroup
Use the
resourceGrouptype to tellazdto prompt for a resource group for this input:@metadata({ azd: { type: 'resourceGroup' } }) param someInput stringPrompt flow:
Config
The config object is required with the generate type. It controls auto-generation options. The following table describes the generate configuration options:
| Field Name | Type | Description | Default |
|---|---|---|---|
| length | int | Total length of the generated value | 0 |
| noLower | bool | If true, excludes lowercase letters. | false |
| noUpper | bool | If true, excludes uppercase letters. | false |
| noNumeric | bool | If true, excludes numbers. | false |
| noSpecial | bool | If true, excludes special characters. | false |
| minLower | int | Minimum number of lowercase letters required. | 0 |
| minUpper | int | Minimum number of uppercase letters required. | 0 |
| minNumeric | int | Minimum number of numbers required. | 0 |
| minSpecial | int | Minimum number of special characters required. | 0 |
Important
The sum of all minimum requirements (MinLower + MinUpper + MinNumeric + MinSpecial) can't exceed the total Length. If any "No-" flag is true, set the corresponding "Min-" value to 0.
For example, generate a value with length 10, no special characters, and no numbers:
@metadata({
azd: {
type: 'generate'
config: {
length: 10
noNumeric: true
noSpecial: true
}
}
})
param someInput string
Default
Defines the initial value from a list to highlight. Combine it with the location type or apply it directly to an input with a defined list of options:
@allowed(['foo', 'bar', 'baz'])
@metadata({
azd: {
default: 'baz'
}
})
param someInput string
This example uses the @allowed() annotation from Bicep to define a list of supported values for the input parameter. When azd prompts for this input, it uses the list of allowed values. The default field in the metadata controls which option is set as the initial selection:
UsageName
The usageName field filters the location list to only locations where a given AI SKU and capacity are available:
@metadata({
azd: {
type: 'location'
usageName: [
'OpenAI.GlobalStandard.gpt-5-mini,10'
]
}
})
param someInput string
This example makes azd show only Azure locations where the AI model gpt-5-mini has enough quota (capacity of at least 10).
Prompt flow:
Note
azd returns an error if there isn't a location with enough quota.