Azure Classic

Pulumi Official
Package maintained by Pulumi
v5.6.0 published on Friday, May 20, 2022 by Pulumi

DatabasePrincipalAssignment

Manages a Kusto (also known as Azure Data Explorer) Database Principal Assignment.

Example Usage

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var current = Output.Create(Azure.Core.GetClientConfig.InvokeAsync());
        var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
        {
            Location = "West Europe",
        });
        var exampleCluster = new Azure.Kusto.Cluster("exampleCluster", new Azure.Kusto.ClusterArgs
        {
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            Sku = new Azure.Kusto.Inputs.ClusterSkuArgs
            {
                Name = "Standard_D13_v2",
                Capacity = 2,
            },
        });
        var exampleDatabase = new Azure.Kusto.Database("exampleDatabase", new Azure.Kusto.DatabaseArgs
        {
            ResourceGroupName = exampleResourceGroup.Name,
            Location = exampleResourceGroup.Location,
            ClusterName = exampleCluster.Name,
            HotCachePeriod = "P7D",
            SoftDeletePeriod = "P31D",
        });
        var exampleDatabasePrincipalAssignment = new Azure.Kusto.DatabasePrincipalAssignment("exampleDatabasePrincipalAssignment", new Azure.Kusto.DatabasePrincipalAssignmentArgs
        {
            ResourceGroupName = exampleResourceGroup.Name,
            ClusterName = exampleCluster.Name,
            DatabaseName = exampleDatabase.Name,
            TenantId = current.Apply(current => current.TenantId),
            PrincipalId = current.Apply(current => current.ClientId),
            PrincipalType = "App",
            Role = "Viewer",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/kusto"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := core.GetClientConfig(ctx, nil, nil)
		if err != nil {
			return err
		}
		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleCluster, err := kusto.NewCluster(ctx, "exampleCluster", &kusto.ClusterArgs{
			Location:          exampleResourceGroup.Location,
			ResourceGroupName: exampleResourceGroup.Name,
			Sku: &kusto.ClusterSkuArgs{
				Name:     pulumi.String("Standard_D13_v2"),
				Capacity: pulumi.Int(2),
			},
		})
		if err != nil {
			return err
		}
		exampleDatabase, err := kusto.NewDatabase(ctx, "exampleDatabase", &kusto.DatabaseArgs{
			ResourceGroupName: exampleResourceGroup.Name,
			Location:          exampleResourceGroup.Location,
			ClusterName:       exampleCluster.Name,
			HotCachePeriod:    pulumi.String("P7D"),
			SoftDeletePeriod:  pulumi.String("P31D"),
		})
		if err != nil {
			return err
		}
		_, err = kusto.NewDatabasePrincipalAssignment(ctx, "exampleDatabasePrincipalAssignment", &kusto.DatabasePrincipalAssignmentArgs{
			ResourceGroupName: exampleResourceGroup.Name,
			ClusterName:       exampleCluster.Name,
			DatabaseName:      exampleDatabase.Name,
			TenantId:          pulumi.String(current.TenantId),
			PrincipalId:       pulumi.String(current.ClientId),
			PrincipalType:     pulumi.String("App"),
			Role:              pulumi.String("Viewer"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

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

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

        var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
            .location("West Europe")
            .build());

        var exampleCluster = new Cluster("exampleCluster", ClusterArgs.builder()        
            .location(exampleResourceGroup.getLocation())
            .resourceGroupName(exampleResourceGroup.getName())
            .sku(ClusterSku.builder()
                .name("Standard_D13_v2")
                .capacity(2)
                .build())
            .build());

        var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()        
            .resourceGroupName(exampleResourceGroup.getName())
            .location(exampleResourceGroup.getLocation())
            .clusterName(exampleCluster.getName())
            .hotCachePeriod("P7D")
            .softDeletePeriod("P31D")
            .build());

        var exampleDatabasePrincipalAssignment = new DatabasePrincipalAssignment("exampleDatabasePrincipalAssignment", DatabasePrincipalAssignmentArgs.builder()        
            .resourceGroupName(exampleResourceGroup.getName())
            .clusterName(exampleCluster.getName())
            .databaseName(exampleDatabase.getName())
            .tenantId(current.apply(getClientConfigResult -> getClientConfigResult.getTenantId()))
            .principalId(current.apply(getClientConfigResult -> getClientConfigResult.getClientId()))
            .principalType("App")
            .role("Viewer")
            .build());

        }
}
import pulumi
import pulumi_azure as azure

current = azure.core.get_client_config()
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_cluster = azure.kusto.Cluster("exampleCluster",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    sku=azure.kusto.ClusterSkuArgs(
        name="Standard_D13_v2",
        capacity=2,
    ))
example_database = azure.kusto.Database("exampleDatabase",
    resource_group_name=example_resource_group.name,
    location=example_resource_group.location,
    cluster_name=example_cluster.name,
    hot_cache_period="P7D",
    soft_delete_period="P31D")
example_database_principal_assignment = azure.kusto.DatabasePrincipalAssignment("exampleDatabasePrincipalAssignment",
    resource_group_name=example_resource_group.name,
    cluster_name=example_cluster.name,
    database_name=example_database.name,
    tenant_id=current.tenant_id,
    principal_id=current.client_id,
    principal_type="App",
    role="Viewer")
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const current = azure.core.getClientConfig({});
const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleCluster = new azure.kusto.Cluster("exampleCluster", {
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    sku: {
        name: "Standard_D13_v2",
        capacity: 2,
    },
});
const exampleDatabase = new azure.kusto.Database("exampleDatabase", {
    resourceGroupName: exampleResourceGroup.name,
    location: exampleResourceGroup.location,
    clusterName: exampleCluster.name,
    hotCachePeriod: "P7D",
    softDeletePeriod: "P31D",
});
const exampleDatabasePrincipalAssignment = new azure.kusto.DatabasePrincipalAssignment("exampleDatabasePrincipalAssignment", {
    resourceGroupName: exampleResourceGroup.name,
    clusterName: exampleCluster.name,
    databaseName: exampleDatabase.name,
    tenantId: current.then(current => current.tenantId),
    principalId: current.then(current => current.clientId),
    principalType: "App",
    role: "Viewer",
});
resources:
  exampleResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  exampleCluster:
    type: azure:kusto:Cluster
    properties:
      location: ${exampleResourceGroup.location}
      resourceGroupName: ${exampleResourceGroup.name}
      sku:
        name: Standard_D13_v2
        capacity: 2
  exampleDatabase:
    type: azure:kusto:Database
    properties:
      resourceGroupName: ${exampleResourceGroup.name}
      location: ${exampleResourceGroup.location}
      clusterName: ${exampleCluster.name}
      hotCachePeriod: P7D
      softDeletePeriod: P31D
  exampleDatabasePrincipalAssignment:
    type: azure:kusto:DatabasePrincipalAssignment
    properties:
      resourceGroupName: ${exampleResourceGroup.name}
      clusterName: ${exampleCluster.name}
      databaseName: ${exampleDatabase.name}
      tenantId: ${current.tenantId}
      principalId: ${current.clientId}
      principalType: App
      role: Viewer
variables:
  current:
    Fn::Invoke:
      Function: azure:core:getClientConfig
      Arguments: {}

Create a DatabasePrincipalAssignment Resource

new DatabasePrincipalAssignment(name: string, args: DatabasePrincipalAssignmentArgs, opts?: CustomResourceOptions);
@overload
def DatabasePrincipalAssignment(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                cluster_name: Optional[str] = None,
                                database_name: Optional[str] = None,
                                name: Optional[str] = None,
                                principal_id: Optional[str] = None,
                                principal_type: Optional[str] = None,
                                resource_group_name: Optional[str] = None,
                                role: Optional[str] = None,
                                tenant_id: Optional[str] = None)
@overload
def DatabasePrincipalAssignment(resource_name: str,
                                args: DatabasePrincipalAssignmentArgs,
                                opts: Optional[ResourceOptions] = None)
func NewDatabasePrincipalAssignment(ctx *Context, name string, args DatabasePrincipalAssignmentArgs, opts ...ResourceOption) (*DatabasePrincipalAssignment, error)
public DatabasePrincipalAssignment(string name, DatabasePrincipalAssignmentArgs args, CustomResourceOptions? opts = null)
public DatabasePrincipalAssignment(String name, DatabasePrincipalAssignmentArgs args)
public DatabasePrincipalAssignment(String name, DatabasePrincipalAssignmentArgs args, CustomResourceOptions options)
type: azure:kusto:DatabasePrincipalAssignment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

DatabasePrincipalAssignment Resource Properties

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

Inputs

The DatabasePrincipalAssignment resource accepts the following input properties:

ClusterName string

The name of the cluster in which to create the resource. Changing this forces a new resource to be created.

DatabaseName string

The name of the database in which to create the resource. Changing this forces a new resource to be created.

PrincipalId string

The object id of the principal. Changing this forces a new resource to be created.

PrincipalType string

The type of the principal. Valid values include App, Group, User. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which to create the resource. Changing this forces a new resource to be created.

Role string

The database role assigned to the principal. Valid values include Admin, Ingestor, Monitor, UnrestrictedViewer, User and Viewer. Changing this forces a new resource to be created.

TenantId string

The tenant id in which the principal resides. Changing this forces a new resource to be created.

Name string
ClusterName string

The name of the cluster in which to create the resource. Changing this forces a new resource to be created.

DatabaseName string

The name of the database in which to create the resource. Changing this forces a new resource to be created.

PrincipalId string

The object id of the principal. Changing this forces a new resource to be created.

PrincipalType string

The type of the principal. Valid values include App, Group, User. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which to create the resource. Changing this forces a new resource to be created.

Role string

The database role assigned to the principal. Valid values include Admin, Ingestor, Monitor, UnrestrictedViewer, User and Viewer. Changing this forces a new resource to be created.

TenantId string

The tenant id in which the principal resides. Changing this forces a new resource to be created.

Name string
clusterName String

The name of the cluster in which to create the resource. Changing this forces a new resource to be created.

databaseName String

The name of the database in which to create the resource. Changing this forces a new resource to be created.

principalId String

The object id of the principal. Changing this forces a new resource to be created.

principalType String

The type of the principal. Valid values include App, Group, User. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group in which to create the resource. Changing this forces a new resource to be created.

role String

The database role assigned to the principal. Valid values include Admin, Ingestor, Monitor, UnrestrictedViewer, User and Viewer. Changing this forces a new resource to be created.

tenantId String

The tenant id in which the principal resides. Changing this forces a new resource to be created.

name String
clusterName string

The name of the cluster in which to create the resource. Changing this forces a new resource to be created.

databaseName string

The name of the database in which to create the resource. Changing this forces a new resource to be created.

principalId string

The object id of the principal. Changing this forces a new resource to be created.

principalType string

The type of the principal. Valid values include App, Group, User. Changing this forces a new resource to be created.

resourceGroupName string

The name of the resource group in which to create the resource. Changing this forces a new resource to be created.

role string

The database role assigned to the principal. Valid values include Admin, Ingestor, Monitor, UnrestrictedViewer, User and Viewer. Changing this forces a new resource to be created.

tenantId string

The tenant id in which the principal resides. Changing this forces a new resource to be created.

name string
cluster_name str

The name of the cluster in which to create the resource. Changing this forces a new resource to be created.

database_name str

The name of the database in which to create the resource. Changing this forces a new resource to be created.

principal_id str

The object id of the principal. Changing this forces a new resource to be created.

principal_type str

The type of the principal. Valid values include App, Group, User. Changing this forces a new resource to be created.

resource_group_name str

The name of the resource group in which to create the resource. Changing this forces a new resource to be created.

role str

The database role assigned to the principal. Valid values include Admin, Ingestor, Monitor, UnrestrictedViewer, User and Viewer. Changing this forces a new resource to be created.

tenant_id str

The tenant id in which the principal resides. Changing this forces a new resource to be created.

name str
clusterName String

The name of the cluster in which to create the resource. Changing this forces a new resource to be created.

databaseName String

The name of the database in which to create the resource. Changing this forces a new resource to be created.

principalId String

The object id of the principal. Changing this forces a new resource to be created.

principalType String

The type of the principal. Valid values include App, Group, User. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group in which to create the resource. Changing this forces a new resource to be created.

role String

The database role assigned to the principal. Valid values include Admin, Ingestor, Monitor, UnrestrictedViewer, User and Viewer. Changing this forces a new resource to be created.

tenantId String

The tenant id in which the principal resides. Changing this forces a new resource to be created.

name String

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

PrincipalName string

The name of the principal.

TenantName string

The name of the tenant.

Id string

The provider-assigned unique ID for this managed resource.

PrincipalName string

The name of the principal.

TenantName string

The name of the tenant.

id String

The provider-assigned unique ID for this managed resource.

principalName String

The name of the principal.

tenantName String

The name of the tenant.

id string

The provider-assigned unique ID for this managed resource.

principalName string

The name of the principal.

tenantName string

The name of the tenant.

id str

The provider-assigned unique ID for this managed resource.

principal_name str

The name of the principal.

tenant_name str

The name of the tenant.

id String

The provider-assigned unique ID for this managed resource.

principalName String

The name of the principal.

tenantName String

The name of the tenant.

Look up an Existing DatabasePrincipalAssignment Resource

Get an existing DatabasePrincipalAssignment 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?: DatabasePrincipalAssignmentState, opts?: CustomResourceOptions): DatabasePrincipalAssignment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        cluster_name: Optional[str] = None,
        database_name: Optional[str] = None,
        name: Optional[str] = None,
        principal_id: Optional[str] = None,
        principal_name: Optional[str] = None,
        principal_type: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        role: Optional[str] = None,
        tenant_id: Optional[str] = None,
        tenant_name: Optional[str] = None) -> DatabasePrincipalAssignment
