Skip to content

Commit 3f6b4cc

Browse files
authored
Merge pull request #97677 from tfitzmac/1203concat
clarify concat with strings and arrays
2 parents c11997e + 2e15100 commit 3f6b4cc

File tree

2 files changed

+24
-38
lines changed

2 files changed

+24
-38
lines changed

articles/azure-resource-manager/resource-group-template-functions-array.md

Lines changed: 19 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@ Resource Manager provides several functions for working with arrays and objects.
2828

2929
To get an array of string values delimited by a value, see [split](resource-group-template-functions-string.md#split).
3030

31-
<a id="array" />
32-
33-
[!INCLUDE [updated-for-az](../../includes/updated-for-az.md)]
34-
3531
## array
32+
3633
`array(convertToArray)`
3734

3835
Converts the value to an array.
@@ -108,9 +105,8 @@ To deploy this example template with PowerShell, use:
108105
New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateUri https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/functions/array.json
109106
```
110107

111-
<a id="coalesce" />
112-
113108
## coalesce
109+
114110
`coalesce(arg1, arg2, arg3, ...)`
115111

116112
Returns first non-null value from the parameters. Empty strings, empty arrays, and empty objects are not null.
@@ -196,9 +192,8 @@ To deploy this example template with PowerShell, use:
196192
New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateUri https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/functions/coalesce.json
197193
```
198194

199-
<a id="concat" />
200-
201195
## concat
196+
202197
`concat(arg1, arg2, arg3, ...)`
203198

204199
Combines multiple arrays and returns the concatenated array, or combines multiple string values and returns the concatenated string.
@@ -210,9 +205,10 @@ Combines multiple arrays and returns the concatenated array, or combines multipl
210205
| arg1 |Yes |array or string |The first array or string for concatenation. |
211206
| additional arguments |No |array or string |Additional arrays or strings in sequential order for concatenation. |
212207

213-
This function can take any number of arguments, and can accept either strings or arrays for the parameters.
208+
This function can take any number of arguments, and can accept either strings or arrays for the parameters. However, you can't provide both arrays and strings for parameters. Arrays are only concatenated with other arrays.
214209

215210
### Return value
211+
216212
A string or array of concatenated values.
217213

218214
### Example
@@ -310,9 +306,8 @@ To deploy this example template with PowerShell, use:
310306
New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateUri https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/functions/concat-string.json
311307
```
312308

313-
<a id="contains" />
314-
315309
## contains
310+
316311
`contains(container, itemToFind)`
317312

318313
Checks whether an array contains a value, an object contains a key, or a string contains a substring. The string comparison is case-sensitive. However, when testing if an object contains a key, the comparison is case-insensitive.
@@ -404,9 +399,8 @@ To deploy this example template with PowerShell, use:
404399
New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateUri https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/functions/contains.json
405400
```
406401

407-
<a id="createarray" />
408-
409402
## createarray
403+
410404
`createArray (arg1, arg2, arg3, ...)`
411405

412406
Creates an array from the parameters.
@@ -484,8 +478,6 @@ To deploy this example template with PowerShell, use:
484478
New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateUri https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/functions/createarray.json
485479
```
486480

487-
<a id="empty" />
488-
489481
## empty
490482

491483
`empty(itemToTest)`
@@ -563,9 +555,8 @@ To deploy this example template with PowerShell, use:
563555
New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateUri https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/functions/empty.json
564556
```
565557

566-
<a id="first" />
567-
568558
## first
559+
569560
`first(arg1)`
570561

571562
Returns the first element of the array, or first character of the string.
@@ -628,9 +619,8 @@ To deploy this example template with PowerShell, use:
628619
New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateUri https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/functions/first.json
629620
```
630621

631-
<a id="intersection" />
632-
633622
## intersection
623+
634624
`intersection(arg1, arg2, arg3, ...)`
635625

636626
Returns a single array or object with the common elements from the parameters.
@@ -708,6 +698,7 @@ New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateU
708698
```
709699

710700
## json
701+
711702
`json(arg1)`
712703

713704
Returns a JSON object.
@@ -718,7 +709,6 @@ Returns a JSON object.
718709
|:--- |:--- |:--- |:--- |
719710
| arg1 |Yes |string |The value to convert to JSON. |
720711

721-
722712
### Return value
723713

724714
The JSON object from the specified string, or an empty object when **null** is specified.
@@ -780,9 +770,8 @@ To deploy this example template with PowerShell, use:
780770
New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateUri https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/functions/json.json
781771
```
782772

783-
<a id="last" />
784-
785773
## last
774+
786775
`last (arg1)`
787776

788777
Returns the last element of the array, or last character of the string.
@@ -845,9 +834,8 @@ To deploy this example template with PowerShell, use:
845834
New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateUri https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/functions/last.json
846835
```
847836

848-
<a id="length" />
849-
850837
## length
838+
851839
`length(arg1)`
852840

853841
Returns the number of elements in an array, characters in a string, or root-level properties in an object.
@@ -945,9 +933,8 @@ You can use this function with an array to specify the number of iterations when
945933

946934
For more information about using this function with an array, see [Create multiple instances of resources in Azure Resource Manager](resource-group-create-multiple.md).
947935

948-
<a id="max" />
949-
950936
## max
937+
951938
`max(arg1)`
952939

953940
Returns the maximum value from an array of integers or a comma-separated list of integers.
@@ -1009,9 +996,8 @@ To deploy this example template with PowerShell, use:
1009996
New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateUri https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/functions/max.json
1010997
```
1011998

1012-
<a id="min" />
1013-
1014999
## min
1000+
10151001
`min(arg1)`
10161002

10171003
Returns the minimum value from an array of integers or a comma-separated list of integers.
@@ -1073,9 +1059,8 @@ To deploy this example template with PowerShell, use:
10731059
New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateUri https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/functions/min.json
10741060
```
10751061

1076-
<a id="range" />
1077-
10781062
## range
1063+
10791064
`range(startingInteger, numberOfElements)`
10801065

10811066
Creates an array of integers from a starting integer and containing a number of items.
@@ -1137,9 +1122,8 @@ To deploy this example template with PowerShell, use:
11371122
New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateUri https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/functions/range.json
11381123
```
11391124

1140-
<a id="skip" />
1141-
11421125
## skip
1126+
11431127
`skip(originalValue, numberToSkip)`
11441128

11451129
Returns an array with all the elements after the specified number in the array, or returns a string with all the characters after the specified number in the string.
@@ -1218,9 +1202,8 @@ To deploy this example template with PowerShell, use:
12181202
New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateUri https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/functions/skip.json
12191203
```
12201204

1221-
<a id="take" />
1222-
12231205
## take
1206+
12241207
`take(originalValue, numberToTake)`
12251208

12261209
Returns an array with the specified number of elements from the start of the array, or a string with the specified number of characters from the start of the string.
@@ -1299,9 +1282,8 @@ To deploy this example template with PowerShell, use:
12991282
New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateUri https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/functions/take.json
13001283
```
13011284

1302-
<a id="union" />
1303-
13041285
## union
1286+
13051287
`union(arg1, arg2, arg3, ...)`
13061288

13071289
Returns a single array or object with all elements from the parameters. Duplicate values or keys are only included once.
@@ -1379,6 +1361,7 @@ New-AzResourceGroupDeployment -ResourceGroupName functionexamplegroup -TemplateU
13791361
```
13801362

13811363
## Next steps
1364+
13821365
* For a description of the sections in an Azure Resource Manager template, see [Authoring Azure Resource Manager templates](resource-group-authoring-templates.md).
13831366
* To merge multiple templates, see [Using linked templates with Azure Resource Manager](resource-group-linked-templates.md).
13841367
* To iterate a specified number of times when creating a type of resource, see [Create multiple instances of resources in Azure Resource Manager](resource-group-create-multiple.md).

articles/azure-resource-manager/resource-group-template-functions-string.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,13 @@ Combines multiple string values and returns the concatenated string, or combines
247247

248248
| Parameter | Required | Type | Description |
249249
|:--- |:--- |:--- |:--- |
250-
| arg1 |Yes |string or array |The first value for concatenation. |
251-
| additional arguments |No |string |Additional values in sequential order for concatenation. |
250+
| arg1 |Yes |string or array |The first string or array for concatenation. |
251+
| additional arguments |No |string or array |Additional strings or arrays in sequential order for concatenation. |
252+
253+
This function can take any number of arguments, and can accept either strings or arrays for the parameters. However, you can't provide both arrays and strings for parameters. Strings are only concatenated with other strings.
252254

253255
### Return value
256+
254257
A string or array of concatenated values.
255258

256259
### Examples

0 commit comments

Comments
 (0)