1. Packages
  2. Azure Classic
  3. API Docs
  4. cosmosdb
  5. SqlRoleDefinition

We recommend using Azure Native.

Azure v6.21.0 published on Friday, Mar 7, 2025 by Pulumi

azure.cosmosdb.SqlRoleDefinition

Explore with Pulumi AI

Manages a Cosmos DB SQL Role Definition.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const current = azure.core.getClientConfig({});
const example = new azure.core.ResourceGroup("example", {
    name: "example-resources",
    location: "West Europe",
});
const exampleAccount = new azure.cosmosdb.Account("example", {
    name: "example-cosmosdb",
    location: example.location,
    resourceGroupName: example.name,
    offerType: "Standard",
    kind: "GlobalDocumentDB",
    consistencyPolicy: {
        consistencyLevel: "Strong",
    },
    geoLocations: [{
        location: example.location,
        failoverPriority: 0,
    }],
});
const exampleSqlRoleDefinition = new azure.cosmosdb.SqlRoleDefinition("example", {
    roleDefinitionId: "84cf3a8b-4122-4448-bce2-fa423cfe0a15",
    resourceGroupName: example.name,
    accountName: exampleAccount.name,
    name: "acctestsqlrole",
    assignableScopes: [pulumi.interpolate`${exampleAccount.id}/dbs/sales`],
    permissions: [{
        dataActions: ["Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read"],
    }],
});
Copy
import pulumi
import pulumi_azure as azure

current = azure.core.get_client_config()
example = azure.core.ResourceGroup("example",
    name="example-resources",
    location="West Europe")
example_account = azure.cosmosdb.Account("example",
    name="example-cosmosdb",
    location=example.location,
    resource_group_name=example.name,
    offer_type="Standard",
    kind="GlobalDocumentDB",
    consistency_policy={
        "consistency_level": "Strong",
    },
    geo_locations=[{
        "location": example.location,
        "failover_priority": 0,
    }])
example_sql_role_definition = azure.cosmosdb.SqlRoleDefinition("example",
    role_definition_id="84cf3a8b-4122-4448-bce2-fa423cfe0a15",
    resource_group_name=example.name,
    account_name=example_account.name,
    name="acctestsqlrole",
    assignable_scopes=[example_account.id.apply(lambda id: f"{id}/dbs/sales")],
    permissions=[{
        "data_actions": ["Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read"],
    }])
