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
The `managementGroupResourceId` function is available in Bicep files, but typically you don't need it. Instead, use the symbolic name for the resource and access the `id` property.
424
+
425
+
The identifier is returned in the following format:
You use this function to get the resource ID for resources that are [deployed to the management group](deploy-to-management-group.md) rather than a resource group. The returned ID differs from the value returned by the [resourceId](#resourceid) function by not including a subscription ID and a resource group value.
434
+
435
+
### managementGroupResourceID example
436
+
437
+
The following template creates and assigns a policy definition. It uses the `managementGroupResourceId` function to get the resource ID for policy definition.
438
+
439
+
```bicep
440
+
targetScope = 'managementGroup'
441
+
442
+
@description('Target Management Group')
443
+
param targetMG string
444
+
445
+
@description('An array of the allowed locations, all other locations will be denied by the created policy.')
446
+
param allowedLocations array = [
447
+
'australiaeast'
448
+
'australiasoutheast'
449
+
'australiacentral'
450
+
]
451
+
452
+
var mgScope = tenantResourceId('Microsoft.Management/managementGroups', targetMG)
The `managementGroupResourceId` function is available in Bicep files, but typically you don't need it. Instead, use the symbolic name for the resource and access the `id` property.
656
-
657
-
The identifier is returned in the following format:
You use this function to get the resource ID for resources that are [deployed to the management group](deploy-to-management-group.md) rather than a resource group. The returned ID differs from the value returned by the [resourceId](#resourceid) function by not including a subscription ID and a resource group value.
666
-
667
-
### managementGroupResourceID example
668
-
669
-
The following template creates and assigns a policy definition. It uses the `managementGroupResourceId` function to get the resource ID for policy definition.
670
-
671
-
```bicep
672
-
targetScope = 'managementGroup'
673
-
674
-
@description('Target Management Group')
675
-
param targetMG string
676
-
677
-
@description('An array of the allowed locations, all other locations will be denied by the created policy.')
678
-
param allowedLocations array = [
679
-
'australiaeast'
680
-
'australiasoutheast'
681
-
'australiacentral'
682
-
]
683
-
684
-
var mgScope = tenantResourceId('Microsoft.Management/managementGroups', targetMG)
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/bicep-functions.md
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Bicep functions
3
3
description: Describes the functions to use in a Bicep file to retrieve values, work with strings and numerics, and retrieve deployment information.
4
4
ms.topic: conceptual
5
5
ms.custom: devx-track-bicep
6
-
ms.date: 06/05/2023
6
+
ms.date: 05/10/2024
7
7
---
8
8
9
9
# Bicep functions
@@ -94,6 +94,7 @@ The following functions are available for working with lambda expressions. All o
94
94
*[map](bicep-functions-lambda.md#map)
95
95
*[reduce](bicep-functions-lambda.md#reduce)
96
96
*[sort](bicep-functions-lambda.md#sort)
97
+
*[toObject](bicep-functions-lambda.md#toobject)
97
98
98
99
## Logical functions
99
100
@@ -123,9 +124,10 @@ The following functions are available for working with objects. All of these fun
123
124
124
125
## Parameters file functions
125
126
126
-
The [getSecret function](./bicep-functions-parameters-file.md) is available in Bicep to get secure value from a KeyVault. This function is in the `az` namespace.
127
+
The following functions are available to be used in Bicep parameter files. All of these functions are in the `sys` namespace.
127
128
128
-
The [readEnvironmentVariable function](./bicep-functions-parameters-file.md) is available in Bicep to read environment variable values. This function is in the `sys` namespace.
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/templates/template-functions.md
+66-17Lines changed: 66 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Template functions
3
3
description: Describes the functions to use in an Azure Resource Manager template (ARM template) to retrieve values, work with strings and numerics, and retrieve deployment information.
4
4
ms.topic: conceptual
5
5
ms.custom: devx-track-arm-template
6
-
ms.date: 08/03/2023
6
+
ms.date: 05/10/2024
7
7
---
8
8
9
9
# ARM template functions
@@ -17,26 +17,30 @@ Most functions work the same when deployed to a resource group, subscription, ma
17
17
> [!TIP]
18
18
> We recommend [Bicep](../bicep/overview.md) because it offers the same capabilities as ARM templates and the syntax is easier to use. To learn more, see [Bicep functions](../bicep/bicep-functions.md) and [Bicep operators](../bicep/operators.md).
19
19
20
+
<aid="any"aria-hidden="true"></a>
21
+
22
+
## Any function
23
+
24
+
The [any function](../bicep/bicep-functions-any.md) is available in Bicep to help resolve issues around data type warnings.
25
+
20
26
<aid="array"aria-hidden="true"></a>
21
-
<aid="concatarray"aria-hidden="true"></a>
27
+
<aid="concat"aria-hidden="true"></a>
22
28
<aid="contains"aria-hidden="true"></a>
23
29
<aid="createarray"aria-hidden="true"></a>
24
30
<aid="empty"aria-hidden="true"></a>
25
31
<aid="first"aria-hidden="true"></a>
32
+
<aid="indexof"aria-hidden="true"></a>
26
33
<aid="intersection"aria-hidden="true"></a>
27
34
<aid="last"aria-hidden="true"></a>
35
+
<aid="lastindexof"aria-hidden="true"></a>
28
36
<aid="length"aria-hidden="true"></a>
29
-
<aid="min"aria-hidden="true"></a>
30
37
<aid="max"aria-hidden="true"></a>
38
+
<aid="min"aria-hidden="true"></a>
31
39
<aid="range"aria-hidden="true"></a>
32
40
<aid="skip"aria-hidden="true"></a>
33
41
<aid="take"aria-hidden="true"></a>
34
42
<aid="union"aria-hidden="true"></a>
35
43
36
-
## Any function
37
-
38
-
The [any function](../bicep/bicep-functions-any.md) is available in Bicep to help resolve issues around data type warnings.
39
-
40
44
## Array functions
41
45
42
46
Resource Manager provides several functions for working with arrays.
@@ -52,21 +56,18 @@ Resource Manager provides several functions for working with arrays.
For Bicep files, use the [coalesce](../bicep/operators-logical.md) logical operator. For comparisons, use the [comparison](../bicep/operators-comparison.md) operators.
91
99
100
+
<aid="datetimeadd"aria-hidden="true"></a>
101
+
<aid="datetimefromepoch"aria-hidden="true"></a>
102
+
<aid="datetimetoepoch"aria-hidden="true"></a>
103
+
<aid="utcnow"aria-hidden="true"></a>
104
+
92
105
## Date functions
93
106
94
107
Resource Manager provides the following functions for working with dates.
@@ -101,6 +114,7 @@ Resource Manager provides the following functions for working with dates.
101
114
For Bicep files, use the [date](../bicep/bicep-functions-date.md) functions.
102
115
103
116
<aid="deployment"aria-hidden="true"></a>
117
+
<aid="environment"aria-hidden="true"></a>
104
118
<aid="parameters"aria-hidden="true"></a>
105
119
<aid="variables"aria-hidden="true"></a>
106
120
@@ -115,11 +129,29 @@ Resource Manager provides the following functions for getting values from sectio
115
129
116
130
For Bicep files, use the [deployment](../bicep/bicep-functions-deployment.md) functions.
117
131
132
+
<aid="filter"aria-hidden="true"></a>
133
+
<aid="map"aria-hidden="true"></a>
134
+
<aid="reduce"aria-hidden="true"></a>
135
+
<aid="sort"aria-hidden="true"></a>
136
+
<aid="toObject"aria-hidden="true"></a>
137
+
138
+
## Lambda functions
139
+
140
+
Resource Manager provides the following functions for working with lambda expressions.
141
+
142
+
*[filter](bicep-functions-lambda.md#filter)
143
+
*[map](bicep-functions-lambda.md#map)
144
+
*[reduce](bicep-functions-lambda.md#reduce)
145
+
*[sort](bicep-functions-lambda.md#sort)
146
+
*[toObject](bicep-functions-lambda.md#toobject)
147
+
118
148
<aid="and"aria-hidden="true"></a>
119
149
<aid="bool"aria-hidden="true"></a>
150
+
<aid="false"aria-hidden="true"></a>
120
151
<aid="if"aria-hidden="true"></a>
121
152
<aid="not"aria-hidden="true"></a>
122
153
<aid="or"aria-hidden="true"></a>
154
+
<aid="true"aria-hidden="true"></a>
123
155
124
156
## Logical functions
125
157
@@ -163,7 +195,15 @@ Resource Manager provides the following functions for working with integers:
163
195
164
196
For Bicep files that use `int`, `min`, and `max` use [numeric](../bicep/bicep-functions-numeric.md) functions. For other numeric values, use [numeric](../bicep/operators-numeric.md) operators.
165
197
198
+
<aid="contains"aria-hidden="true"></a>
199
+
<aid="createobject"aria-hidden="true"></a>
200
+
<aid="empty"aria-hidden="true"></a>
201
+
<aid="intersection"aria-hidden="true"></a>
202
+
<aid="length"aria-hidden="true"></a>
166
203
<aid="json"aria-hidden="true"></a>
204
+
<aid="length"aria-hidden="true"></a>
205
+
<aid="null"aria-hidden="true"></a>
206
+
<aid="union"aria-hidden="true"></a>
167
207
168
208
## Object functions
169
209
@@ -181,11 +221,15 @@ Resource Manager provides several functions for working with objects.
181
221
182
222
For Bicep files, use the [object](../bicep/bicep-functions-object.md) functions.
0 commit comments