Skip to content

Commit 5c0b3df

Browse files
Merge pull request #251125 from mumian/0912-bicepparam-var
add the Bicepparam variable support
2 parents 1ac218a + 40c5d6d commit 5c0b3df

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

articles/azure-resource-manager/bicep/parameter-files.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Create parameters files for Bicep deployment
33
description: Create parameters file for passing in values during deployment of a Bicep file
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 06/26/2023
6+
ms.date: 09/12/2023
77
---
88

99
# Create parameters files for Bicep deployment
@@ -47,6 +47,35 @@ using './main.bicep'
4747
param intFromEnvironmentVariables = int(readEnvironmentVariable('intEnvVariableName'))
4848
```
4949

50+
You can define and use variables. Bicep CLI version 0.21.1 or newer is required for using variables in .bicepparam file. Here are some examples:
51+
52+
```bicep
53+
using './main.bicep'
54+
55+
var storagePrefix = 'myStorage'
56+
param primaryStorageName = '${storagePrefix}Primary'
57+
param secondaryStorageName = '${storagePrefix}Secondary'
58+
```
59+
60+
```bicep
61+
using './main.bicep'
62+
63+
var testSettings = {
64+
instanceSize: 'Small'
65+
instanceCount: 1
66+
}
67+
68+
var prodSettings = {
69+
instanceSize: 'Large'
70+
instanceCount: 4
71+
}
72+
73+
param environmentSettings = {
74+
test: testSettings
75+
prod: prodSettings
76+
}
77+
```
78+
5079
# [JSON parameters file](#tab/JSON)
5180

5281
```json

0 commit comments

Comments
 (0)