Skip to main content

sql_role_assignments

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

Overview

Namesql_role_assignments
TypeResource
Idazure.cosmos_db.sql_role_assignments

Fields

NameDatatypeDescription
idtextThe unique resource identifier of the database account.
nametextThe name of the database account.
accountNametextfield from the properties object
principal_idtextfield from the properties object
resourceGroupNametextfield from the properties object
roleAssignmentIdtextfield from the properties object
role_definition_idtextfield from the properties object
scopetextfield from the properties object
subscriptionIdtextfield from the properties object
typetextThe type of Azure resource.

Methods

NameAccessible byRequired ParamsDescription
getSELECTaccountName, resourceGroupName, roleAssignmentId, subscriptionIdRetrieves the properties of an existing Azure Cosmos DB SQL Role Assignment with the given Id.
listSELECTaccountName, resourceGroupName, subscriptionIdRetrieves the list of all Azure Cosmos DB SQL Role Assignments.
create_updateINSERTaccountName, resourceGroupName, roleAssignmentId, subscriptionIdCreates or updates an Azure Cosmos DB SQL Role Assignment.
deleteDELETEaccountName, resourceGroupName, roleAssignmentId, subscriptionIdDeletes an existing Azure Cosmos DB SQL Role Assignment.

SELECT examples

Retrieves the list of all Azure Cosmos DB SQL Role Assignments.

SELECT
id,
name,
accountName,
principal_id,
resourceGroupName,
roleAssignmentId,
role_definition_id,
scope,
subscriptionId,
type
FROM azure.cosmos_db.vw_sql_role_assignments
WHERE accountName = '{{ accountName }}'
AND resourceGroupName = '{{ resourceGroupName }}'
AND subscriptionId = '{{ subscriptionId }}';

INSERT example

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

/*+ create */
INSERT INTO azure.cosmos_db.sql_role_assignments (
accountName,
resourceGroupName,
roleAssignmentId,
subscriptionId,
properties
)
SELECT
'{{ accountName }}',
'{{ resourceGroupName }}',
'{{ roleAssignmentId }}',
'{{ subscriptionId }}',
'{{ properties }}'
;

DELETE example

Deletes the specified sql_role_assignments resource.

/*+ delete */
DELETE FROM azure.cosmos_db.sql_role_assignments
WHERE accountName = '{{ accountName }}'
AND resourceGroupName = '{{ resourceGroupName }}'
AND roleAssignmentId = '{{ roleAssignmentId }}'
AND subscriptionId = '{{ subscriptionId }}';