Skip to main content

resources

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

Overview

Nameresources
TypeResource
Idazure.resource.resources

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringFully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
namestringThe name of the resource.
extendedLocationobjectResource extended location.
identityobjectThe identity of the resource.
kindstringThe kind of the resource.
locationstringResource location.
managedBystringID of the resource that manages this resource.
planobjectThe plan of the resource.
propertiesobjectThe resource-specific properties for this resource.
skuobjectThe SKU of the resource.
systemDataobjectAzure Resource Manager metadata containing createdBy and modifiedBy information.
tagsobjectResource tags.
typestringThe type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts".

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectresource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, subscription_idGets a resource.
list_by_resource_groupselectresource_group_name, subscription_id$filter, $expand, $topGet all the resources for a resource group.
listselectsubscription_id$filter, $expand, $topGet all the resources in a subscription.
get_by_idselectresource_idGets a resource by ID.
create_or_updateinsertresource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, subscription_idCreates a resource.
create_or_update_by_idinsertresource_idCreate a resource by ID.
updateupdateresource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, subscription_idUpdates a resource.
update_by_idupdateresource_idUpdate a resource by ID.
create_or_updatereplaceresource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, subscription_idCreates a resource.
create_or_update_by_idreplaceresource_idCreate a resource by ID.
deletedeleteresource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, subscription_idDeletes a resource.
delete_by_iddeleteresource_idDeletes a resource by ID.
check_existenceexecresource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, subscription_idChecks whether a resource exists.
check_existence_by_idexecresource_idChecks by ID whether a resource exists. This API currently works only for a limited set of Resource providers. In the event that a Resource provider does not implement this API, ARM will respond with a 405. The alternative then is to use the GET API to check for the existence of the resource.
move_resourcesexecsource_resource_group_name, subscription_idMoves resources from one resource group to another resource group. The resources to be moved must be in the same source resource group in the source subscription being used. The target resource group may be in a different subscription. When moving resources, both the source group and the target group are locked for the duration of the operation. Write and delete operations are blocked on the groups until the move completes.
validate_move_resourcesexecsource_resource_group_name, subscription_idValidates whether resources can be moved from one resource group to another resource group. This operation checks whether the specified resources can be moved to the target. The resources to be moved must be in the same source resource group in the source subscription being used. The target resource group may be in a different subscription. If validation succeeds, it returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check the result of the long-running operation.

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
parent_resource_pathstringThe parent resource identity. Required.
resource_group_namestringThe name of the resource group containing the resource to get. The name is case insensitive. Required.
resource_idstringRequired.
resource_namestringThe name of the resource to check whether it exists. Required.
resource_provider_namespacestringThe resource provider of the resource to check. Required.
resource_typestringThe resource type. Required.
source_resource_group_namestringThe name of the resource group to get. The name is case insensitive. Required.
subscription_idstring
$expandstringComma-separated list of additional properties to be included in the response. Valid values include createdTime, changedTime and provisioningState. For example, $expand=createdTime,changedTime. Default value is None.
$filterstringThe filter to apply on the operation.Filter comparison operators include eq (equals) and ne (not equals) and may be used with the following properties: location, resourceType, name, resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, plan/version, and plan/promotionCode.For example, to filter by a resource type, use $filter=resourceType eq 'Microsoft.Network/virtualNetworks'``substringof(value, property) can be used to filter for substrings of the following currently-supported properties: name and resourceGroupFor example, to get all resources with 'demo' anywhere in the resource name, use $filter=substringof('demo', name)Multiple substring operations can also be combined using and/or operators.Note that any truncated number of results queried via $top may also not be compatible when using a filter.Resources can be filtered by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'. Note that when resources are filtered by tag name and value, the original tags for each resource will not be returned in the results. Any list of additional properties queried via $expand may also not be compatible when filtering by tag names/values. For tag names only, resources can be filtered by prefix using the following syntax: $filter=startswith(tagName, 'depart'). This query will return all resources with a tag name prefixed by the phrase depart (i.e.department, departureDate, departureTime, etc.)Note that some properties can be combined when filtering resources, which include the following: substringof() and/or resourceType, plan and plan/publisher and plan/name, and identity and identity/principalId. Default value is None.
$topintegerThe number of recommendations per page if a paged version of this API is being used. Default value is None.

