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
In a module, you can specify a scope that is different than the scope for the rest of the Bicep file. For more information, see [Configure module scope](modules.md#set-module-scope)
97
99
100
+
## Functions
101
+
102
+
Within your Bicep file, you can create your own functions in addition to using the [standard Bicep functions](./bicep-functions.md) that are automatically available within your Bicep files. Create your own functions when you have complicated expressions that are used repeatedly in your Bicep files.
For more information, see [User-defined functions](./user-defined-functions.md).
111
+
98
112
## Parameters
99
113
100
114
Use parameters for values that need to vary for different deployments. You can define a default value for the parameter that is used if no value is provided during deployment.
Your functions require a namespace value to avoid naming conflicts with template functions. The following example shows a function that returns a unique name:
33
+
## Examples
34
+
35
+
The following examples show how to define and use user-defined functions:
The following example shows a template that includes a user-defined function to get a unique name for a storage account. The template has a parameter named `storageNamePrefix` that is passed as a parameter to the function.
When defining a user function, there are some restrictions:
119
78
120
79
* The function can't access variables.
121
-
* The function can only use parameters that are defined in the function. When you use the [parameters](template-functions-deployment.md#parameters) function within a user-defined function, you're restricted to the parameters for that function.
80
+
* The function can only use parameters that are defined in the function.
122
81
* The function can't call other user-defined functions.
123
-
* The function can't use the [reference](template-functions-resource.md#reference) function or any of the [list](template-functions-resource.md#list) functions.
82
+
* The function can't use the [reference](bicep-functions-resource.md#reference) function or any of the [list](bicep-functions-resource.md#list) functions.
124
83
* Parameters for the function can't have default values.
125
84
126
85
## Next steps
127
86
128
-
* To learn about the available properties for user-defined functions, see [Understand the structure and syntax of ARM templates](./syntax.md).
129
-
* For a list of the available template functions, see [ARM template functions](template-functions.md).
87
+
* To learn about the Bicep file structure and syntax, see [Understand the structure and syntax of Bicep files](./file.md).
88
+
* For a list of the available Bicep functions, see [Bicep functions](./bicep-functions.md).
0 commit comments