Skip to content

Commit d694a4e

Browse files
Merge pull request #250950 from mumian/0911-udt-ga
Bicep user-defined data type GA
2 parents 3de9ded + 92be102 commit d694a4e

File tree

4 files changed

+38
-18
lines changed

4 files changed

+38
-18
lines changed

articles/azure-resource-manager/bicep/bicep-config.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Bicep config file
33
description: Describes the configuration file for your Bicep deployments
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 08/30/2023
6+
ms.date: 09/11/2023
77
---
88

99
# Configure your Bicep environment
@@ -57,7 +57,6 @@ The preceding sample enables 'userDefineTypes' and 'extensibility`. The availabl
5757
- **resourceTypedParamsAndOutputs**: Enables the type for a parameter or output to be of type resource to make it easier to pass resource references between modules. This feature is only partially implemented. See [Simplifying resource referencing](https://github.com/azure/bicep/issues/2245).
5858
- **symbolicNameCodegen**: Allows the ARM template layer to use a new schema to represent resources as an object dictionary rather than an array of objects. This feature improves the semantic equivalent of the Bicep and ARM templates, resulting in more reliable code generation. Enabling this feature has no effect on the Bicep layer's functionality.
5959
- **userDefinedFunctions**: Allows you to define your own custom functions. See [User-defined functions in Bicep](./user-defined-functions.md).
60-
- **userDefinedTypes**: Allows you to define your own custom types for parameters. See [User-defined types in Bicep](https://aka.ms/bicepCustomTypes).
6160

6261
## Next steps
6362

articles/azure-resource-manager/bicep/data-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.date: 07/07/2023
88

99
# Data types in Bicep
1010

11-
This article describes the data types supported in [Bicep](./overview.md). [User-defined data types](./user-defined-data-types.md) are currently in preview.
11+
This article describes the data types supported in [Bicep](./overview.md). To define custom data types, see [User-defined data types](./user-defined-data-types.md).
1212

1313
## Supported types
1414

articles/azure-resource-manager/bicep/file.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Bicep file structure and syntax
33
description: Describes the structure and properties of a Bicep file using declarative syntax.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 08/30/2023
6+
ms.date: 09/11/2023
77
---
88

99
# Understand the structure and syntax of Bicep files
@@ -23,6 +23,8 @@ metadata <metadata-name> = ANY
2323
2424
targetScope = '<scope>'
2525
26+
type <user-defined-data-type-name> = <type-expression>
27+
2628
func <user-defined-function-name> (<argument-name> <data-type>, <argument-name> <data-type>, ...) <function-data-type> => <expression>
2729
2830
@<decorator>(<argument>)
@@ -97,6 +99,37 @@ The allowed values are:
9799

98100
In a module, you can specify a scope that is different than the scope for the rest of the Bicep file. For more information, see [Configure module scope](modules.md#set-module-scope)
99101

102+
## Types
103+
104+
You can use the `type` statement to define user-defined data types.
105+
106+
```bicep
107+
param location string = resourceGroup().location
108+
109+
type storageAccountSkuType = 'Standard_LRS' | 'Standard_GRS'
110+
111+
type storageAccountConfigType = {
112+
name: string
113+
sku: storageAccountSkuType
114+
}
115+
116+
param storageAccountConfig storageAccountConfigType = {
117+
name: 'storage${uniqueString(resourceGroup().id)}'
118+
sku: 'Standard_LRS'
119+
}
120+
121+
resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = {
122+
name: storageAccountConfig.name
123+
location: location
124+
sku: {
125+
name: storageAccountConfig.sku
126+
}
127+
kind: 'StorageV2'
128+
}
129+
```
130+
131+
For more information, see [User-defined data types](./user-defined-data-types.md).
132+
100133
## Functions (Preview)
101134

102135
> [!NOTE]

articles/azure-resource-manager/bicep/user-defined-data-types.md

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,15 @@ title: User-defined types in Bicep
33
description: Describes how to define and use user-defined data types in Bicep.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 08/29/2023
6+
ms.date: 09/11/2023
77
---
88

9-
# User-defined data types in Bicep (Preview)
9+
# User-defined data types in Bicep
1010

1111
Learn how to use user-defined data types in Bicep.
1212

1313
[Bicep version 0.12.1 or newer](./install.md) is required to use this feature.
1414

15-
## Enable the preview feature
16-
17-
To enable this preview, modify your project's [bicepconfig.json](./bicep-config.md) file to include the following JSON:
18-
19-
```json
20-
{
21-
"experimentalFeaturesEnabled": {
22-
"userDefinedTypes": true
23-
}
24-
}
25-
```
26-
2715
## User-defined data type syntax
2816

2917
You can use the `type` statement to define user-defined data types. In addition, you can also use type expressions in some places to define custom types.

0 commit comments

Comments
 (0)