tags
Creates, updates, deletes, gets or lists a tags resource.
Overview
| Name | tags |
| Type | Resource |
| Id | azure.resource.tags |
Fields
The following fields are returned by SELECT queries:
- list
- get_at_scope
| Name | Datatype | Description |
|---|---|---|
id | string | The tag name ID. |
count | object | The total number of resources that use the resource tag. When a tag is initially created and has no associated resources, the value is 0. |
tagName | string | The tag name. |
values | array | The list of tag values. |
| Name | Datatype | Description |
|---|---|---|
id | string | Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. |
name | string | The name of the resource. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Dictionary of . |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | subscription_id | Gets a summary of tag usage under the subscription. This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and returns a summary of usage for each tag name and value under the given subscription. In case of a large number of tags, this operation may return a previously cached result. | |
get_at_scope | select | scope | Gets the entire set of tags on a resource or subscription. Gets the entire set of tags on a resource or subscription. | |
create_or_update | insert | tag_name, subscription_id | Creates a predefined tag name. This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which are reserved for Azure use: 'microsoft', 'azure', 'windows'. | |
create_or_update_at_scope | insert | scope, properties | Creates or updates the entire set of tags on a resource or subscription. This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags. | |
update_at_scope | update | scope | Selectively updates the set of tags on a resource or subscription. This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or name/value pairs. | |
create_or_update | replace | tag_name, subscription_id | Creates a predefined tag name. This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which are reserved for Azure use: 'microsoft', 'azure', 'windows'. | |
create_or_update_at_scope | replace | scope, properties | Creates or updates the entire set of tags on a resource or subscription. This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags. | |
delete | delete | tag_name, subscription_id | Deletes a predefined tag name. This operation allows deleting a name from the list of predefined tag names for the given subscription. The name being deleted must not be in use as a tag name for any resource. All predefined values for the given name must have already been deleted. | |
delete_at_scope | delete | scope | Deletes the entire set of tags on a resource or subscription. Deletes the entire set of tags on a resource or subscription. | |
delete_value | exec | tag_name, tag_value, subscription_id | Deletes a predefined tag value for a predefined tag name. This operation allows deleting a value from the list of predefined values for an existing predefined tag name. The value being deleted must not be in use as a tag value for the given tag name for any resource. | |
create_or_update_value | exec | tag_name, tag_value, subscription_id | Creates a predefined value for a predefined tag name. This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag value can have a maximum of 256 characters. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
scope | string | The fully qualified Azure Resource manager identifier of the resource. Required. |
subscription_id | string | |
tag_name | string | The name of the tag. Required. |
tag_value | string | The value of the tag to create. Required. |
SELECT examples
- list
- get_at_scope
Gets a summary of tag usage under the subscription. This operation performs a union of predefined tags, resource tags, resource group tags and subscription tags, and returns a summary of usage for each tag name and value under the given subscription. In case of a large number of tags, this operation may return a previously cached result.
SELECT
id,
count,
tagName,
values
FROM azure.resource.tags
WHERE subscription_id = '{{ subscription_id }}' -- required
;
Gets the entire set of tags on a resource or subscription. Gets the entire set of tags on a resource or subscription.
SELECT
id,
name,
systemData,
tags,
type
FROM azure.resource.tags
WHERE scope = '{{ scope }}' -- required
;
INSERT examples
- create_or_update
- create_or_update_at_scope
- Manifest
Creates a predefined tag name. This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which are reserved for Azure use: 'microsoft', 'azure', 'windows'.
INSERT INTO azure.resource.tags (
tag_name,
subscription_id
)
SELECT
'{{ tag_name }}',
'{{ subscription_id }}'
RETURNING
id,
count,
tagName,
values
;
Creates or updates the entire set of tags on a resource or subscription. This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags.
INSERT INTO azure.resource.tags (
properties,
scope
)
SELECT
'{{ properties }}' /* required */,
'{{ scope }}'
RETURNING
id,
name,
properties,
systemData,
type
;
# Description fields are for documentation purposes
- name: tags
props:
- name: tag_name
value: "{{ tag_name }}"
description: Required parameter for the tags resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the tags resource.
- name: scope
value: "{{ scope }}"
description: Required parameter for the tags resource.
- name: properties
description: |
The set of tags. Required.
value:
tags: "{{ tags }}"
UPDATE examples
- update_at_scope
Selectively updates the set of tags on a resource or subscription. This operation allows replacing, merging or selectively deleting tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags at the end of the operation. The 'replace' option replaces the entire set of existing tags with a new set. The 'merge' option allows adding tags with new names and updating the values of tags with existing names. The 'delete' option allows selectively deleting tags based on given names or name/value pairs.
UPDATE azure.resource.tags
SET
operation = '{{ operation }}',
properties = '{{ properties }}'
WHERE
scope = '{{ scope }}' --required
RETURNING
id,
name,
properties,
systemData,
type;
REPLACE examples
- create_or_update
- create_or_update_at_scope
Creates a predefined tag name. This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag names cannot have the following prefixes which are reserved for Azure use: 'microsoft', 'azure', 'windows'.
REPLACE azure.resource.tags
SET
-- No updatable properties
WHERE
tag_name = '{{ tag_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
count,
tagName,
values;
Creates or updates the entire set of tags on a resource or subscription. This operation allows adding or replacing the entire set of tags on the specified resource or subscription. The specified entity can have a maximum of 50 tags.
REPLACE azure.resource.tags
SET
properties = '{{ properties }}'
WHERE
scope = '{{ scope }}' --required
AND properties = '{{ properties }}' --required
RETURNING
id,
name,
properties,
systemData,
type;
DELETE examples
- delete
- delete_at_scope
Deletes a predefined tag name. This operation allows deleting a name from the list of predefined tag names for the given subscription. The name being deleted must not be in use as a tag name for any resource. All predefined values for the given name must have already been deleted.
DELETE FROM azure.resource.tags
WHERE tag_name = '{{ tag_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;
Deletes the entire set of tags on a resource or subscription. Deletes the entire set of tags on a resource or subscription.
DELETE FROM azure.resource.tags
WHERE scope = '{{ scope }}' --required
;
Lifecycle Methods
- delete_value
- create_or_update_value
Deletes a predefined tag value for a predefined tag name. This operation allows deleting a value from the list of predefined values for an existing predefined tag name. The value being deleted must not be in use as a tag value for the given tag name for any resource.
EXEC azure.resource.tags.delete_value
@tag_name='{{ tag_name }}' --required,
@tag_value='{{ tag_value }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Creates a predefined value for a predefined tag name. This operation allows adding a value to the list of predefined values for an existing predefined tag name. A tag value can have a maximum of 256 characters.
EXEC azure.resource.tags.create_or_update_value
@tag_name='{{ tag_name }}' --required,
@tag_value='{{ tag_value }}' --required,
@subscription_id='{{ subscription_id }}' --required
;