Skip to content

Commit ae9357e

Browse files
committed
update the function index files
1 parent f9ffba6 commit ae9357e

File tree

3 files changed

+144
-92
lines changed

3 files changed

+144
-92
lines changed

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

Lines changed: 72 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,78 @@ To determine which resource types have a list operation, you have the following
412412
az provider operation show --namespace Microsoft.Storage --query "resourceTypes[?name=='storageAccounts'].operations[].name | [?contains(@, 'list')]"
413413
```
414414

415+
## managementGroupResourceId
416+
417+
`managementGroupResourceId(resourceType, resourceName1, [resourceName2], ...)`
418+
419+
Returns the unique identifier for a resource deployed at the management group level.
420+
421+
Namespace: [az](bicep-functions.md#namespaces-for-functions).
422+
423+
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:
426+
427+
```json
428+
/providers/Microsoft.Management/managementGroups/{managementGroupName}/providers/{resourceType}/{resourceName}
429+
```
430+
431+
### Remarks
432+
433+
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)
453+
var policyDefinitionName = 'LocationRestriction'
454+
455+
resource policyDefinition 'Microsoft.Authorization/policyDefinitions@2021-06-01' = {
456+
name: policyDefinitionName
457+
properties: {
458+
policyType: 'Custom'
459+
mode: 'All'
460+
parameters: {}
461+
policyRule: {
462+
if: {
463+
not: {
464+
field: 'location'
465+
in: allowedLocations
466+
}
467+
}
468+
then: {
469+
effect: 'deny'
470+
}
471+
}
472+
}
473+
}
474+
475+
resource location_lock 'Microsoft.Authorization/policyAssignments@2021-06-01' = {
476+
name: 'location-lock'
477+
properties: {
478+
scope: mgScope
479+
policyDefinitionId: managementGroupResourceId('Microsoft.Authorization/policyDefinitions', policyDefinitionName)
480+
}
481+
dependsOn: [
482+
policyDefinition
483+
]
484+
}
485+
```
486+
415487
## pickZones
416488

417489
`pickZones(providerNamespace, resourceType, location, [numberOfZones], [offset])`
@@ -644,78 +716,6 @@ resource roleAssignment 'Microsoft.Authorization/roleAssignments@2022-04-01' = {
644716
}
645717
```
646718

647-
## managementGroupResourceId
648-
649-
`managementGroupResourceId(resourceType, resourceName1, [resourceName2], ...)`
650-
651-
Returns the unique identifier for a resource deployed at the management group level.
652-
653-
Namespace: [az](bicep-functions.md#namespaces-for-functions).
654-
655-
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:
658-
659-
```json
660-
/providers/Microsoft.Management/managementGroups/{managementGroupName}/providers/{resourceType}/{resourceName}
661-
```
662-
663-
### Remarks
664-
665-
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)
685-
var policyDefinitionName = 'LocationRestriction'
686-
687-
resource policyDefinition 'Microsoft.Authorization/policyDefinitions@2021-06-01' = {
688-
name: policyDefinitionName
689-
properties: {
690-
policyType: 'Custom'
691-
mode: 'All'
692-
parameters: {}
693-
policyRule: {
694-
if: {
695-
not: {
696-
field: 'location'
697-
in: allowedLocations
698-
}
699-
}
700-
then: {
701-
effect: 'deny'
702-
}
703-
}
704-
}
705-
}
706-
707-
resource location_lock 'Microsoft.Authorization/policyAssignments@2021-06-01' = {
708-
name: 'location-lock'
709-
properties: {
710-
scope: mgScope
711-
policyDefinitionId: managementGroupResourceId('Microsoft.Authorization/policyDefinitions', policyDefinitionName)
712-
}
713-
dependsOn: [
714-
policyDefinition
715-
]
716-
}
717-
```
718-
719719
## tenantResourceId
720720

721721
`tenantResourceId(resourceType, resourceName1, [resourceName2], ...)`

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Bicep functions
33
description: Describes the functions to use in a Bicep file to retrieve values, work with strings and numerics, and retrieve deployment information.
44
ms.topic: conceptual
55
ms.custom: devx-track-bicep
6-
ms.date: 06/05/2023
6+
ms.date: 05/10/2024
77
---
88