func GetDatabasePrincipalAssignment(ctx *Context, name string, id IDInput, state *DatabasePrincipalAssignmentState, opts ...ResourceOption) (*DatabasePrincipalAssignment, error)
public static DatabasePrincipalAssignment Get(string name, Input<string> id, DatabasePrincipalAssignmentState? state, CustomResourceOptions? opts = null)
public static DatabasePrincipalAssignment get(String name, Output<String> id, DatabasePrincipalAssignmentState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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:
ClusterName string

The name of the cluster in which to create the resource. Changing this forces a new resource to be created.

DatabaseName string

The name of the database in which to create the resource. Changing this forces a new resource to be created.

Name string
PrincipalId string

The object id of the principal. Changing this forces a new resource to be created.

PrincipalName string

The name of the principal.

PrincipalType string

The type of the principal. Valid values include App, Group, User. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which to create the resource. Changing this forces a new resource to be created.

Role string

The database role assigned to the principal. Valid values include Admin, Ingestor, Monitor, UnrestrictedViewer, User and Viewer. Changing this forces a new resource to be created.

TenantId string

The tenant id in which the principal resides. Changing this forces a new resource to be created.

TenantName string

The name of the tenant.

ClusterName string

The name of the cluster in which to create the resource. Changing this forces a new resource to be created.

DatabaseName string

The name of the database in which to create the resource. Changing this forces a new resource to be created.

Name string
PrincipalId string

The object id of the principal. Changing this forces a new resource to be created.

PrincipalName string

The name of the principal.

PrincipalType string

The type of the principal. Valid values include App, Group, User. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which to create the resource. Changing this forces a new resource to be created.

Role string

The database role assigned to the principal. Valid values include Admin, Ingestor, Monitor, UnrestrictedViewer, User and Viewer. Changing this forces a new resource to be created.

TenantId string

The tenant id in which the principal resides. Changing this forces a new resource to be created.

TenantName string

The name of the tenant.

clusterName String

The name of the cluster in which to create the resource. Changing this forces a new resource to be created.

databaseName String

The name of the database in which to create the resource. Changing this forces a new resource to be created.

name String
principalId String

The object id of the principal. Changing this forces a new resource to be created.

principalName String

The name of the principal.

principalType String

The type of the principal. Valid values include App, Group, User. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group in which to create the resource. Changing this forces a new resource to be created.

role String

The database role assigned to the principal. Valid values include Admin, Ingestor, Monitor, UnrestrictedViewer, User and Viewer. Changing this forces a new resource to be created.

tenantId String

The tenant id in which the principal resides. Changing this forces a new resource to be created.

tenantName String

The name of the tenant.

clusterName string

The name of the cluster in which to create the resource. Changing this forces a new resource to be created.

databaseName string

The name of the database in which to create the resource. Changing this forces a new resource to be created.

name string
principalId string

The object id of the principal. Changing this forces a new resource to be created.

principalName string

The name of the principal.

principalType string

The type of the principal. Valid values include App, Group, User. Changing this forces a new resource to be created.

resourceGroupName string

The name of the resource group in which to create the resource. Changing this forces a new resource to be created.

role string

The database role assigned to the principal. Valid values include Admin, Ingestor, Monitor, UnrestrictedViewer, User and Viewer. Changing this forces a new resource to be created.

tenantId string

The tenant id in which the principal resides. Changing this forces a new resource to be created.

tenantName string

The name of the tenant.

cluster_name str

The name of the cluster in which to create the resource. Changing this forces a new resource to be created.

database_name str

The name of the database in which to create the resource. Changing this forces a new resource to be created.

name str
principal_id str

The object id of the principal. Changing this forces a new resource to be created.

principal_name str

The name of the principal.

principal_type str

The type of the principal. Valid values include App, Group, User. Changing this forces a new resource to be created.

resource_group_name str

The name of the resource group in which to create the resource. Changing this forces a new resource to be created.

role str

The database role assigned to the principal. Valid values include Admin, Ingestor, Monitor, UnrestrictedViewer, User and Viewer. Changing this forces a new resource to be created.

tenant_id str

The tenant id in which the principal resides. Changing this forces a new resource to be created.

tenant_name str

The name of the tenant.

clusterName String

The name of the cluster in which to create the resource. Changing this forces a new resource to be created.

databaseName String

The name of the database in which to create the resource. Changing this forces a new resource to be created.

name String
principalId String

The object id of the principal. Changing this forces a new resource to be created.

principalName String

The name of the principal.

principalType String

The type of the principal. Valid values include App, Group, User. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group in which to create the resource. Changing this forces a new resource to be created.

role String

The database role assigned to the principal. Valid values include Admin, Ingestor, Monitor, UnrestrictedViewer, User and Viewer. Changing this forces a new resource to be created.

tenantId String

The tenant id in which the principal resides. Changing this forces a new resource to be created.

tenantName String

The name of the tenant.

Import

Kusto Database Principal Assignment can be imported using the resource id, e.g.

 $ pulumi import azure:kusto/databasePrincipalAssignment:DatabasePrincipalAssignment example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Kusto/Clusters/cluster1/Databases/database1/PrincipalAssignments/assignment1

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.