SELECT examples

Gets a resource.

SELECT
id,
name,
extendedLocation,
identity,
kind,
location,
managedBy,
plan,
properties,
sku,
systemData,
tags,
type
FROM azure.resource.resources
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND resource_provider_namespace = '{{ resource_provider_namespace }}' -- required
AND parent_resource_path = '{{ parent_resource_path }}' -- required
AND resource_type = '{{ resource_type }}' -- required
AND resource_name = '{{ resource_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;

INSERT examples

Creates a resource.

INSERT INTO azure.resource.resources (
properties,
plan,
kind,
managedBy,
sku,
identity,
location,
extendedLocation,
tags,
resource_group_name,
resource_provider_namespace,
parent_resource_path,
resource_type,
resource_name,
subscription_id
)
SELECT
'{{ properties }}',
'{{ plan }}',
'{{ kind }}',
'{{ managedBy }}',
'{{ sku }}',
'{{ identity }}',
'{{ location }}',
'{{ extendedLocation }}',
'{{ tags }}',
'{{ resource_group_name }}',
'{{ resource_provider_namespace }}',
'{{ parent_resource_path }}',
'{{ resource_type }}',
'{{ resource_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
extendedLocation,
identity,
kind,
location,
managedBy,
plan,
properties,
sku,
systemData,
tags,
type
;

UPDATE examples

Updates a resource.

UPDATE azure.resource.resources
SET
properties = '{{ properties }}',
plan = '{{ plan }}',
kind = '{{ kind }}',
managedBy = '{{ managedBy }}',
sku = '{{ sku }}',
identity = '{{ identity }}',
location = '{{ location }}',
extendedLocation = '{{ extendedLocation }}',
tags = '{{ tags }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND resource_provider_namespace = '{{ resource_provider_namespace }}' --required
AND parent_resource_path = '{{ parent_resource_path }}' --required
AND resource_type = '{{ resource_type }}' --required
AND resource_name = '{{ resource_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
extendedLocation,
identity,
kind,
location,
managedBy,
plan,
properties,
sku,
systemData,
tags,
type;

REPLACE examples

Creates a resource.

REPLACE azure.resource.resources
SET
properties = '{{ properties }}',
plan = '{{ plan }}',
kind = '{{ kind }}',
managedBy = '{{ managedBy }}',
sku = '{{ sku }}',
identity = '{{ identity }}',
location = '{{ location }}',
extendedLocation = '{{ extendedLocation }}',
tags = '{{ tags }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND resource_provider_namespace = '{{ resource_provider_namespace }}' --required
AND parent_resource_path = '{{ parent_resource_path }}' --required
AND resource_type = '{{ resource_type }}' --required
AND resource_name = '{{ resource_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
extendedLocation,
identity,
kind,
location,
managedBy,
plan,
properties,
sku,
systemData,
tags,
type;

DELETE examples

Deletes a resource.

DELETE FROM azure.resource.resources
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND resource_provider_namespace = '{{ resource_provider_namespace }}' --required
AND parent_resource_path = '{{ parent_resource_path }}' --required
AND resource_type = '{{ resource_type }}' --required
AND resource_name = '{{ resource_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
;

Lifecycle Methods

Checks whether a resource exists.

EXEC azure.resource.resources.check_existence 
@resource_group_name='{{ resource_group_name }}' --required,
@resource_provider_namespace='{{ resource_provider_namespace }}' --required,
@parent_resource_path='{{ parent_resource_path }}' --required,
@resource_type='{{ resource_type }}' --required,
@resource_name='{{ resource_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;