resource_groups
Creates, updates, deletes, gets or lists a resource_groups
resource.
Overview
Name | resource_groups |
Type | Resource |
Id | azure.resources.resource_groups |
Fields
The following fields are returned by SELECT
queries:
- get
- list
OK - Returns information about the resource group.
Name | Datatype | Description |
---|---|---|
id | string | The ID of the resource group. |
name | string | The name of the resource group. |
location | string | The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations. |
managedBy | string | The ID of the resource that manages this resource group. |
properties | object | The resource group properties. |
tags | object | The tags attached to the resource group. |
type | string | The type of the resource group. |
OK - Returns an array of resource groups.
Name | Datatype | Description |
---|---|---|
id | string | The ID of the resource group. |
name | string | The name of the resource group. |
location | string | The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations. |
managedBy | string | The ID of the resource that manages this resource group. |
properties | object | The resource group properties. |
tags | object | The tags attached to the resource group. |
type | string | The type of the resource group. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | resourceGroupName , subscriptionId | Gets a resource group. | |
list | select | subscriptionId | $filter , $top | Gets all the resource groups for a subscription. |
create_or_update | insert | resourceGroupName , subscriptionId , data__location | Creates or updates a resource group. | |
update | update | resourceGroupName , subscriptionId | Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained. | |
delete | delete | resourceGroupName , subscriptionId | forceDeletionTypes | When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations. |
export_template | exec | subscriptionId , resourceGroupName | Captures the specified resource group as a template. |
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 |
---|---|---|
resourceGroupName | string | The name of the resource group. The name is case insensitive. |
subscriptionId | string (uuid) | The ID of the target subscription. The value must be an UUID. |
$filter | string | The filter to apply on the operation. You can filter by tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1' |
$top | integer (int32) | The number of results to return. If null is passed, returns all resource groups. |
forceDeletionTypes | string | The resource types you want to force delete. Currently, only the following is supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets |
SELECT
examples
- get
- list
Gets a resource group.
SELECT
id,
name,
location,
managedBy,
properties,
tags,
type
FROM azure.resources.resource_groups
WHERE resourceGroupName = '{{ resourceGroupName }}' -- required
AND subscriptionId = '{{ subscriptionId }}' -- required
;
Gets all the resource groups for a subscription.
SELECT
id,
name,
location,
managedBy,
properties,
tags,
type
FROM azure.resources.resource_groups
WHERE subscriptionId = '{{ subscriptionId }}' -- required
AND $filter = '{{ $filter }}'
AND $top = '{{ $top }}'
;
INSERT
examples
- create_or_update
- Manifest
Creates or updates a resource group.
INSERT INTO azure.resources.resource_groups (
data__properties,
data__location,
data__managedBy,
data__tags,
resourceGroupName,
subscriptionId
)
SELECT
'{{ properties }}',
'{{ location }}' /* required */,
'{{ managedBy }}',
'{{ tags }}',
'{{ resourceGroupName }}',
'{{ subscriptionId }}'
RETURNING
id,
name,
location,
managedBy,
properties,
tags,
type
;
# Description fields are for documentation purposes
- name: resource_groups
props:
- name: resourceGroupName
value: string
description: Required parameter for the resource_groups resource.
- name: subscriptionId
value: string (uuid)
description: Required parameter for the resource_groups resource.
- name: properties
value: object
description: |
The resource group properties.
- name: location
value: string
description: |
The location of the resource group. It cannot be changed after the resource group has been created. It must be one of the supported Azure locations.
- name: managedBy
value: string
description: |
The ID of the resource that manages this resource group.
- name: tags
value: object
description: |
The tags attached to the resource group.
UPDATE
examples
- update
Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained.
UPDATE azure.resources.resource_groups
SET
data__name = '{{ name }}',
data__properties = '{{ properties }}',
data__managedBy = '{{ managedBy }}',
data__tags = '{{ tags }}'
WHERE
resourceGroupName = '{{ resourceGroupName }}' --required
AND subscriptionId = '{{ subscriptionId }}' --required
RETURNING
id,
name,
location,
managedBy,
properties,
tags,
type;
DELETE
examples
- delete
When you delete a resource group, all of its resources are also deleted. Deleting a resource group deletes all of its template deployments and currently stored operations.
DELETE FROM azure.resources.resource_groups
WHERE resourceGroupName = '{{ resourceGroupName }}' --required
AND subscriptionId = '{{ subscriptionId }}' --required
AND forceDeletionTypes = '{{ forceDeletionTypes }}'
;
Lifecycle Methods
- export_template
Captures the specified resource group as a template.
EXEC azure.resources.resource_groups.export_template
@subscriptionId='{{ subscriptionId }}' --required,
@resourceGroupName='{{ resourceGroupName }}' --required
@@json=
'{
"resources": "{{ resources }}",
"options": "{{ options }}",
"outputFormat": "{{ outputFormat }}"
}'
;