resources
Creates, updates, deletes, gets or lists a resources resource.
Overview
| Name | resources |
| Type | Resource |
| Id | azure.resource.resources |
Fields
The following fields are returned by SELECT queries:
- get
- list_by_resource_group
- list
- get_by_id
| 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. |
extendedLocation | object | Resource extended location. |
identity | object | The identity of the resource. |
kind | string | The kind of the resource. |
location | string | Resource location. |
managedBy | string | ID of the resource that manages this resource. |
plan | object | The plan of the resource. |
properties | object | The resource-specific properties for this resource. |
sku | object | The SKU of the resource. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| 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. |
changedTime | string (date-time) | The changed time of the resource. This is only present if requested via the $expand query parameter. |
createdTime | string (date-time) | The created time of the resource. This is only present if requested via the $expand query parameter. |
extendedLocation | object | Resource extended location. |
identity | object | The identity of the resource. |
kind | string | The kind of the resource. |
location | string | Resource location. |
managedBy | string | ID of the resource that manages this resource. |
plan | object | The plan of the resource. |
properties | object | The resource-specific properties for this resource. |
provisioningState | string | The provisioning state of the resource. This is only present if requested via the $expand query parameter. |
sku | object | The SKU of the resource. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| 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. |
changedTime | string (date-time) | The changed time of the resource. This is only present if requested via the $expand query parameter. |
createdTime | string (date-time) | The created time of the resource. This is only present if requested via the $expand query parameter. |
extendedLocation | object | Resource extended location. |
identity | object | The identity of the resource. |
kind | string | The kind of the resource. |
location | string | Resource location. |
managedBy | string | ID of the resource that manages this resource. |
plan | object | The plan of the resource. |
properties | object | The resource-specific properties for this resource. |
provisioningState | string | The provisioning state of the resource. This is only present if requested via the $expand query parameter. |
sku | object | The SKU of the resource. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
type | string | The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". |
| 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. |
extendedLocation | object | Resource extended location. |
identity | object | The identity of the resource. |
kind | string | The kind of the resource. |
location | string | Resource location. |
managedBy | string | ID of the resource that manages this resource. |
plan | object | The plan of the resource. |
properties | object | The resource-specific properties for this resource. |
sku | object | The SKU of the resource. |
systemData | object | Azure Resource Manager metadata containing createdBy and modifiedBy information. |
tags | object | Resource tags. |
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 |
|---|---|---|---|---|
get | select | resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, subscription_id | Gets a resource. | |
list_by_resource_group | select | resource_group_name, subscription_id | $filter, $expand, $top | Get all the resources for a resource group. |
list | select | subscription_id | $filter, $expand, $top | Get all the resources in a subscription. |
get_by_id | select | resource_id | Gets a resource by ID. | |
create_or_update | insert | resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, subscription_id | Creates a resource. | |
create_or_update_by_id | insert | resource_id | Create a resource by ID. | |
update | update | resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, subscription_id | Updates a resource. | |
update_by_id | update | resource_id | Update a resource by ID. | |
create_or_update | replace | resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, subscription_id | Creates a resource. | |
create_or_update_by_id | replace | resource_id | Create a resource by ID. | |
delete | delete | resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, subscription_id | Deletes a resource. | |
delete_by_id | delete | resource_id | Deletes a resource by ID. | |
check_existence | exec | resource_group_name, resource_provider_namespace, parent_resource_path, resource_type, resource_name, subscription_id | Checks whether a resource exists. | |
check_existence_by_id | exec | resource_id | Checks 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_resources | exec | source_resource_group_name, subscription_id | Moves 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_resources | exec | source_resource_group_name, subscription_id | Validates 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.
| Name | Datatype | Description |
|---|---|---|
parent_resource_path | string | The parent resource identity. Required. |
resource_group_name | string | The name of the resource group containing the resource to get. The name is case insensitive. Required. |
resource_id | string | Required. |
resource_name | string | The name of the resource to check whether it exists. Required. |
resource_provider_namespace | string | The resource provider of the resource to check. Required. |
resource_type | string | The resource type. Required. |
source_resource_group_name | string | The name of the resource group to get. The name is case insensitive. Required. |
subscription_id | string | |
$expand | string | Comma-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. |
$filter | string | The 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. |
$top | integer | The number of recommendations per page if a paged version of this API is being used. Default value is None. |
SELECT examples
- get
- list_by_resource_group
- list
- get_by_id
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
;
Get all the resources for a resource group.
SELECT
id,
name,
changedTime,
createdTime,
extendedLocation,
identity,
kind,
location,
managedBy,
plan,
properties,
provisioningState,
sku,
systemData,
tags,
type
FROM azure.resource.resources
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
AND $filter = '{{ $filter }}'
AND $expand = '{{ $expand }}'
AND $top = '{{ $top }}'
;
Get all the resources in a subscription.
SELECT
id,
name,
changedTime,
createdTime,
extendedLocation,
identity,
kind,
location,
managedBy,
plan,
properties,
provisioningState,
sku,
systemData,
tags,
type
FROM azure.resource.resources
WHERE subscription_id = '{{ subscription_id }}' -- required
AND $filter = '{{ $filter }}'
AND $expand = '{{ $expand }}'
AND $top = '{{ $top }}'
;
Gets a resource by ID.
SELECT
id,
name,
extendedLocation,
identity,
kind,
location,
managedBy,
plan,
properties,
sku,
systemData,
tags,
type
FROM azure.resource.resources
WHERE resource_id = '{{ resource_id }}' -- required
;
INSERT examples
- create_or_update
- create_or_update_by_id
- Manifest
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
;
Create a resource by ID.
INSERT INTO azure.resource.resources (
properties,
plan,
kind,
managedBy,
sku,
identity,
location,
extendedLocation,
tags,
resource_id
)
SELECT
'{{ properties }}',
'{{ plan }}',
'{{ kind }}',
'{{ managedBy }}',
'{{ sku }}',
'{{ identity }}',
'{{ location }}',
'{{ extendedLocation }}',
'{{ tags }}',
'{{ resource_id }}'
RETURNING
id,
name,
extendedLocation,
identity,
kind,
location,
managedBy,
plan,
properties,
sku,
systemData,
tags,
type
;
# Description fields are for documentation purposes
- name: resources
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the resources resource.
- name: resource_provider_namespace
value: "{{ resource_provider_namespace }}"
description: Required parameter for the resources resource.
- name: parent_resource_path
value: "{{ parent_resource_path }}"
description: Required parameter for the resources resource.
- name: resource_type
value: "{{ resource_type }}"
description: Required parameter for the resources resource.
- name: resource_name
value: "{{ resource_name }}"
description: Required parameter for the resources resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the resources resource.
- name: resource_id
value: "{{ resource_id }}"
description: Required parameter for the resources resource.
- name: properties
value: "{{ properties }}"
description: |
The resource-specific properties for this resource.
- name: plan
description: |
The plan of the resource.
value:
name: "{{ name }}"
publisher: "{{ publisher }}"
product: "{{ product }}"
promotionCode: "{{ promotionCode }}"
version: "{{ version }}"
- name: kind
value: "{{ kind }}"
description: |
The kind of the resource.
- name: managedBy
value: "{{ managedBy }}"
description: |
ID of the resource that manages this resource.
- name: sku
description: |
The SKU of the resource.
value:
name: "{{ name }}"
tier: "{{ tier }}"
size: "{{ size }}"
family: "{{ family }}"
model: "{{ model }}"
capacity: {{ capacity }}
- name: identity
description: |
The identity of the resource.
value:
principalId: "{{ principalId }}"
tenantId: "{{ tenantId }}"
type: "{{ type }}"
userAssignedIdentities: "{{ userAssignedIdentities }}"
- name: location
value: "{{ location }}"
description: |
Resource location.
- name: extendedLocation
description: |
Resource extended location.
value:
type: "{{ type }}"
name: "{{ name }}"
- name: tags
value: "{{ tags }}"
description: |
Resource tags.
UPDATE examples
- update
- update_by_id
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;
Update a resource by ID.
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_id = '{{ resource_id }}' --required
RETURNING
id,
name,
extendedLocation,
identity,
kind,
location,
managedBy,
plan,
properties,
sku,
systemData,
tags,
type;
REPLACE examples
- create_or_update
- create_or_update_by_id
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;
Create a resource by ID.
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_id = '{{ resource_id }}' --required
RETURNING
id,
name,
extendedLocation,
identity,
kind,
location,
managedBy,
plan,
properties,
sku,
systemData,
tags,
type;
DELETE examples
- delete
- delete_by_id
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
;
Deletes a resource by ID.
DELETE FROM azure.resource.resources
WHERE resource_id = '{{ resource_id }}' --required
;
Lifecycle Methods
- check_existence
- check_existence_by_id
- move_resources
- validate_move_resources
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
;
Checks 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.
EXEC azure.resource.resources.check_existence_by_id
@resource_id='{{ resource_id }}' --required
;
Moves 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.
EXEC azure.resource.resources.move_resources
@source_resource_group_name='{{ source_resource_group_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"resources": "{{ resources }}",
"targetResourceGroup": "{{ targetResourceGroup }}"
}'
;
Validates 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.
EXEC azure.resource.resources.validate_move_resources
@source_resource_group_name='{{ source_resource_group_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"resources": "{{ resources }}",
"targetResourceGroup": "{{ targetResourceGroup }}"
}'
;