Skip to main content

resource_groups

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

Overview

Nameresource_groups
TypeResource
Idazure.resources.resource_groups

Fields

NameDatatypeDescription
idtextThe ID of the resource group.
nametextThe name of the resource group.
locationtextThe 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.
managed_bytextfield from the properties object
provisioning_statetextfield from the properties object
resourceGroupNametextfield from the properties object
subscriptionIdtextfield from the properties object
tagstextThe tags attached to the resource group.
typetextThe type of the resource group.

Methods

NameAccessible byRequired ParamsDescription
getSELECTresourceGroupName, subscriptionIdGets a resource group.
listSELECTsubscriptionIdGets all the resource groups for a subscription.
create_or_updateINSERTresourceGroupName, subscriptionId, data__locationCreates or updates a resource group.
deleteDELETEresourceGroupName, subscriptionIdWhen 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.
updateUPDATEresourceGroupName, subscriptionIdResource 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.
export_templateEXECresourceGroupName, subscriptionIdCaptures the specified resource group as a template.

SELECT examples

Gets all the resource groups for a subscription.

SELECT
id,
name,
location,
managed_by,
provisioning_state,
resourceGroupName,
subscriptionId,
tags,
type
FROM azure.resources.vw_resource_groups
WHERE subscriptionId = '{{ subscriptionId }}';

INSERT example

Use the following StackQL query and manifest file to create a new resource_groups resource.

/*+ create */
INSERT INTO azure.resources.resource_groups (
resourceGroupName,
subscriptionId,
data__location,
properties,
location,
managedBy,
tags
)
SELECT
'{{ resourceGroupName }}',
'{{ subscriptionId }}',
'{{ data__location }}',
'{{ properties }}',
'{{ location }}',
'{{ managedBy }}',
'{{ tags }}'
;

UPDATE example

Updates a resource_groups resource.

/*+ update */
UPDATE azure.resources.resource_groups
SET
name = '{{ name }}',
properties = '{{ properties }}',
managedBy = '{{ managedBy }}',
tags = '{{ tags }}'
WHERE
resourceGroupName = '{{ resourceGroupName }}'
AND subscriptionId = '{{ subscriptionId }}';

DELETE example

Deletes the specified resource_groups resource.

/*+ delete */
DELETE FROM azure.resources.resource_groups
WHERE resourceGroupName = '{{ resourceGroupName }}'
AND subscriptionId = '{{ subscriptionId }}';