resource_groups
Creates, updates, deletes, gets or lists a resource_groups resource.
Overview
| Name | resource_groups |
| Type | Resource |
| Id | azure.resource.resource_groups |
Fields
The following fields are returned by SELECT queries:
- get
- list
| 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. |
location | string | The geo-location where the resource lives. Required. |
managedBy | string | The ID of the resource that manages this resource group. |
provisioningState | string | The provisioning state. |
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. |
location | string | The geo-location where the resource lives. Required. |
managedBy | string | The ID of the resource that manages this resource group. |
provisioningState | string | The provisioning state. |
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, subscription_id | Gets a resource group. | |
list | select | subscription_id | $filter, $top | Gets all the resource groups for a subscription. |
create_or_update | insert | resource_group_name, subscription_id, location | Creates or updates a resource group. | |
update | update | resource_group_name, subscription_id | Updates a resource group. 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. | |
create_or_update | replace | resource_group_name, subscription_id, location | Creates or updates a resource group. | |
delete | delete | resource_group_name, subscription_id | forceDeletionTypes | Deletes a resource group. 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. |
check_existence | exec | resource_group_name, subscription_id | Checks whether a resource group exists. | |
export_template | exec | resource_group_name, subscription_id | 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 |
|---|---|---|
resource_group_name | string | The name of the resource group to get. The name is case insensitive. Required. |
subscription_id | string | |
$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'. Default value is None. |
$top | integer | The number of results to return. If null is passed, returns all resource groups. Default value is None. |
forceDeletionTypes | string | The resource types you want to force delete. Currently, only the following is supported: forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. Default value is None. |
SELECT examples
- get
- list
Gets a resource group.
SELECT
id,
name,
location,
managedBy,
provisioningState,
systemData,
tags,
type
FROM azure.resource.resource_groups
WHERE resource_group_name = '{{ resource_group_name }}' -- required
AND subscription_id = '{{ subscription_id }}' -- required
;
Gets all the resource groups for a subscription.
SELECT
id,
name,
location,
managedBy,
provisioningState,
systemData,
tags,
type
FROM azure.resource.resource_groups
WHERE subscription_id = '{{ subscription_id }}' -- required
AND $filter = '{{ $filter }}'
AND $top = '{{ $top }}'
;
INSERT examples
- create_or_update
- Manifest
Creates or updates a resource group.
INSERT INTO azure.resource.resource_groups (
tags,
location,
properties,
managedBy,
resource_group_name,
subscription_id
)
SELECT
'{{ tags }}',
'{{ location }}' /* required */,
'{{ properties }}',
'{{ managedBy }}',
'{{ resource_group_name }}',
'{{ subscription_id }}'
RETURNING
id,
name,
location,
managedBy,
properties,
systemData,
tags,
type
;
# Description fields are for documentation purposes
- name: resource_groups
props:
- name: resource_group_name
value: "{{ resource_group_name }}"
description: Required parameter for the resource_groups resource.
- name: subscription_id
value: "{{ subscription_id }}"
description: Required parameter for the resource_groups resource.
- name: tags
value: "{{ tags }}"
description: |
Resource tags.
- name: location
value: "{{ location }}"
description: |
The geo-location where the resource lives. Required.
- name: properties
description: |
The resource group properties.
value:
provisioningState: "{{ provisioningState }}"
- name: managedBy
value: "{{ managedBy }}"
description: |
The ID of the resource that manages this resource group.
UPDATE examples
- update
Updates a resource group. 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.resource.resource_groups
SET
name = '{{ name }}',
properties = '{{ properties }}',
managedBy = '{{ managedBy }}',
tags = '{{ tags }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
RETURNING
id,
name,
location,
managedBy,
properties,
systemData,
tags,
type;
REPLACE examples
- create_or_update
Creates or updates a resource group.
REPLACE azure.resource.resource_groups
SET
tags = '{{ tags }}',
location = '{{ location }}',
properties = '{{ properties }}',
managedBy = '{{ managedBy }}'
WHERE
resource_group_name = '{{ resource_group_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND location = '{{ location }}' --required
RETURNING
id,
name,
location,
managedBy,
properties,
systemData,
tags,
type;
DELETE examples
- delete
Deletes a resource group. 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.resource.resource_groups
WHERE resource_group_name = '{{ resource_group_name }}' --required
AND subscription_id = '{{ subscription_id }}' --required
AND forceDeletionTypes = '{{ forceDeletionTypes }}'
;
Lifecycle Methods
- check_existence
- export_template
Checks whether a resource group exists.
EXEC azure.resource.resource_groups.check_existence
@resource_group_name='{{ resource_group_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
;
Captures the specified resource group as a template.
EXEC azure.resource.resource_groups.export_template
@resource_group_name='{{ resource_group_name }}' --required,
@subscription_id='{{ subscription_id }}' --required
@@json=
'{
"resources": "{{ resources }}",
"options": "{{ options }}",
"outputFormat": "{{ outputFormat }}"
}'
;