Skip to content

Commit f7b6dfc

Browse files
committed
add function namespaces
1 parent d8298a2 commit f7b6dfc

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

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

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
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
5-
ms.date: 09/09/2021
5+
ms.date: 09/30/2021
66
---
77

88
# Bicep functions
@@ -11,13 +11,28 @@ This article describes all the functions you can use in a Bicep file. For a desc
1111

1212
Most functions work the same when deployed to a resource group, subscription, management group, or tenant. A few functions can't be used in all scopes. They're noted in the lists below.
1313

14+
## Namespaces for functions
15+
16+
All Bicep functions are contained within two namespaces - `az` and `sys`. Typically, you don't need to specify the namespace when you use the function. You specify the namespace only when the function name is the same as another item you've defined in the Bicep file. For example, if you create a parameter named `range`, you need to differentiate the `range` function by adding the `sys` namespace.
17+
18+
```bicep
19+
// Parameter contains the same name as a function
20+
param range int
21+
22+
// Must use sys namespace to call the function.
23+
// The second use of range refers to the parameter.
24+
output result array = sys.range(1, range)
25+
```
26+
27+
The `az` namespace contains functions that are specific to an Azure deployment. The `sys` namespace contains functions that are used to construct values. The `sys` namespace also includes decorators for parameters and resource loops. The namespaces are noted in this article.
28+
1429
## Any function
1530

16-
The [any function](./bicep-functions-any.md) is available in Bicep to help resolve issues around data type warnings.
31+
The [any function](./bicep-functions-any.md) is available in Bicep to help resolve issues around data type warnings. This function is in the `sys` namespace.
1732

1833
## Array functions
1934

20-
The following functions are available for working with arrays.
35+
The following functions are available for working with arrays. All of these functions are in the `sys` namespace.
2136

2237
* [array](./bicep-functions-array.md#array)
2338
* [concat](./bicep-functions-array.md#concat)
@@ -36,42 +51,42 @@ The following functions are available for working with arrays.
3651

3752
## Date functions
3853

39-
The following functions are available for working with dates.
54+
The following functions are available for working with dates. All of these functions are in the `sys` namespace.
4055

4156
* [dateTimeAdd](./bicep-functions-date.md#datetimeadd)
4257
* [utcNow](./bicep-functions-date.md#utcnow)
4358

4459
## Deployment value functions
4560

46-
The following functions are available for getting values related to the deployment:
61+
The following functions are available for getting values related to the deployment. All of these functions are in the `az` namespace.
4762

4863
* [deployment](./bicep-functions-deployment.md#deployment)
4964
* [environment](./bicep-functions-deployment.md#environment)
5065

5166
## File functions
5267

53-
The following functions are available for loading the content from external files into your Bicep file.
68+
The following functions are available for loading the content from external files into your Bicep file. All of these functions are in the `sys` namespace.
5469

5570
* [loadFileAsBase64](bicep-functions-files.md#loadfileasbase64)
5671
* [loadTextContent](bicep-functions-files.md#loadtextcontent)
5772

5873
## Logical functions
5974

60-
The following function is available for working with logical conditions:
75+
The following function is available for working with logical conditions. This function is in the `sys` namespace.
6176

6277
* [bool](./bicep-functions-logical.md#bool)
6378

6479
## Numeric functions
6580

66-
The following functions are available for working with integers:
81+
The following functions are available for working with integers. All of these functions are in the `sys` namespace.
6782

6883
* [int](./bicep-functions-numeric.md#int)
6984
* [min](./bicep-functions-numeric.md#min)
7085
* [max](./bicep-functions-numeric.md#max)
7186

7287
## Object functions
7388

74-
The following functions are available for working with objects.
89+
The following functions are available for working with objects. All of these functions are in the `sys` namespace.
7590

7691
* [contains](./bicep-functions-object.md#contains)
7792
* [empty](./bicep-functions-object.md#empty)
@@ -82,7 +97,7 @@ The following functions are available for working with objects.
8297

8398
## Resource functions
8499

85-
The following functions are available for getting resource values:
100+
The following functions are available for getting resource values. Most of these functions are in the `az` namespace. The list functions and the getSecret function are called directly on the resource type, so they don't have a namespace qualifier.
86101

87102
* [extensionResourceId](./bicep-functions-resource.md#extensionresourceid)
88103
* [getSecret](./bicep-functions-resource.md#getsecret)
@@ -99,7 +114,7 @@ The following functions are available for getting resource values:
99114

100115
## Scope functions
101116

102-
The following functions are available for getting scope values.
117+
The following functions are available for getting scope values. All of these functions are in the `az` namespace.
103118

104119
* [managementGroup](./bicep-functions-scope.md#managementgroup)
105120
* [resourceGroup](./bicep-functions-scope.md#resourcegroup) - can only be used in deployments to a resource group.
@@ -108,7 +123,7 @@ The following functions are available for getting scope values.
108123

109124
## String functions
110125

111-
Bicep provides the following functions for working with strings:
126+
Bicep provides the following functions for working with strings. All of these functions are in the `sys` namespace.
112127

113128
* [base64](./bicep-functions-string.md#base64)
114129
* [base64ToJson](./bicep-functions-string.md#base64tojson)

0 commit comments

Comments
 (0)