Skip to content

Commit 13603b4

Browse files
authored
Merge pull request #113025 from tfitzmac/0428functions1
change code format
2 parents 95326c4 + 8a70393 commit 13603b4

File tree

3 files changed

+30
-39
lines changed

3 files changed

+30
-39
lines changed

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

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Determines if an array, object, or string is empty.
106106

107107
| Parameter | Required | Type | Description |
108108
|:--- |:--- |:--- |:--- |
109-
| itemToTest |Yes |array, object, or string |The value to check if it is empty. |
109+
| itemToTest |Yes |array, object, or string |The value to check if it's empty. |
110110

111111
### Return value
112112

@@ -249,13 +249,21 @@ If you need to include a parameter value or variable in the JSON object, use the
249249

250250
### Example
251251

252-
The following [example template](https://github.com/Azure/azure-docs-json-samples/blob/master/azure-resource-manager/functions/json.json) shows how to use the json function with arrays and objects:
252+
The following [example template](https://github.com/Azure/azure-docs-json-samples/blob/master/azure-resource-manager/functions/json.json) shows how to use the json function. Notice that you can either pass in a string that represents the object or use **null** when no value is needed.
253253

254254
```json
255255
{
256256
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
257257
"contentVersion": "1.0.0.0",
258258
"parameters": {
259+
"jsonObject1": {
260+
"type": "string",
261+
"defaultValue": "null"
262+
},
263+
"jsonObject2": {
264+
"type": "string",
265+
"defaultValue": "{\"a\": \"b\"}"
266+
},
259267
"testValue": {
260268
"type": "string",
261269
"defaultValue": "demo value"
@@ -264,13 +272,13 @@ The following [example template](https://github.com/Azure/azure-docs-json-sample
264272
"resources": [
265273
],
266274
"outputs": {
267-
"jsonOutput": {
268-
"type": "object",
269-
"value": "[json('{\"a\": \"b\"}')]"
270-
},
271-
"nullOutput": {
275+
"jsonOutput1": {
272276
"type": "bool",
273-
"value": "[empty(json('null'))]"
277+
"value": "[empty(json(parameters('jsonObject1')))]"
278+
},
279+
"jsonOutput2": {
280+
"type": "object",
281+
"value": "[json(parameters('jsonObject2'))]"
274282
},
275283
"paramOutput": {
276284
"type": "object",
@@ -284,8 +292,8 @@ The output from the preceding example with the default values is:
284292

285293
| Name | Type | Value |
286294
| ---- | ---- | ----- |
287-
| jsonOutput | Object | {"a": "b"} |
288-
| nullOutput | Boolean | True |
295+
| jsonOutput1 | Boolean | True |
296+
| jsonOutput2 | Object | {"a": "b"} |
289297
| paramOutput | Object | {"a": "demo value"}
290298

291299
## length

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

Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Template functions - resources
33
description: Describes the functions to use in an Azure Resource Manager template to retrieve values about resources.
44
ms.topic: conceptual
5-
ms.date: 04/06/2020
5+
ms.date: 04/28/2020
66
---
77
# Resource functions for ARM templates
88

@@ -22,9 +22,7 @@ To get values from parameters, variables, or the current deployment, see [Deploy
2222

2323
## extensionResourceId
2424

25-
```json
26-
extensionResourceId(resourceId, resourceType, resourceName1, [resourceName2], ...)
27-
```
25+
`extensionResourceId(resourceId, resourceType, resourceName1, [resourceName2], ...)`
2826

2927
Returns the resource ID for an [extension resource](../management/extension-resource-types.md), which is a resource type that is applied to another resource to add to its capabilities.
3028

@@ -102,9 +100,7 @@ The following example returns the resource ID for a resource group lock.
102100

103101
## list*
104102

105-
```json
106-
list{Value}(resourceName or resourceIdentifier, apiVersion, functionValues)
107-
```
103+
`list{Value}(resourceName or resourceIdentifier, apiVersion, functionValues)`
108104

109105
The syntax for this function varies by name of the list operations. Each implementation returns values for the resource type that supports a list operation. The operation name must start with `list`. Some common usages are `listKeys` and `listSecrets`.
110106

@@ -350,9 +346,7 @@ To get the SAS token, pass an object for the expiry time. The expiry time must b
350346

351347
## providers
352348

353-
```json
354-
providers(providerNamespace, [resourceType])
355-
```
349+
`providers(providerNamespace, [resourceType])`
356350

357351
Returns information about a resource provider and its supported resource types. If you don't provide a resource type, the function returns all the supported types for the resource provider.
358352

@@ -427,9 +421,7 @@ For the **Microsoft.Web** resource provider and **sites** resource type, the pre
427421

428422
## reference
429423

430-
```json
431-
reference(resourceName or resourceIdentifier, [apiVersion], ['Full'])
432-
```
424+
`reference(resourceName or resourceIdentifier, [apiVersion], ['Full'])`
433425

434426
Returns an object representing a resource's runtime state.
435427

@@ -665,9 +657,7 @@ The following [example template](https://github.com/Azure/azure-docs-json-sample
665657

666658
## resourceGroup
667659

668-
```json
669-
resourceGroup()
670-
```
660+
`resourceGroup()`
671661

672662
Returns an object that represents the current resource group.
673663

@@ -745,9 +735,7 @@ The preceding example returns an object in the following format:
745735

746736
## resourceId
747737

748-
```json
749-
resourceId([subscriptionId], [resourceGroupName], resourceType, resourceName1, [resourceName2], ...)
750-
```
738+
`resourceId([subscriptionId], [resourceGroupName], resourceType, resourceName1, [resourceName2], ...)`
751739

752740
Returns the unique identifier of a resource. You use this function when the resource name is ambiguous or not provisioned within the same template. The format of the returned identifier varies based on whether the deployment happens at the scope of a resource group, subscription, management group, or tenant.
753741

@@ -902,9 +890,7 @@ The output from the preceding example with the default values is:
902890

903891
## subscription
904892

905-
```json
906-
subscription()
907-
```
893+
`subscription()`
908894

909895
Returns details about the subscription for the current deployment.
910896

@@ -945,9 +931,7 @@ The following [example template](https://github.com/Azure/azure-docs-json-sample
945931

946932
## subscriptionResourceId
947933

948-
```json
949-
subscriptionResourceId([subscriptionId], resourceType, resourceName1, [resourceName2], ...)
950-
```
934+
`subscriptionResourceId([subscriptionId], resourceType, resourceName1, [resourceName2], ...)`
951935

952936
Returns the unique identifier for a resource deployed at the subscription level.
953937

@@ -1029,9 +1013,7 @@ The following template assigns a built-in role. You can deploy it to either a re
10291013

10301014
## tenantResourceId
10311015

1032-
```json
1033-
tenantResourceId(resourceType, resourceName1, [resourceName2], ...)
1034-
```
1016+
`tenantResourceId(resourceType, resourceName1, [resourceName2], ...)`
10351017

10361018
Returns the unique identifier for a resource deployed at the tenant level.
10371019

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ To create your own functions, see [User-defined functions](template-syntax.md#fu
1313
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.
1414

1515
<a id="array" aria-hidden="true" />
16-
<a id="coalesce" aria-hidden="true" />
1716
<a id="concatarray" aria-hidden="true" />
1817
<a id="contains" aria-hidden="true" />
1918
<a id="createarray" aria-hidden="true" />
@@ -49,6 +48,7 @@ Resource Manager provides several functions for working with arrays.
4948
* [take](template-functions-array.md#take)
5049
* [union](template-functions-array.md#union)
5150

51+
<a id="coalesce" aria-hidden="true" />
5252
<a id="equals" aria-hidden="true" />
5353
<a id="less" aria-hidden="true" />
5454
<a id="lessorequals" aria-hidden="true" />
@@ -59,6 +59,7 @@ Resource Manager provides several functions for working with arrays.
5959

6060
Resource Manager provides several functions for making comparisons in your templates.
6161

62+
* [coalesce](template-functions-comparison.md#coalesce)
6263
* [equals](template-functions-comparison.md#equals)
6364
* [less](template-functions-comparison.md#less)
6465
* [lessOrEquals](template-functions-comparison.md#lessorequals)

0 commit comments

Comments
 (0)