CreateUiDefinition 引用函数CreateUiDefinition referencing functions

从 CreateUiDefinition 文件的属性或上下文引用输出时要使用的函数。The functions to use when referencing outputs from the properties or context of a CreateUiDefinition file.

basicsbasics

返回在基本信息步骤中定义的元素的输出值。Returns the output values of an element that is defined in the Basics step. 传入元素的名称作为此函数的参数。Pass in the name of the element as a parameter to this function.

若要在其他步骤中获取元素的输出值,请使用 steps() 函数。To get the output values of elements in other steps, use the steps() function.

下面的示例返回 Basics 步骤中名为 clusterName 的元素的输出:The following example returns the output of the element named clusterName in the Basics step:

"[basics('clusterName')]"

返回的值因检索到的元素类型而异。The returned values vary based on the type of element that is retrieved.

locationlocation

返回 Basics 步骤或当前上下文中选择的位置。Returns the location selected in the Basics step or the current context.

下面的示例将返回一个值,如 "chinanorth"The following example returns a value like "chinanorth":

"[location()]"

resourceGroupresourceGroup

返回在“基本信息”步骤或当前上下文中选择的 resourceGroup 的详细信息。Returns details about the resourceGroup selected in the Basics step or the current context.

如下示例中:The following example:

"[resourceGroup()]"

返回以下属性:Returns the following properties:

{
    "mode": "New" or "Existing",
    "name": "{resourceGroupName}",
    "location": "{resourceGroupLocation}"
}

可以使用点表示法获取任何特定值。You can get any particular value with dot notation.

"[resourceGroup().name]"

stepssteps

返回指定步骤中的元素。Returns the elements on a specified step. 传入步骤的名称作为此函数的参数。Pass in the name of the step as a parameter to this function. 从返回的元素中,可以获取特定属性值。From the returned elements, you can get particular property values.

若要获取“基本信息”步骤中元素的输出值,请使用 basics() 函数。To get the output values of elements in the Basics step, use the basics() function.

下面的示例返回名为 vmParameters 的步骤。The following example returns the step named vmParameters. 在该步骤中是一个名为 adminUsername 的元素。On that step is an element named adminUsername.

"[steps('vmParameters').adminUsername]"

订阅subscription

返回在“基本信息”步骤或当前上下文中选择的订阅的属性。Returns properties for the subscription selected in the Basics step or the current context.

如下示例中:The following example:

"[subscription()]"

返回以下属性:Returns the following properties:

{
    "id": "/subscriptions/{subscription-id}",
    "subscriptionId": "{subscription-id}",
    "tenantId": "{tenant-id}",
    "displayName": "{name-of-subscription}"
}

后续步骤Next steps