99
# Bicep functions
@@ -94,6 +94,7 @@ The following functions are available for working with lambda expressions. All o
9494
* [map](bicep-functions-lambda.md#map)
9595
* [reduce](bicep-functions-lambda.md#reduce)
9696
* [sort](bicep-functions-lambda.md#sort)
97+
* [toObject](bicep-functions-lambda.md#toobject)
9798

9899
## Logical functions
99100

@@ -123,9 +124,10 @@ The following functions are available for working with objects. All of these fun
123124

124125
## Parameters file functions
125126

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.
127128

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.
129+
* [getSecret](./bicep-functions-parameters-file.md)
130+
* [readEnvironmentVariable](./bicep-functions-parameters-file.md)
129131

130132
## Resource functions
131133

@@ -137,6 +139,7 @@ The following functions are available for getting resource values. Most of these
137139
* [listKeys](./bicep-functions-resource.md#listkeys)
138140
* [listSecrets](./bicep-functions-resource.md#list)
139141
* [list*](./bicep-functions-resource.md#list)
142+
* [managementGroupResourceId](./bicep-functions-resource.md#managementgroupresourceid)
140143
* [pickZones](./bicep-functions-resource.md#pickzones)
141144
* [providers (deprecated)](./bicep-functions-resource.md#providers)
142145
* [reference](./bicep-functions-resource.md#reference)

articles/azure-resource-manager/templates/template-functions.md

Lines changed: 66 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Template functions
33
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.
44
ms.topic: conceptual
55
ms.custom: devx-track-arm-template
6-
ms.date: 08/03/2023
6+
ms.date: 05/10/2024
77
---
88

99
# ARM template functions
@@ -17,26 +17,30 @@ Most functions work the same when deployed to a resource group, subscription, ma
1717
> [!TIP]
1818
> 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).
1919
20+
<a id="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+
2026
<a id="array" aria-hidden="true"></a>
21-
<a id="concatarray" aria-hidden="true"></a>
27+
<a id="concat" aria-hidden="true"></a>
2228
<a id="contains" aria-hidden="true"></a>
2329
<a id="createarray" aria-hidden="true"></a>
2430
<a id="empty" aria-hidden="true"></a>
2531
<a id="first" aria-hidden="true"></a>
32+
<a id="indexof" aria-hidden="true"></a>
2633
<a id="intersection" aria-hidden="true"></a>
2734
<a id="last" aria-hidden="true"></a>
35+
<a id="lastindexof" aria-hidden="true"></a>
2836
<a id="length" aria-hidden="true"></a>
29-
<a id="min" aria-hidden="true"></a>
3037
<a id="max" aria-hidden="true"></a>
38+
<a id="min" aria-hidden="true"></a>
3139
<a id="range" aria-hidden="true"></a>
3240
<a id="skip" aria-hidden="true"></a>
3341
<a id="take" aria-hidden="true"></a>
3442
<a id="union" aria-hidden="true"></a>
3543

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-
4044
## Array functions
4145

4246
Resource Manager provides several functions for working with arrays.
@@ -52,21 +56,18 @@ Resource Manager provides several functions for working with arrays.
5256
* [last](template-functions-array.md#last)
5357
* [lastIndexOf](template-functions-array.md#lastindexof)
5458
* [length](template-functions-array.md#length)
55-
* [min](template-functions-array.md#min)
5659
* [max](template-functions-array.md#max)
60+
* [min](template-functions-array.md#min)
5761
* [range](template-functions-array.md#range)
5862
* [skip](template-functions-array.md#skip)
5963
* [take](template-functions-array.md#take)
6064
* [union](template-functions-array.md#union)
6165

6266
For Bicep files, use the [array](../bicep/bicep-functions-array.md) functions.
6367

64-
<a id="coalesce" aria-hidden="true"></a>
65-
<a id="equals" aria-hidden="true"></a>
66-
<a id="less" aria-hidden="true"></a>
67-
<a id="lessorequals" aria-hidden="true"></a>
68-
<a id="greater" aria-hidden="true"></a>
69-
<a id="greaterorequals" aria-hidden="true"></a>
68+
<a id="parsecidr" aria-hidden="true"></a>
69+
<a id="cidrsubnet" aria-hidden="true"></a>
70+
<a id="cidrhost" aria-hidden="true"></a>
7071

7172
## CIDR functions
7273

@@ -76,19 +77,31 @@ The following functions are available for working with CIDR. All of these functi
7677
* [cidrSubnet](./template-functions-cidr.md#cidrsubnet)
7778
* [cidrHost](./template-functions-cidr.md#cidrhost)
7879

80+
<a id="coalesce" aria-hidden="true"></a>
81+
<a id="equals" aria-hidden="true"></a>
82+
<a id="greater" aria-hidden="true"></a>
83+
<a id="greaterorequals" aria-hidden="true"></a>
84+
<a id="less" aria-hidden="true"></a>
85+
<a id="lessorequals" aria-hidden="true"></a>
86+
7987
## Comparison functions
8088

8189
Resource Manager provides several functions for making comparisons in your templates.
8290

8391
* [coalesce](template-functions-comparison.md#coalesce)
8492
* [equals](template-functions-comparison.md#equals)
85-
* [less](template-functions-comparison.md#less)
86-
* [lessOrEquals](template-functions-comparison.md#lessorequals)
8793
* [greater](template-functions-comparison.md#greater)
8894
* [greaterOrEquals](template-functions-comparison.md#greaterorequals)
95+
* [less](template-functions-comparison.md#less)
96+
* [lessOrEquals](template-functions-comparison.md#lessorequals)
8997

9098
For Bicep files, use the [coalesce](../bicep/operators-logical.md) logical operator. For comparisons, use the [comparison](../bicep/operators-comparison.md) operators.
9199

100+
<a id="datetimeadd" aria-hidden="true"></a>
101+
<a id="datetimefromepoch" aria-hidden="true"></a>
102+
<a id="datetimetoepoch" aria-hidden="true"></a>
103+
<a id="utcnow" aria-hidden="true"></a>
104+
92105
## Date functions
93106

94107
Resource Manager provides the following functions for working with dates.
@@ -101,6 +114,7 @@ Resource Manager provides the following functions for working with dates.
101114
For Bicep files, use the [date](../bicep/bicep-functions-date.md) functions.
102115

103116
<a id="deployment" aria-hidden="true"></a>
117+
<a id="environment" aria-hidden="true"></a>
104118
<a id="parameters" aria-hidden="true"></a>
105119
<a id="variables" aria-hidden="true"></a>
106120

@@ -115,11 +129,29 @@ Resource Manager provides the following functions for getting values from sectio
115129

116130
For Bicep files, use the [deployment](../bicep/bicep-functions-deployment.md) functions.
117131

132+
<a id="filter" aria-hidden="true"></a>
133+
<a id="map" aria-hidden="true"></a>
134+
<a id="reduce" aria-hidden="true"></a>
135+
<a id="sort" aria-hidden="true"></a>
136+
<a id="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+
118148
<a id="and" aria-hidden="true"></a>
119149
<a id="bool" aria-hidden="true"></a>
150+
<a id="false" aria-hidden="true"></a>
120151
<a id="if" aria-hidden="true"></a>
121152
<a id="not" aria-hidden="true"></a>
122153
<a id="or" aria-hidden="true"></a>
154+
<a id="true" aria-hidden="true"></a>
123155

124156
## Logical functions
125157

@@ -163,7 +195,15 @@ Resource Manager provides the following functions for working with integers:
163195

164196
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.
165197

198+
<a id="contains" aria-hidden="true"></a>
199+
<a id="createobject" aria-hidden="true"></a>
200+
<a id="empty" aria-hidden="true"></a>
201+
<a id="intersection" aria-hidden="true"></a>
202+
<a id="length" aria-hidden="true"></a>
166203
<a id="json" aria-hidden="true"></a>
204+
<a id="length" aria-hidden="true"></a>
205+
<a id="null" aria-hidden="true"></a>
206+
<a id="union" aria-hidden="true"></a>
167207

168208
## Object functions
169209

@@ -181,11 +221,15 @@ Resource Manager provides several functions for working with objects.
181221

182222
For Bicep files, use the [object](../bicep/bicep-functions-object.md) functions.
183223

184-
<a id="extensionResourceId" aria-hidden="true"></a>
224+
<a id="extensionresourceid" aria-hidden="true"></a>
225+
<a id="listaccountsas" aria-hidden="true"></a>
185226
<a id="listkeys" aria-hidden="true"></a>
227+
<a id="listsecrets" aria-hidden="true"></a>
186228
<a id="list" aria-hidden="true"></a>
229+
<a id="piczones" aria-hidden="true"></a>
187230
<a id="providers" aria-hidden="true"></a>
188231
<a id="reference" aria-hidden="true"></a>
232+
<a id="references" aria-hidden="true"></a>
189233
<a id="resourceid" aria-hidden="true"></a>
190234
<a id="subscriptionResourceId" aria-hidden="true"></a>
191235
<a id="tenantResourceId" aria-hidden="true"></a>
@@ -235,11 +279,15 @@ For Bicep files, use the [scope](../bicep/bicep-functions-scope.md) functions.
235279
<a id="emptystring" aria-hidden="true"></a>
236280
<a id="endswith" aria-hidden="true"></a>
237281
<a id="firststring" aria-hidden="true"></a>
282+
<a id="format" aria-hidden="true"></a>
238283
<a id="guid" aria-hidden="true"></a>
239284
<a id="indexof" aria-hidden="true"></a>
285+
<a id="join" aria-hidden="true"></a>
286+
<a id="json" aria-hidden="true"></a>
240287
<a id="laststring" aria-hidden="true"></a>
241288
<a id="lastindexof" aria-hidden="true"></a>
242289
<a id="lengthstring" aria-hidden="true"></a>
290+
<a id="newguid" aria-hidden="true"></a>
243291
<a id="padleft" aria-hidden="true"></a>
244292
<a id="replace" aria-hidden="true"></a>
245293
<a id="skipstring" aria-hidden="true"></a>
@@ -274,6 +322,7 @@ Resource Manager provides the following functions for working with strings:
274322
* [guid](template-functions-string.md#guid)
275323
* [indexOf](template-functions-string.md#indexof)
276324
* [join](template-functions-string.md#join)
325+
* [json](template-functions-string.md#json)
277326
* [last](template-functions-string.md#last)
278327
* [lastIndexOf](template-functions-string.md#lastindexof)
279328
* [length](template-functions-string.md#length)

0 commit comments

Comments
 (0)