Copy
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/cosmosdb"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := core.GetClientConfig(ctx, map[string]interface{}{}, nil)
		if err != nil {
			return err
		}
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("example-resources"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleAccount, err := cosmosdb.NewAccount(ctx, "example", &cosmosdb.AccountArgs{
			Name:              pulumi.String("example-cosmosdb"),
			Location:          example.Location,
			ResourceGroupName: example.Name,
			OfferType:         pulumi.String("Standard"),
			Kind:              pulumi.String("GlobalDocumentDB"),
			ConsistencyPolicy: &cosmosdb.AccountConsistencyPolicyArgs{
				ConsistencyLevel: pulumi.String("Strong"),
			},
			GeoLocations: cosmosdb.AccountGeoLocationArray{
				&cosmosdb.AccountGeoLocationArgs{
					Location:         example.Location,
					FailoverPriority: pulumi.Int(0),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = cosmosdb.NewSqlRoleDefinition(ctx, "example", &cosmosdb.SqlRoleDefinitionArgs{
			RoleDefinitionId:  pulumi.String("84cf3a8b-4122-4448-bce2-fa423cfe0a15"),
			ResourceGroupName: example.Name,
			AccountName:       exampleAccount.Name,
			Name:              pulumi.String("acctestsqlrole"),
			AssignableScopes: pulumi.StringArray{
				exampleAccount.ID().ApplyT(func(id string) (string, error) {
					return fmt.Sprintf("%v/dbs/sales", id), nil
				}).(pulumi.StringOutput),
			},
			Permissions: cosmosdb.SqlRoleDefinitionPermissionArray{
				&cosmosdb.SqlRoleDefinitionPermissionArgs{
					DataActions: pulumi.StringArray{
						pulumi.String("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var current = Azure.Core.GetClientConfig.Invoke();

    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "example-resources",
        Location = "West Europe",
    });

    var exampleAccount = new Azure.CosmosDB.Account("example", new()
    {
        Name = "example-cosmosdb",
        Location = example.Location,
        ResourceGroupName = example.Name,
        OfferType = "Standard",
        Kind = "GlobalDocumentDB",
        ConsistencyPolicy = new Azure.CosmosDB.Inputs.AccountConsistencyPolicyArgs
        {
            ConsistencyLevel = "Strong",
        },
        GeoLocations = new[]
        {
            new Azure.CosmosDB.Inputs.AccountGeoLocationArgs
            {
                Location = example.Location,
                FailoverPriority = 0,
            },
        },
    });

    var exampleSqlRoleDefinition = new Azure.CosmosDB.SqlRoleDefinition("example", new()
    {
        RoleDefinitionId = "84cf3a8b-4122-4448-bce2-fa423cfe0a15",
        ResourceGroupName = example.Name,
        AccountName = exampleAccount.Name,
        Name = "acctestsqlrole",
        AssignableScopes = new[]
        {
            exampleAccount.Id.Apply(id => $"{id}/dbs/sales"),
        },
        Permissions = new[]
        {
            new Azure.CosmosDB.Inputs.SqlRoleDefinitionPermissionArgs
            {
                DataActions = new[]
                {
                    "Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read",
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.CoreFunctions;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.cosmosdb.Account;
import com.pulumi.azure.cosmosdb.AccountArgs;
import com.pulumi.azure.cosmosdb.inputs.AccountConsistencyPolicyArgs;
import com.pulumi.azure.cosmosdb.inputs.AccountGeoLocationArgs;
import com.pulumi.azure.cosmosdb.SqlRoleDefinition;
import com.pulumi.azure.cosmosdb.SqlRoleDefinitionArgs;
import com.pulumi.azure.cosmosdb.inputs.SqlRoleDefinitionPermissionArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var current = CoreFunctions.getClientConfig();

        var example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("example-resources")
            .location("West Europe")
            .build());

        var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
            .name("example-cosmosdb")
            .location(example.location())
            .resourceGroupName(example.name())
            .offerType("Standard")
            .kind("GlobalDocumentDB")
            .consistencyPolicy(AccountConsistencyPolicyArgs.builder()
                .consistencyLevel("Strong")
                .build())
            .geoLocations(AccountGeoLocationArgs.builder()
                .location(example.location())
                .failoverPriority(0)
                .build())
            .build());

        var exampleSqlRoleDefinition = new SqlRoleDefinition("exampleSqlRoleDefinition", SqlRoleDefinitionArgs.builder()
            .roleDefinitionId("84cf3a8b-4122-4448-bce2-fa423cfe0a15")
            .resourceGroupName(example.name())
            .accountName(exampleAccount.name())
            .name("acctestsqlrole")
            .assignableScopes(exampleAccount.id().applyValue(id -> String.format("%s/dbs/sales", id)))
            .permissions(SqlRoleDefinitionPermissionArgs.builder()
                .dataActions("Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read")
                .build())
            .build());

    }
}
Copy
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-resources
      location: West Europe
  exampleAccount:
    type: azure:cosmosdb:Account
    name: example
    properties:
      name: example-cosmosdb
      location: ${example.location}
      resourceGroupName: ${example.name}
      offerType: Standard
      kind: GlobalDocumentDB
      consistencyPolicy:
        consistencyLevel: Strong
      geoLocations:
        - location: ${example.location}
          failoverPriority: 0
  exampleSqlRoleDefinition:
    type: azure:cosmosdb:SqlRoleDefinition
    name: example
    properties:
      roleDefinitionId: 84cf3a8b-4122-4448-bce2-fa423cfe0a15
      resourceGroupName: ${example.name}
      accountName: ${exampleAccount.name}
      name: acctestsqlrole
      assignableScopes:
        - ${exampleAccount.id}/dbs/sales
      permissions:
        - dataActions:
            - Microsoft.DocumentDB/databaseAccounts/sqlDatabases/containers/items/read
variables:
  current:
    fn::invoke:
      function: azure:core:getClientConfig
      arguments: {}
Copy

Create SqlRoleDefinition Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new SqlRoleDefinition(name: string, args: SqlRoleDefinitionArgs, opts?: CustomResourceOptions);
@overload
def SqlRoleDefinition(resource_name: str,
                      args: SqlRoleDefinitionArgs,
                      opts: Optional[ResourceOptions] = None)

@overload
def SqlRoleDefinition(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      account_name: Optional[str] = None,
                      assignable_scopes: Optional[Sequence[str]] = None,
                      permissions: Optional[Sequence[SqlRoleDefinitionPermissionArgs]] = None,
                      resource_group_name: Optional[str] = None,
                      name: Optional[str] = None,
                      role_definition_id: Optional[str] = None,
                      type: Optional[str] = None)
func NewSqlRoleDefinition(ctx *Context, name string, args SqlRoleDefinitionArgs, opts ...ResourceOption) (*SqlRoleDefinition, error)
public SqlRoleDefinition(string name, SqlRoleDefinitionArgs args, CustomResourceOptions? opts = null)
public SqlRoleDefinition(String name, SqlRoleDefinitionArgs args)
public SqlRoleDefinition(String name, SqlRoleDefinitionArgs args, CustomResourceOptions options)
type: azure:cosmosdb:SqlRoleDefinition
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SqlRoleDefinitionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. SqlRoleDefinitionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. SqlRoleDefinitionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SqlRoleDefinitionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SqlRoleDefinitionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var sqlRoleDefinitionResource = new Azure.CosmosDB.SqlRoleDefinition("sqlRoleDefinitionResource", new()
{
    AccountName = "string",
    AssignableScopes = new[]
    {
        "string",
    },
    Permissions = new[]
    {
        new Azure.CosmosDB.Inputs.SqlRoleDefinitionPermissionArgs
        {
            DataActions = new[]
            {
                "string",
            },
        },
    },
    ResourceGroupName = "string",
    Name = "string",
    RoleDefinitionId = "string",
    Type = "string",
});
Copy
example, err := cosmosdb.NewSqlRoleDefinition(ctx, "sqlRoleDefinitionResource", &cosmosdb.SqlRoleDefinitionArgs{
	AccountName: pulumi.String("string"),
	AssignableScopes: pulumi.StringArray{
		pulumi.String("string"),
	},
	Permissions: cosmosdb.SqlRoleDefinitionPermissionArray{
		&cosmosdb.SqlRoleDefinitionPermissionArgs{
			DataActions: pulumi.StringArray{
				pulumi.String("string"),
			},
		},
	},
	ResourceGroupName: pulumi.String("string"),
	Name:              pulumi.String("string"),
	RoleDefinitionId:  pulumi.String("string"),
	Type:              pulumi.String("string"),
})
Copy
var sqlRoleDefinitionResource = new SqlRoleDefinition("sqlRoleDefinitionResource", SqlRoleDefinitionArgs.builder()
    .accountName("string")
    .assignableScopes("string")
    .permissions(SqlRoleDefinitionPermissionArgs.builder()
        .dataActions("string")
        .build())
    .resourceGroupName("string")
    .name("string")
    .roleDefinitionId("string")
    .type("string")
    .build());
Copy
sql_role_definition_resource = azure.cosmosdb.SqlRoleDefinition("sqlRoleDefinitionResource",
    account_name="string",
    assignable_scopes=["string"],
    permissions=[{
        "data_actions": ["string"],
    }],
    resource_group_name="string",
    name="string",
    role_definition_id="string",
    type="string")
Copy
const sqlRoleDefinitionResource = new azure.cosmosdb.SqlRoleDefinition("sqlRoleDefinitionResource", {
    accountName: "string",
    assignableScopes: ["string"],
    permissions: [{
        dataActions: ["string"],
    }],
    resourceGroupName: "string",
    name: "string",
    roleDefinitionId: "string",
    type: "string",
});
Copy
type: azure:cosmosdb:SqlRoleDefinition
properties:
    accountName: string
    assignableScopes:
        - string
    name: string
    permissions:
        - dataActions:
            - string
    resourceGroupName: string
    roleDefinitionId: string
    type: string
Copy

SqlRoleDefinition Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The SqlRoleDefinition resource accepts the following input properties:

AccountName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Cosmos DB Account. Changing this forces a new resource to be created.
AssignableScopes This property is required. List<string>

A list of fully qualified scopes at or below which Role Assignments may be created using this Cosmos DB SQL Role Definition. It will allow application of this Cosmos DB SQL Role Definition on the entire Database Account or any underlying Database/Collection. Scopes higher than Database Account are not enforceable as assignable scopes.

NOTE: The resources referenced in assignable scopes need not exist.

Permissions This property is required. List<SqlRoleDefinitionPermission>
A permissions block as defined below.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Resource Group in which the Cosmos DB SQL Role Definition is created. Changing this forces a new resource to be created.
Name string
An user-friendly name for the Cosmos DB SQL Role Definition which must be unique for the Database Account.
RoleDefinitionId Changes to this property will trigger replacement. string
The GUID as the name of the Cosmos DB SQL Role Definition - one will be generated if not specified. Changing this forces a new resource to be created.
Type Changes to this property will trigger replacement. string
The type of the Cosmos DB SQL Role Definition. Possible values are BuiltInRole and CustomRole. Defaults to CustomRole. Changing this forces a new resource to be created.
AccountName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Cosmos DB Account. Changing this forces a new resource to be created.
AssignableScopes This property is required. []string

A list of fully qualified scopes at or below which Role Assignments may be created using this Cosmos DB SQL Role Definition. It will allow application of this Cosmos DB SQL Role Definition on the entire Database Account or any underlying Database/Collection. Scopes higher than Database Account are not enforceable as assignable scopes.

NOTE: The resources referenced in assignable scopes need not exist.

Permissions This property is required. []SqlRoleDefinitionPermissionArgs
A permissions block as defined below.
ResourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Resource Group in which the Cosmos DB SQL Role Definition is created. Changing this forces a new resource to be created.
Name string
An user-friendly name for the Cosmos DB SQL Role Definition which must be unique for the Database Account.
RoleDefinitionId Changes to this property will trigger replacement. string
The GUID as the name of the Cosmos DB SQL Role Definition - one will be generated if not specified. Changing this forces a new resource to be created.
Type Changes to this property will trigger replacement. string
The type of the Cosmos DB SQL Role Definition. Possible values are BuiltInRole and CustomRole. Defaults to CustomRole. Changing this forces a new resource to be created.
accountName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Cosmos DB Account. Changing this forces a new resource to be created.
assignableScopes This property is required. List<String>

A list of fully qualified scopes at or below which Role Assignments may be created using this Cosmos DB SQL Role Definition. It will allow application of this Cosmos DB SQL Role Definition on the entire Database Account or any underlying Database/Collection. Scopes higher than Database Account are not enforceable as assignable scopes.

NOTE: The resources referenced in assignable scopes need not exist.

permissions This property is required. List<SqlRoleDefinitionPermission>
A permissions block as defined below.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Resource Group in which the Cosmos DB SQL Role Definition is created. Changing this forces a new resource to be created.
name String
An user-friendly name for the Cosmos DB SQL Role Definition which must be unique for the Database Account.
roleDefinitionId Changes to this property will trigger replacement. String
The GUID as the name of the Cosmos DB SQL Role Definition - one will be generated if not specified. Changing this forces a new resource to be created.
type Changes to this property will trigger replacement. String
The type of the Cosmos DB SQL Role Definition. Possible values are BuiltInRole and CustomRole. Defaults to CustomRole. Changing this forces a new resource to be created.
accountName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Cosmos DB Account. Changing this forces a new resource to be created.
assignableScopes This property is required. string[]

A list of fully qualified scopes at or below which Role Assignments may be created using this Cosmos DB SQL Role Definition. It will allow application of this Cosmos DB SQL Role Definition on the entire Database Account or any underlying Database/Collection. Scopes higher than Database Account are not enforceable as assignable scopes.

NOTE: The resources referenced in assignable scopes need not exist.

permissions This property is required. SqlRoleDefinitionPermission[]
A permissions block as defined below.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
string
The name of the Resource Group in which the Cosmos DB SQL Role Definition is created. Changing this forces a new resource to be created.
name string
An user-friendly name for the Cosmos DB SQL Role Definition which must be unique for the Database Account.
roleDefinitionId Changes to this property will trigger replacement. string
The GUID as the name of the Cosmos DB SQL Role Definition - one will be generated if not specified. Changing this forces a new resource to be created.
type Changes to this property will trigger replacement. string
The type of the Cosmos DB SQL Role Definition. Possible values are BuiltInRole and CustomRole. Defaults to CustomRole. Changing this forces a new resource to be created.
account_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the Cosmos DB Account. Changing this forces a new resource to be created.
assignable_scopes This property is required. Sequence[str]

A list of fully qualified scopes at or below which Role Assignments may be created using this Cosmos DB SQL Role Definition. It will allow application of this Cosmos DB SQL Role Definition on the entire Database Account or any underlying Database/Collection. Scopes higher than Database Account are not enforceable as assignable scopes.

NOTE: The resources referenced in assignable scopes need not exist.

permissions This property is required. Sequence[SqlRoleDefinitionPermissionArgs]
A permissions block as defined below.
resource_group_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the Resource Group in which the Cosmos DB SQL Role Definition is created. Changing this forces a new resource to be created.
name str
An user-friendly name for the Cosmos DB SQL Role Definition which must be unique for the Database Account.
role_definition_id Changes to this property will trigger replacement. str
The GUID as the name of the Cosmos DB SQL Role Definition - one will be generated if not specified. Changing this forces a new resource to be created.
type Changes to this property will trigger replacement. str
The type of the Cosmos DB SQL Role Definition. Possible values are BuiltInRole and CustomRole. Defaults to CustomRole. Changing this forces a new resource to be created.
accountName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Cosmos DB Account. Changing this forces a new resource to be created.
assignableScopes This property is required. List<String>

A list of fully qualified scopes at or below which Role Assignments may be created using this Cosmos DB SQL Role Definition. It will allow application of this Cosmos DB SQL Role Definition on the entire Database Account or any underlying Database/Collection. Scopes higher than Database Account are not enforceable as assignable scopes.

NOTE: The resources referenced in assignable scopes need not exist.

permissions This property is required. List<Property Map>
A permissions block as defined below.
resourceGroupName
This property is required.
Changes to this property will trigger replacement.
String
The name of the Resource Group in which the Cosmos DB SQL Role Definition is created. Changing this forces a new resource to be created.
name String
An user-friendly name for the Cosmos DB SQL Role Definition which must be unique for the Database Account.
roleDefinitionId Changes to this property will trigger replacement. String
The GUID as the name of the Cosmos DB SQL Role Definition - one will be generated if not specified. Changing this forces a new resource to be created.
type Changes to this property will trigger replacement. String
The type of the Cosmos DB SQL Role Definition. Possible values are BuiltInRole and CustomRole. Defaults to CustomRole. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the SqlRoleDefinition resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing SqlRoleDefinition Resource

Get an existing SqlRoleDefinition resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: SqlRoleDefinitionState, opts?: CustomResourceOptions): SqlRoleDefinition
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        account_name: Optional[str] = None,
        assignable_scopes: Optional[Sequence[str]] = None,
        name: Optional[str] = None,
        permissions: Optional[Sequence[SqlRoleDefinitionPermissionArgs]] = None,
        resource_group_name: Optional[str] = None,
        role_definition_id: Optional[str] = None,
        type: Optional[str] = None) -> SqlRoleDefinition
func GetSqlRoleDefinition(ctx *Context, name string, id IDInput, state *SqlRoleDefinitionState, opts ...ResourceOption) (*SqlRoleDefinition, error)
public static SqlRoleDefinition Get(string name, Input<string> id, SqlRoleDefinitionState? state, CustomResourceOptions? opts = null)
public static SqlRoleDefinition get(String name, Output<String> id, SqlRoleDefinitionState state, CustomResourceOptions options)
resources:  _:    type: azure:cosmosdb:SqlRoleDefinition    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AccountName Changes to this property will trigger replacement. string
The name of the Cosmos DB Account. Changing this forces a new resource to be created.
AssignableScopes List<string>

A list of fully qualified scopes at or below which Role Assignments may be created using this Cosmos DB SQL Role Definition. It will allow application of this Cosmos DB SQL Role Definition on the entire Database Account or any underlying Database/Collection. Scopes higher than Database Account are not enforceable as assignable scopes.

NOTE: The resources referenced in assignable scopes need not exist.

Name string
An user-friendly name for the Cosmos DB SQL Role Definition which must be unique for the Database Account.
Permissions List<SqlRoleDefinitionPermission>
A permissions block as defined below.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the Resource Group in which the Cosmos DB SQL Role Definition is created. Changing this forces a new resource to be created.
RoleDefinitionId Changes to this property will trigger replacement. string
The GUID as the name of the Cosmos DB SQL Role Definition - one will be generated if not specified. Changing this forces a new resource to be created.
Type Changes to this property will trigger replacement. string
The type of the Cosmos DB SQL Role Definition. Possible values are BuiltInRole and CustomRole. Defaults to CustomRole. Changing this forces a new resource to be created.
AccountName Changes to this property will trigger replacement. string
The name of the Cosmos DB Account. Changing this forces a new resource to be created.
AssignableScopes []string

A list of fully qualified scopes at or below which Role Assignments may be created using this Cosmos DB SQL Role Definition. It will allow application of this Cosmos DB SQL Role Definition on the entire Database Account or any underlying Database/Collection. Scopes higher than Database Account are not enforceable as assignable scopes.

NOTE: The resources referenced in assignable scopes need not exist.

Name string
An user-friendly name for the Cosmos DB SQL Role Definition which must be unique for the Database Account.
Permissions []SqlRoleDefinitionPermissionArgs
A permissions block as defined below.
ResourceGroupName Changes to this property will trigger replacement. string
The name of the Resource Group in which the Cosmos DB SQL Role Definition is created. Changing this forces a new resource to be created.
RoleDefinitionId Changes to this property will trigger replacement. string
The GUID as the name of the Cosmos DB SQL Role Definition - one will be generated if not specified. Changing this forces a new resource to be created.
Type Changes to this property will trigger replacement. string
The type of the Cosmos DB SQL Role Definition. Possible values are BuiltInRole and CustomRole. Defaults to CustomRole. Changing this forces a new resource to be created.
accountName Changes to this property will trigger replacement. String
The name of the Cosmos DB Account. Changing this forces a new resource to be created.
assignableScopes List<String>

A list of fully qualified scopes at or below which Role Assignments may be created using this Cosmos DB SQL Role Definition. It will allow application of this Cosmos DB SQL Role Definition on the entire Database Account or any underlying Database/Collection. Scopes higher than Database Account are not enforceable as assignable scopes.

NOTE: The resources referenced in assignable scopes need not exist.

name String
An user-friendly name for the Cosmos DB SQL Role Definition which must be unique for the Database Account.
permissions List<SqlRoleDefinitionPermission>
A permissions block as defined below.
resourceGroupName Changes to this property will trigger replacement. String
The name of the Resource Group in which the Cosmos DB SQL Role Definition is created. Changing this forces a new resource to be created.
roleDefinitionId Changes to this property will trigger replacement. String
The GUID as the name of the Cosmos DB SQL Role Definition - one will be generated if not specified. Changing this forces a new resource to be created.
type Changes to this property will trigger replacement. String
The type of the Cosmos DB SQL Role Definition. Possible values are BuiltInRole and CustomRole. Defaults to CustomRole. Changing this forces a new resource to be created.
accountName Changes to this property will trigger replacement. string
The name of the Cosmos DB Account. Changing this forces a new resource to be created.
assignableScopes string[]

A list of fully qualified scopes at or below which Role Assignments may be created using this Cosmos DB SQL Role Definition. It will allow application of this Cosmos DB SQL Role Definition on the entire Database Account or any underlying Database/Collection. Scopes higher than Database Account are not enforceable as assignable scopes.

NOTE: The resources referenced in assignable scopes need not exist.

name string
An user-friendly name for the Cosmos DB SQL Role Definition which must be unique for the Database Account.
permissions SqlRoleDefinitionPermission[]
A permissions block as defined below.
resourceGroupName Changes to this property will trigger replacement. string
The name of the Resource Group in which the Cosmos DB SQL Role Definition is created. Changing this forces a new resource to be created.
roleDefinitionId Changes to this property will trigger replacement. string
The GUID as the name of the Cosmos DB SQL Role Definition - one will be generated if not specified. Changing this forces a new resource to be created.
type Changes to this property will trigger replacement. string
The type of the Cosmos DB SQL Role Definition. Possible values are BuiltInRole and CustomRole. Defaults to CustomRole. Changing this forces a new resource to be created.
account_name Changes to this property will trigger replacement. str
The name of the Cosmos DB Account. Changing this forces a new resource to be created.
assignable_scopes Sequence[str]

A list of fully qualified scopes at or below which Role Assignments may be created using this Cosmos DB SQL Role Definition. It will allow application of this Cosmos DB SQL Role Definition on the entire Database Account or any underlying Database/Collection. Scopes higher than Database Account are not enforceable as assignable scopes.

NOTE: The resources referenced in assignable scopes need not exist.

name str
An user-friendly name for the Cosmos DB SQL Role Definition which must be unique for the Database Account.
permissions Sequence[SqlRoleDefinitionPermissionArgs]
A permissions block as defined below.
resource_group_name Changes to this property will trigger replacement. str
The name of the Resource Group in which the Cosmos DB SQL Role Definition is created. Changing this forces a new resource to be created.
role_definition_id Changes to this property will trigger replacement. str
The GUID as the name of the Cosmos DB SQL Role Definition - one will be generated if not specified. Changing this forces a new resource to be created.
type Changes to this property will trigger replacement. str
The type of the Cosmos DB SQL Role Definition. Possible values are BuiltInRole and CustomRole. Defaults to CustomRole. Changing this forces a new resource to be created.
accountName Changes to this property will trigger replacement. String
The name of the Cosmos DB Account. Changing this forces a new resource to be created.
assignableScopes List<String>

A list of fully qualified scopes at or below which Role Assignments may be created using this Cosmos DB SQL Role Definition. It will allow application of this Cosmos DB SQL Role Definition on the entire Database Account or any underlying Database/Collection. Scopes higher than Database Account are not enforceable as assignable scopes.

NOTE: The resources referenced in assignable scopes need not exist.

name String
An user-friendly name for the Cosmos DB SQL Role Definition which must be unique for the Database Account.
permissions List<Property Map>
A permissions block as defined below.
resourceGroupName Changes to this property will trigger replacement. String
The name of the Resource Group in which the Cosmos DB SQL Role Definition is created. Changing this forces a new resource to be created.
roleDefinitionId Changes to this property will trigger replacement. String
The GUID as the name of the Cosmos DB SQL Role Definition - one will be generated if not specified. Changing this forces a new resource to be created.
type Changes to this property will trigger replacement. String
The type of the Cosmos DB SQL Role Definition. Possible values are BuiltInRole and CustomRole. Defaults to CustomRole. Changing this forces a new resource to be created.

Supporting Types

SqlRoleDefinitionPermission
, SqlRoleDefinitionPermissionArgs

DataActions This property is required. List<string>
A list of data actions that are allowed for the Cosmos DB SQL Role Definition.
DataActions This property is required. []string
A list of data actions that are allowed for the Cosmos DB SQL Role Definition.
dataActions This property is required. List<String>
A list of data actions that are allowed for the Cosmos DB SQL Role Definition.
dataActions This property is required. string[]
A list of data actions that are allowed for the Cosmos DB SQL Role Definition.
data_actions This property is required. Sequence[str]
A list of data actions that are allowed for the Cosmos DB SQL Role Definition.
dataActions This property is required. List<String>
A list of data actions that are allowed for the Cosmos DB SQL Role Definition.

Import

Cosmos DB SQL Role Definitions can be imported using the resource id, e.g.

$ pulumi import azure:cosmosdb/sqlRoleDefinition:SqlRoleDefinition example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DocumentDB/databaseAccounts/account1/sqlRoleDefinitions/28b3c337-f436-482b-a167-c2618dc52033
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.