Skip to content

Commit 92d3d72

Browse files
authored
Merge pull request #171980 from davidsmatlak/ds-update-function-docs
Updates template function docs
2 parents 69a41af + fdccf3c commit 92d3d72

File tree

6 files changed

+136
-1638
lines changed

6 files changed

+136
-1638
lines changed

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

Lines changed: 11 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Template functions - deployment
33
description: Describes the functions to use in an Azure Resource Manager template (ARM template) to retrieve deployment information.
44
ms.topic: conceptual
5-
ms.date: 05/13/2021
5+
ms.date: 09/09/2021
66
---
77

88
# Deployment functions for ARM templates
@@ -137,21 +137,9 @@ If you redeploy a template from the deployment history in the portal, the templa
137137

138138
### Example
139139

140-
The following [example template](https://github.com/Azure/azure-docs-json-samples/blob/master/azure-resource-manager/functions/deployment.json) returns the deployment object:
140+
The following example returns a deployment object.
141141

142-
```json
143-
{
144-
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
145-
"contentVersion": "1.0.0.0",
146-
"resources": [],
147-
"outputs": {
148-
"deploymentOutput": {
149-
"type": "object",
150-
"value": "[deployment()]"
151-
}
152-
}
153-
}
154-
```
142+
:::code language="json" source="~/resourcemanager-templates/azure-resource-manager/functions/deployment/deployment.json":::
155143

156144
The preceding example returns the following object:
157145

@@ -178,7 +166,9 @@ The preceding example returns the following object:
178166
}
179167
```
180168

181-
For a subscription deployment, this [example template](https://github.com/Azure/azure-docs-json-samples/blob/master/azure-resource-manager/functions/deploymentsubscription.json) returns the deployment object.
169+
For a subscription deployment, the following example returns a deployment object.
170+
171+
:::code language="json" source="~/resourcemanager-templates/azure-resource-manager/functions/deployment/deploymentsubscription.json":::
182172

183173
## environment
184174

@@ -228,19 +218,7 @@ This function returns properties for the current Azure environment. The followin
228218

229219
The following example template returns the environment object.
230220

231-
```json
232-
{
233-
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
234-
"contentVersion": "1.0.0.0",
235-
"resources": [],
236-
"outputs": {
237-
"environmentOutput": {
238-
"type": "object",
239-
"value": "[environment()]"
240-
}
241-
}
242-
}
243-
```
221+
:::code language="json" source="~/resourcemanager-templates/azure-resource-manager/functions/deployment/environment.json":::
244222

245223
The preceding example returns the following object when deployed to global Azure:
246224

@@ -317,63 +295,9 @@ Typically, you use parameters to set resource values. The following example sets
317295

318296
### Example
319297

320-
The following [example template](https://github.com/Azure/azure-docs-json-samples/blob/master/azure-resource-manager/functions/parameters.json) shows a simplified use of the parameters function.
298+
The following example shows a simplified use of the parameters function.
321299

322-
```json
323-
{
324-
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
325-
"contentVersion": "1.0.0.0",
326-
"parameters": {
327-
"stringParameter": {
328-
"type": "string",
329-
"defaultValue": "option 1"
330-
},
331-
"intParameter": {
332-
"type": "int",
333-
"defaultValue": 1
334-
},
335-
"objectParameter": {
336-
"type": "object",
337-
"defaultValue": {
338-
"one": "a",
339-
"two": "b"
340-
}
341-
},
342-
"arrayParameter": {
343-
"type": "array",
344-
"defaultValue": [ 1, 2, 3 ]
345-
},
346-
"crossParameter": {
347-
"type": "string",
348-
"defaultValue": "[parameters('stringParameter')]"
349-
}
350-
},
351-
"variables": {},
352-
"resources": [],
353-
"outputs": {
354-
"stringOutput": {
355-
"value": "[parameters('stringParameter')]",
356-
"type": "string"
357-
},
358-
"intOutput": {
359-
"value": "[parameters('intParameter')]",
360-
"type": "int"
361-
},
362-
"objectOutput": {
363-
"value": "[parameters('objectParameter')]",
364-
"type": "object"
365-
},
366-
"arrayOutput": {
367-
"value": "[parameters('arrayParameter')]",
368-
"type": "array"
369-
},
370-
"crossOutput": {
371-
"value": "[parameters('crossParameter')]",
372-
"type": "string"
373-
}
374-
}
375-
}
376-
```
300+
:::code language="json" source="~/resourcemanager-templates/azure-resource-manager/functions/deployment/parameters.json":::
377301

378302
The output from the preceding example with the default values is:
379303

@@ -432,43 +356,9 @@ Typically, you use variables to simplify your template by constructing complex v
432356

433357
### Example
434358

435-
The following [example template](https://github.com/Azure/azure-docs-json-samples/blob/master/azure-resource-manager/functions/variables.json) returns different variable values.
359+
The following example returns different variable values.
436360

437-
```json
438-
{
439-
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
440-
"contentVersion": "1.0.0.0",
441-
"parameters": {},
442-
"variables": {
443-
"var1": "myVariable",
444-
"var2": [ 1, 2, 3, 4 ],
445-
"var3": "[ variables('var1') ]",
446-
"var4": {
447-
"property1": "value1",
448-
"property2": "value2"
449-
}
450-
},
451-
"resources": [],
452-
"outputs": {
453-
"exampleOutput1": {
454-
"value": "[variables('var1')]",
455-
"type": "string"
456-
},
457-
"exampleOutput2": {
458-
"value": "[variables('var2')]",
459-
"type": "array"
460-
},
461-
"exampleOutput3": {
462-
"value": "[variables('var3')]",
463-
"type": "string"
464-
},
465-
"exampleOutput4": {
466-
"value": "[variables('var4')]",
467-
"type": "object"
468-
}
469-
}
470-
}
471-
```
361+
:::code language="json" source="~/resourcemanager-templates/azure-resource-manager/functions/deployment/variables.json":::
472362

473363
The output from the preceding example with the default values is:
474364

0 commit comments

Comments
 (0)