संपादित करें

इसके माध्यम से साझा किया गया


Bicep functions

This article describes all the functions you can use in a Bicep file. To define custom functions, see User-defined functions. For a description of the sections in a Bicep file, see Understand the structure and syntax of Bicep files.

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.

Namespaces for functions

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.

// Parameter contains the same name as a function
param range int

// Must use sys namespace to call the function.
// The second use of range refers to the parameter.
output result array = sys.range(1, range)

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.

Any function

The any function is available in Bicep to help resolve issues around data type warnings. This function is in the sys namespace.

Array functions

The following functions are available for working with arrays. All of these functions are in the sys namespace.

CIDR functions

The following functions are available for working with CIDR. All of these functions are in the sys namespace.

Date functions

The following functions are available for working with dates. All of these functions are in the sys namespace.

Deployment value functions

The following functions are available for getting values related to the deployment. All of these functions are in the az namespace.

File functions

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.

Lambda functions

The following functions are available for working with lambda expressions. All of these functions are in the sys namespace.

Logical functions

The following function is available for working with logical conditions. This function is in the sys namespace.

Numeric functions

The following functions are available for working with integers. All of these functions are in the sys namespace.

Object functions

The following functions are available for working with objects. All of these functions are in the sys namespace.

Parameters file functions

The following functions are available to be used in Bicep parameter files. All of these functions are in the sys namespace.

Resource functions

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.

Scope functions

The following functions are available for getting scope values. All of these functions are in the az namespace.

String functions

Bicep provides the following functions for working with strings. All of these functions are in the sys namespace.

Next steps