Skip to content

Commit 48cf12f

Browse files
committed
Merge branch '0804-function-array' of https://github.com/mumian/azure-docs-pr into 0923-function-samples-array
the original branch was corrupted.
2 parents abbe7e8 + 808e979 commit 48cf12f

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

articles/azure-resource-manager/bicep/bicep-functions-array.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,36 @@ The output from the preceding example with the default values is:
5454
| stringOutput | Array | ["efgh"] |
5555
| objectOutput | Array | [{"a": "b", "c": "d"}] |
5656

57+
### Quickstart examples
58+
59+
The following example is extracted from a quickstart template, [SQL Server VM with performance optimized storage settings
60+
](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.sqlvirtualmachine/sql-vm-new-storage):
61+
62+
```bicep
63+
@description('Amount of data disks (1TB each) for SQL Data files')
64+
@minValue(1)
65+
@maxValue(8)
66+
param sqlDataDisksCount int = 1
67+
68+
@description('Amount of data disks (1TB each) for SQL Log files')
69+
@minValue(1)
70+
@maxValue(8)
71+
param sqlLogDisksCount int = 1
72+
73+
var dataDisksLuns = array(range(0, sqlDataDisksCount))
74+
var logDisksLuns = array(range(sqlDataDisksCount, sqlLogDisksCount))
75+
76+
output array1 array = dataDisksLuns
77+
output array2 array = logDisksLuns
78+
```
79+
80+
The output from the preceding example with the default values is:
81+
82+
| Name | Type | Value |
83+
| ---- | ---- | ----- |
84+
| array1 | Array | [0] |
85+
| array2 | Array | [1] |
86+
5787
## concat
5888

5989
`concat(arg1, arg2, arg3, ...)`
@@ -155,6 +185,34 @@ The output from the preceding example with the default values is:
155185
| arrayTrue | Bool | True |
156186
| arrayFalse | Bool | False |
157187

188+
### Quickstart examples
189+
190+
The following sample is extracted from a quickstart template, [Application Gateway with WAF and firewall policy](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.network/application-gateway-waf-firewall-policy):
191+
192+
```bicep
193+
backendHttpSettingsCollection: [for backendHttpSetting in backendHttpSettings: {
194+
name: backendHttpSetting.name
195+
properties: {
196+
port: backendHttpSetting.port
197+
protocol: backendHttpSetting.protocol
198+
cookieBasedAffinity: backendHttpSetting.cookieBasedAffinity
199+
affinityCookieName: contains(backendHttpSetting, 'affinityCookieName') ? backendHttpSetting.affinityCookieName : null
200+
requestTimeout: backendHttpSetting.requestTimeout
201+
connectionDraining: backendHttpSetting.connectionDraining
202+
probe: contains(backendHttpSetting, 'probeName') ? json('{"id": "${resourceId('Microsoft.Network/applicationGateways/probes', applicationGatewayName, backendHttpSetting.probeName)}"}') : null
203+
trustedRootCertificates: contains(backendHttpSetting, 'trustedRootCertificate') ? json('[{"id": "${resourceId('Microsoft.Network/applicationGateways/trustedRootCertificates', applicationGatewayName, backendHttpSetting.trustedRootCertificate)}"}]') : null
204+
hostName: contains(backendHttpSetting, 'hostName') ? backendHttpSetting.hostName : null
205+
pickHostNameFromBackendAddress: contains(backendHttpSetting, 'pickHostNameFromBackendAddress') ? backendHttpSetting.pickHostNameFromBackendAddress : false
206+
}
207+
}]
208+
```
209+
210+
More examples can be found in these quickstart Bicep files:
211+
212+
- [Route table with routes](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.network/route-table-create)
213+
- [Virtual Network with diagnostic logs](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.network/vnet-create-with-diagnostic-logs)
214+
- [App Service Quickstart - Linux App](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.web/app-service-docs-linux)
215+
158216
## empty
159217

160218
`empty(itemToTest)`

0 commit comments

Comments
 (0)