Skip to main content

resource_groups

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

Overview

Nameresource_groups
TypeResource
Idazure.resource.resource_groups

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.
locationstringThe geo-location where the resource lives. Required.
managedBystringThe ID of the resource that manages this resource group.
provisioningStatestringThe provisioning state.
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, subscription_idGets a resource group.
listselectsubscription_id$filter, $topGets all the resource groups for a subscription.
create_or_updateinsertresource_group_name, subscription_id, locationCreates or updates a resource group.
updateupdateresource_group_name, subscription_idUpdates 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_updatereplaceresource_group_name, subscription_id, locationCreates or updates a resource group.
deletedeleteresource_group_name, subscription_idforceDeletionTypesDeletes 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_existenceexecresource_group_name, subscription_idChecks whether a resource group exists.
export_templateexecresource_group_name, subscription_idCaptures 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.

NameDatatypeDescription
resource_group_namestringThe name of the resource group to get. The name is case insensitive. Required.
subscription_idstring
$filterstringThe 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.
$topintegerThe number of results to return. If null is passed, returns all resource groups. Default value is None.
forceDeletionTypesstringThe 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

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
;

INSERT examples

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
;

UPDATE examples

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

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

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

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
;