Skip to content

Commit 9e5fe05

Browse files
authored
Merge pull request #95511 from tfitzmac/1111tagsui
add tagsbyresource ui element
2 parents 76acc86 + acde580 commit 9e5fe05

File tree

4 files changed

+81
-6
lines changed

4 files changed

+81
-6
lines changed

articles/managed-applications/create-uidefinition-elements.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
---
22
title: Azure create UI definition element | Microsoft Docs
33
description: Describes the elements to use when constructing UI definitions for Azure portal.
4-
services: managed-applications
5-
documentationcenter: na
64
author: tfitzmac
75

86
ms.service: managed-applications
9-
ms.devlang: na
107
ms.topic: reference
11-
ms.tgt_pltfrm: na
12-
ms.workload: na
13-
ms.date: 09/19/2018
8+
ms.date: 11/11/2019
149
ms.author: tomfitz
1510

1611
---
1712
# CreateUiDefinition elements
13+
1814
This article describes the schema and properties for all supported elements of a CreateUiDefinition.
1915

2016
## Schema
@@ -55,6 +51,7 @@ The documentation for each element contains a UI sample, schema, remarks on the
5551
- [Microsoft.Common.OptionsGroup](microsoft-common-optionsgroup.md)
5652
- [Microsoft.Common.PasswordBox](microsoft-common-passwordbox.md)
5753
- [Microsoft.Common.Section](microsoft-common-section.md)
54+
- [Microsoft.Common.TagsByResource](microsoft-common-tagsbyresource.md)
5855
- [Microsoft.Common.TextBlock](microsoft-common-textblock.md)
5956
- [Microsoft.Common.TextBox](microsoft-common-textbox.md)
6057
- [Microsoft.Compute.CredentialsCombo](microsoft-compute-credentialscombo.md)
@@ -66,4 +63,5 @@ The documentation for each element contains a UI sample, schema, remarks on the
6663
- [Microsoft.Storage.StorageAccountSelector](microsoft-storage-storageaccountselector.md)
6764

6865
## Next steps
66+
6967
For an introduction to creating UI definitions, see [Getting started with CreateUiDefinition](create-uidefinition-overview.md).
34 KB
Loading
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
title: Azure TagsByResource UI element
3+
description: Describes the Microsoft.Common.TagsByResource UI element for Azure portal. Use to apply tags to a resource during deployment.
4+
author: tfitzmac
5+
6+
ms.service: managed-applications
7+
ms.topic: reference
8+
ms.date: 11/11/2019
9+
ms.author: tomfitz
10+
11+
---
12+
13+
# Microsoft.Common.TagsByResource UI element
14+
15+
A control for associating [tags](../azure-resource-manager/resource-group-using-tags.md) with the resources in a deployment.
16+
17+
## UI sample
18+
19+
![Microsoft.Common.DropDown](./media/managed-application-elements/microsoft.common.tagsbyresource.png)
20+
21+
## Schema
22+
23+
```json
24+
{
25+
"name": "element1",
26+
"type": "Microsoft.Common.TagsByResource",
27+
"resources": [
28+
"Microsoft.Storage/storageAccounts",
29+
"Microsoft.Compute/virtualMachines"
30+
]
31+
}
32+
```
33+
34+
## Sample output
35+
36+
```json
37+
{
38+
"Microsoft.Storage/storageAccounts": {
39+
"Dept": "Finance",
40+
"Environment": "Production"
41+
},
42+
"Microsoft.Compute/virtualMachines": {
43+
"Dept": "Finance"
44+
}
45+
}
46+
```
47+
48+
## Remarks
49+
50+
- At least one item in the `resources` array must be specified.
51+
- Each element in `resources` must be a fully qualified resource type. These elements appear in the **Resource** dropdown, and are taggable by the user.
52+
- The output of the control is formatted for easy assignment of tag values in an Azure Resource Manager template. To receive the control's output in a template, include a parameter in your template as shown in the following example:
53+
54+
```json
55+
"parameters": {
56+
"tagsByResource": { "type": "object", "defaultValue": {} }
57+
}
58+
```
59+
60+
For each resource that can be tagged, assign the tags property to the parameter value for that resource type:
61+
62+
```json
63+
{
64+
"name": "saName1",
65+
"type": "Microsoft.Storage/storageAccounts",
66+
"tags": "[ if(contains(parameters('tagsByResource'), 'Microsoft.Storage/storageAccounts'), parameters('tagsByResource')['Microsoft.Storage/storageAccounts'], json('{}')) ]",
67+
...
68+
```
69+
70+
- Use the [if](../azure-resource-manager/resource-group-template-functions-logical.md#if) function when accessing the tagsByResource parameter. It enables you to assign an empty object when no tags are assigned to the given resource type.
71+
72+
## Next steps
73+
74+
- For an introduction to creating UI definitions, see [Getting started with CreateUiDefinition](create-uidefinition-overview.md).
75+
- For a description of common properties in UI elements, see [CreateUiDefinition elements](create-uidefinition-elements.md).

articles/managed-applications/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@
124124
href: microsoft-common-passwordbox.md
125125
- name: Section
126126
href: microsoft-common-section.md
127+
- name: TagsByResource
128+
href: microsoft-common-tagsbyresource.md
127129
- name: TextBlock
128130
href: microsoft-common-textblock.md
129131
- name: TextBox

0 commit comments

Comments
 (0)