Skip to main content

tags

Creates, updates, deletes, gets or lists a tags resource.

Overview

Nametags
TypeResource
Idazure.resources.tags

Fields

The following fields are returned by SELECT queries:

OK - Returns an array of tag names and values.

NameDatatypeDescription
idstringThe tag name ID.
countobjectThe total number of resources that use the resource tag. When a tag is initially created and has no associated resources, the value is 0.
tagNamestringThe tag name.
valuesarrayThe list of tag values.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectsubscriptionIdThis 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.
create_or_updateinserttagName, subscriptionIdThis 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'.
deletedeletetagName, subscriptionIdThis 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.

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.

NameDatatypeDescription
subscriptionIdstring (uuid)The ID of the target subscription. The value must be an UUID.
tagNamestringThe name of the tag.

SELECT examples

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.resources.tags
WHERE subscriptionId = '{{ subscriptionId }}' -- required
;

INSERT examples

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.resources.tags (
tagName,
subscriptionId
)
SELECT
'{{ tagName }}',
'{{ subscriptionId }}'
RETURNING
id,
count,
tagName,
values
;

DELETE examples

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.resources.tags
WHERE tagName = '{{ tagName }}' --required
AND subscriptionId = '{{ subscriptionId }}' --required
;