You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/bicep-functions-array.md
+108-4Lines changed: 108 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@ description: Describes the functions to use in a Bicep file for working with arr
4
4
author: mumian
5
5
ms.topic: conceptual
6
6
ms.author: jgao
7
-
ms.date: 04/12/2022
8
-
7
+
ms.date: 09/26/2022
9
8
---
9
+
10
10
# Array functions for Bicep
11
11
12
12
This article describes the Bicep functions for working with arrays. The lambda functions for working with arrays can be found [here](./bicep-functions-lambda.md).
@@ -195,6 +195,34 @@ The output from the preceding example with the default values is:
195
195
| objectEmpty | Bool | True |
196
196
| stringEmpty | Bool | True |
197
197
198
+
### Quickstart examples
199
+
200
+
The following example is extracted from a quickstart template, [SQL Server VM with performance optimized storage settings
In the [conditional expression](./operators-logical.md#conditional-expression--), the empty function is used to check whether the **dnsServers** array is an empty array.
225
+
198
226
## first
199
227
200
228
`first(arg1)`
@@ -239,15 +267,15 @@ The output from the preceding example with the default values is:
239
267
240
268
`flatten(arrayToFlatten)`
241
269
242
-
Takes an array of arrays, and returns an array of sub-array elements, in the original order. Sub-arrays are only flattened once, not recursively.
270
+
Takes an array of arrays, and returns an array of subarray elements, in the original order. Subarrays are only flattened once, not recursively.
In the [conditional expression](./operators-logical.md#conditional-expression--), the `length` function check the length of the **availabilityZones** array.
665
+
666
+
More examples can be found in these quickstart Bicep files:
667
+
-[Backup Resource Manager VMs using Recovery Services vault
-[Deploy API Management into Availability Zones](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.apimanagement/api-management-simple-zones)
670
+
-[Create a Firewall and FirewallPolicy with Rules and Ipgroups](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.network/azurefirewall-create-with-firewallpolicy-apprule-netrule-ipgroups)
671
+
-[Create a sandbox setup of Azure Firewall with Zones](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.network/azurefirewall-with-zones-sandbox)
672
+
612
673
## max
613
674
614
675
`max(arg1)`
@@ -729,6 +790,49 @@ The output from the preceding example with the default values is:
729
790
| ---- | ---- | ----- |
730
791
| rangeOutput | Array |[5, 6, 7]|
731
792
793
+
### Quickstart examples
794
+
795
+
The following example is extracted from a quickstart template, [Two VMs in VNET - Internal Load Balancer and LB rules
resource networkInterface 'Microsoft.Network/networkInterfaces@2021-05-01' = [for i in range(0, numberOfInstances): {
803
+
name: '${networkInterfaceName}${i}'
804
+
location: location
805
+
properties: {
806
+
...
807
+
}
808
+
}]
809
+
810
+
resource vm 'Microsoft.Compute/virtualMachines@2021-11-01' = [for i in range(0, numberOfInstances): {
811
+
name: '${vmNamePrefix}${i}'
812
+
location: location
813
+
properties: {
814
+
...
815
+
}
816
+
}]
817
+
```
818
+
819
+
The Bicep file creates two networkInterface and two virtualMachine resources.
820
+
821
+
More examples can be found in these quickstart Bicep files:
822
+
823
+
-[Multi VM Template with Managed Disk](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.compute/vm-copy-managed-disks)
824
+
-[Create a VM with multiple empty StandardSSD_LRS Data Disks](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.compute/vm-with-standardssd-disk)
825
+
-[Create a Firewall and FirewallPolicy with Rules and Ipgroups](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.network/azurefirewall-create-with-firewallpolicy-apprule-netrule-ipgroups)
826
+
-[Create an Azure Firewall with IpGroups](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.network/azurefirewall-create-with-ipgroups-and-linux-jumpbox)
827
+
-[Create a sandbox setup of Azure Firewall with Zones](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.network/azurefirewall-with-zones-sandbox)
828
+
-[Create an Azure Firewall with multiple IP public addresses](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.network/fw-docs-qs)
829
+
-[Create a standard load-balancer](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.network/load-balancer-standard-create)
830
+
-[Azure Traffic Manager VM example](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.network/traffic-manager-vm)
831
+
-[Create A Security Automation for specific Alerts](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.security/securitycenter-create-automation-for-alertnamecontains)
832
+
-[SQL Server VM with performance optimized storage settings](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.sqlvirtualmachine/sql-vm-new-storage)
833
+
-[Create a storage account with multiple Blob containers](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.storage/storage-multi-blob-container)
834
+
-[Create a storage account with multiple file shares](https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.storage/storage-multi-file-share)
0 commit comments