We recommend using Azure Native.
azure.kusto.CosmosdbDataConnection
Explore with Pulumi AI
Manages a Kusto / Cosmos Database Data Connection.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var current = Azure.Core.GetClientConfig.Invoke();
var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
{
Location = "West Europe",
});
var builtin = Azure.Authorization.GetRoleDefinition.Invoke(new()
{
RoleDefinitionId = "fbdf93bf-df7d-467e-a4d2-9458aa1360c8",
});
var exampleCluster = new Azure.Kusto.Cluster("exampleCluster", new()
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
Sku = new Azure.Kusto.Inputs.ClusterSkuArgs
{
Name = "Dev(No SLA)_Standard_D11_v2",
Capacity = 1,
},
Identity = new Azure.Kusto.Inputs.ClusterIdentityArgs
{
Type = "SystemAssigned",
},
});
var exampleAssignment = new Azure.Authorization.Assignment("exampleAssignment", new()
{
Scope = exampleResourceGroup.Id,
RoleDefinitionName = builtin.Apply(getRoleDefinitionResult => getRoleDefinitionResult.Name),
PrincipalId = exampleCluster.Identity.Apply(identity => identity?.PrincipalId),
});
var exampleAccount = new Azure.CosmosDB.Account("exampleAccount", new()
{
Location = exampleResourceGroup.Location,
ResourceGroupName = exampleResourceGroup.Name,
OfferType = "Standard",
Kind = "GlobalDocumentDB",
ConsistencyPolicy = new Azure.CosmosDB.Inputs.AccountConsistencyPolicyArgs
{
ConsistencyLevel = "Session",
MaxIntervalInSeconds = 5,
MaxStalenessPrefix = 100,
},
GeoLocations = new[]
{
new Azure.CosmosDB.Inputs.AccountGeoLocationArgs
{
Location = exampleResourceGroup.Location,
FailoverPriority = 0,
},
},
});
var exampleSqlDatabase = new Azure.CosmosDB.SqlDatabase("exampleSqlDatabase", new()
{
ResourceGroupName = exampleAccount.ResourceGroupName,
AccountName = exampleAccount.Name,
});
var exampleSqlContainer = new Azure.CosmosDB.SqlContainer("exampleSqlContainer", new()
{
ResourceGroupName = exampleAccount.ResourceGroupName,
AccountName = exampleAccount.Name,
DatabaseName = exampleSqlDatabase.Name,
PartitionKeyPath = "/part",
Throughput = 400,
});
var exampleSqlRoleDefinition = Azure.CosmosDB.GetSqlRoleDefinition.Invoke(new()
{
RoleDefinitionId = "00000000-0000-0000-0000-000000000001",
ResourceGroupName = exampleResourceGroup.Name,
AccountName = exampleAccount.Name,
});
var exampleSqlRoleAssignment = new Azure.CosmosDB.SqlRoleAssignment("exampleSqlRoleAssignment", new()
{
ResourceGroupName = exampleResourceGroup.Name,
AccountName = exampleAccount.Name,
RoleDefinitionId = exampleSqlRoleDefinition.Apply(getSqlRoleDefinitionResult => getSqlRoleDefinitionResult.Id),
PrincipalId = exampleCluster.Identity.Apply(identity => identity?.PrincipalId),
Scope = exampleAccount.Id,
});
var exampleDatabase = new Azure.Kusto.Database("exampleDatabase", new()
{
ResourceGroupName = exampleResourceGroup.Name,
Location = exampleResourceGroup.Location,
ClusterName = exampleCluster.Name,
});
var exampleScript = new Azure.Kusto.Script("exampleScript", new()
{
DatabaseId = exampleDatabase.Id,
ScriptContent = @".create table TestTable(Id:string, Name:string, _ts:long, _timestamp:datetime)
.create table TestTable ingestion json mapping ""TestMapping""
'['
' {""column"":""Id"",""path"":""$.id""},'
' {""column"":""Name"",""path"":""$.name""},'
' {""column"":""_ts"",""path"":""$._ts""},'
' {""column"":""_timestamp"",""path"":""$._ts"", ""transform"":""DateTimeFromUnixSeconds""}'
']'
.alter table TestTable policy ingestionbatching ""{'MaximumBatchingTimeSpan': '0:0:10', 'MaximumNumberOfItems': 10000}""
",
});
var exampleCosmosdbDataConnection = new Azure.Kusto.CosmosdbDataConnection("exampleCosmosdbDataConnection", new()
{
Location = exampleResourceGroup.Location,
CosmosdbContainerId = exampleSqlContainer.Id,
KustoDatabaseId = exampleDatabase.Id,
ManagedIdentityId = exampleCluster.Id,
TableName = "TestTable",
MappingRuleName = "TestMapping",
RetrievalStartDate = "2023-06-26T12:00:00.6554616Z",
});
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/authorization"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/cosmosdb"
"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 {
_, 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
}
builtin, err := authorization.LookupRoleDefinition(ctx, &authorization.LookupRoleDefinitionArgs{
RoleDefinitionId: pulumi.StringRef("fbdf93bf-df7d-467e-a4d2-9458aa1360c8"),
}, nil)
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("Dev(No SLA)_Standard_D11_v2"),
Capacity: pulumi.Int(1),
},
Identity: &kusto.ClusterIdentityArgs{
Type: pulumi.String("SystemAssigned"),
},
})
if err != nil {
return err
}
_, err = authorization.NewAssignment(ctx, "exampleAssignment", &authorization.AssignmentArgs{
Scope: exampleResourceGroup.ID(),
RoleDefinitionName: *pulumi.String(builtin.Name),
PrincipalId: exampleCluster.Identity.ApplyT(func(identity kusto.ClusterIdentity) (*string, error) {
return &identity.PrincipalId, nil
}).(pulumi.StringPtrOutput),
})
if err != nil {
return err
}
exampleAccount, err := cosmosdb.NewAccount(ctx, "exampleAccount", &cosmosdb.AccountArgs{
Location: exampleResourceGroup.Location,
ResourceGroupName: exampleResourceGroup.Name,
OfferType: pulumi.String("Standard"),
Kind: pulumi.String("GlobalDocumentDB"),
ConsistencyPolicy: &cosmosdb.AccountConsistencyPolicyArgs{
ConsistencyLevel: pulumi.String("Session"),
MaxIntervalInSeconds: pulumi.Int(5),
MaxStalenessPrefix: pulumi.Int(100),
},
GeoLocations: cosmosdb.AccountGeoLocationArray{
&cosmosdb.AccountGeoLocationArgs{
Location: exampleResourceGroup.Location,
FailoverPriority: pulumi.Int(0),
},
},
})
if err != nil {
return err
}
exampleSqlDatabase, err := cosmosdb.NewSqlDatabase(ctx, "exampleSqlDatabase", &cosmosdb.SqlDatabaseArgs{
ResourceGroupName: exampleAccount.ResourceGroupName,
AccountName: exampleAccount.Name,
})
if err != nil {
return err
}
exampleSqlContainer, err := cosmosdb.NewSqlContainer(ctx, "exampleSqlContainer", &cosmosdb.SqlContainerArgs{
ResourceGroupName: exampleAccount.ResourceGroupName,
AccountName: exampleAccount.Name,
DatabaseName: exampleSqlDatabase.Name,
PartitionKeyPath: pulumi.String("/part"),
Throughput: pulumi.Int(400),
})
if err != nil {
return err
}
exampleSqlRoleDefinition := cosmosdb.LookupSqlRoleDefinitionOutput(ctx, cosmosdb.GetSqlRoleDefinitionOutputArgs{
RoleDefinitionId: pulumi.String("00000000-0000-0000-0000-000000000001"),
ResourceGroupName: exampleResourceGroup.Name,
AccountName: exampleAccount.Name,
}, nil)
_, err = cosmosdb.NewSqlRoleAssignment(ctx, "exampleSqlRoleAssignment", &cosmosdb.SqlRoleAssignmentArgs{
ResourceGroupName: exampleResourceGroup.Name,
AccountName: exampleAccount.Name,
RoleDefinitionId: exampleSqlRoleDefinition.ApplyT(func(exampleSqlRoleDefinition cosmosdb.GetSqlRoleDefinitionResult) (*string, error) {
return &exampleSqlRoleDefinition.Id, nil
}).(pulumi.StringPtrOutput),
PrincipalId: exampleCluster.Identity.ApplyT(func(identity kusto.ClusterIdentity) (*string, error) {
return &identity.PrincipalId, nil
}).(pulumi.StringPtrOutput),
Scope: exampleAccount.ID(),
})
if err != nil {
return err
}
exampleDatabase, err := kusto.NewDatabase(ctx, "exampleDatabase", &kusto.DatabaseArgs{
ResourceGroupName: exampleResourceGroup.Name,
Location: exampleResourceGroup.Location,
ClusterName: exampleCluster.Name,
})
if err != nil {
return err
}
_, err = kusto.NewScript(ctx, "exampleScript", &kusto.ScriptArgs{
DatabaseId: exampleDatabase.ID(),
ScriptContent: pulumi.String(`.create table TestTable(Id:string, Name:string, _ts:long, _timestamp:datetime)
.create table TestTable ingestion json mapping "TestMapping"
'['
' {"column":"Id","path":"$.id"},'
' {"column":"Name","path":"$.name"},'
' {"column":"_ts","path":"$._ts"},'
' {"column":"_timestamp","path":"$._ts", "transform":"DateTimeFromUnixSeconds"}'
']'
.alter table TestTable policy ingestionbatching "{'MaximumBatchingTimeSpan': '0:0:10', 'MaximumNumberOfItems': 10000}"
`),
})
if err != nil {
return err
}
_, err = kusto.NewCosmosdbDataConnection(ctx, "exampleCosmosdbDataConnection", &kusto.CosmosdbDataConnectionArgs{
Location: exampleResourceGroup.Location,
CosmosdbContainerId: exampleSqlContainer.ID(),
KustoDatabaseId: exampleDatabase.ID(),
ManagedIdentityId: exampleCluster.ID(),
TableName: pulumi.String("TestTable"),
MappingRuleName: pulumi.String("TestMapping"),
RetrievalStartDate: pulumi.String("2023-06-26T12:00:00.6554616Z"),
})
if err != nil {
return err
}
return nil
})
}
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.authorization.AuthorizationFunctions;
import com.pulumi.azure.authorization.inputs.GetRoleDefinitionArgs;
import com.pulumi.azure.kusto.Cluster;
import com.pulumi.azure.kusto.ClusterArgs;
import com.pulumi.azure.kusto.inputs.ClusterSkuArgs;
import com.pulumi.azure.kusto.inputs.ClusterIdentityArgs;
import com.pulumi.azure.authorization.Assignment;
import com.pulumi.azure.authorization.AssignmentArgs;
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.SqlDatabase;
import com.pulumi.azure.cosmosdb.SqlDatabaseArgs;
import com.pulumi.azure.cosmosdb.SqlContainer;
import com.pulumi.azure.cosmosdb.SqlContainerArgs;
import com.pulumi.azure.cosmosdb.CosmosdbFunctions;
import com.pulumi.azure.cosmosdb.inputs.GetSqlRoleDefinitionArgs;
import com.pulumi.azure.cosmosdb.SqlRoleAssignment;
import com.pulumi.azure.cosmosdb.SqlRoleAssignmentArgs;
import com.pulumi.azure.kusto.Database;
import com.pulumi.azure.kusto.DatabaseArgs;
import com.pulumi.azure.kusto.Script;
import com.pulumi.azure.kusto.ScriptArgs;
import com.pulumi.azure.kusto.CosmosdbDataConnection;
import com.pulumi.azure.kusto.CosmosdbDataConnectionArgs;
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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.location("West Europe")
.build());
final var builtin = AuthorizationFunctions.getRoleDefinition(GetRoleDefinitionArgs.builder()
.roleDefinitionId("fbdf93bf-df7d-467e-a4d2-9458aa1360c8")
.build());
var exampleCluster = new Cluster("exampleCluster", ClusterArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.sku(ClusterSkuArgs.builder()
.name("Dev(No SLA)_Standard_D11_v2")
.capacity(1)
.build())
.identity(ClusterIdentityArgs.builder()
.type("SystemAssigned")
.build())
.build());
var exampleAssignment = new Assignment("exampleAssignment", AssignmentArgs.builder()
.scope(exampleResourceGroup.id())
.roleDefinitionName(builtin.applyValue(getRoleDefinitionResult -> getRoleDefinitionResult.name()))
.principalId(exampleCluster.identity().applyValue(identity -> identity.principalId()))
.build());
var exampleAccount = new Account("exampleAccount", AccountArgs.builder()
.location(exampleResourceGroup.location())
.resourceGroupName(exampleResourceGroup.name())
.offerType("Standard")
.kind("GlobalDocumentDB")
.consistencyPolicy(AccountConsistencyPolicyArgs.builder()
.consistencyLevel("Session")
.maxIntervalInSeconds(5)
.maxStalenessPrefix(100)
.build())
.geoLocations(AccountGeoLocationArgs.builder()
.location(exampleResourceGroup.location())
.failoverPriority(0)
.build())
.build());
var exampleSqlDatabase = new SqlDatabase("exampleSqlDatabase", SqlDatabaseArgs.builder()
.resourceGroupName(exampleAccount.resourceGroupName())
.accountName(exampleAccount.name())
.build());
var exampleSqlContainer = new SqlContainer("exampleSqlContainer", SqlContainerArgs.builder()
.resourceGroupName(exampleAccount.resourceGroupName())
.accountName(exampleAccount.name())
.databaseName(exampleSqlDatabase.name())
.partitionKeyPath("/part")
.throughput(400)
.build());
final var exampleSqlRoleDefinition = CosmosdbFunctions.getSqlRoleDefinition(GetSqlRoleDefinitionArgs.builder()
.roleDefinitionId("00000000-0000-0000-0000-000000000001")
.resourceGroupName(exampleResourceGroup.name())
.accountName(exampleAccount.name())
.build());
var exampleSqlRoleAssignment = new SqlRoleAssignment("exampleSqlRoleAssignment", SqlRoleAssignmentArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.accountName(exampleAccount.name())
.roleDefinitionId(exampleSqlRoleDefinition.applyValue(getSqlRoleDefinitionResult -> getSqlRoleDefinitionResult).applyValue(exampleSqlRoleDefinition -> exampleSqlRoleDefinition.applyValue(getSqlRoleDefinitionResult -> getSqlRoleDefinitionResult.id())))
.principalId(exampleCluster.identity().applyValue(identity -> identity.principalId()))
.scope(exampleAccount.id())
.build());
var exampleDatabase = new Database("exampleDatabase", DatabaseArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.clusterName(exampleCluster.name())
.build());
var exampleScript = new Script("exampleScript", ScriptArgs.builder()
.databaseId(exampleDatabase.id())
.scriptContent("""
.create table TestTable(Id:string, Name:string, _ts:long, _timestamp:datetime)
.create table TestTable ingestion json mapping "TestMapping"
'['
' {"column":"Id","path":"$.id"},'
' {"column":"Name","path":"$.name"},'
' {"column":"_ts","path":"$._ts"},'
' {"column":"_timestamp","path":"$._ts", "transform":"DateTimeFromUnixSeconds"}'
']'
.alter table TestTable policy ingestionbatching "{'MaximumBatchingTimeSpan': '0:0:10', 'MaximumNumberOfItems': 10000}"
""")
.build());
var exampleCosmosdbDataConnection = new CosmosdbDataConnection("exampleCosmosdbDataConnection", CosmosdbDataConnectionArgs.builder()
.location(exampleResourceGroup.location())
.cosmosdbContainerId(exampleSqlContainer.id())
.kustoDatabaseId(exampleDatabase.id())
.managedIdentityId(exampleCluster.id())
.tableName("TestTable")
.mappingRuleName("TestMapping")
.retrievalStartDate("2023-06-26T12:00:00.6554616Z")
.build());
}
}
import pulumi
import pulumi_azure as azure
current = azure.core.get_client_config()
example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
builtin = azure.authorization.get_role_definition(role_definition_id="fbdf93bf-df7d-467e-a4d2-9458aa1360c8")
example_cluster = azure.kusto.Cluster("exampleCluster",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
sku=azure.kusto.ClusterSkuArgs(
name="Dev(No SLA)_Standard_D11_v2",
capacity=1,
),
identity=azure.kusto.ClusterIdentityArgs(
type="SystemAssigned",
))
example_assignment = azure.authorization.Assignment("exampleAssignment",
scope=example_resource_group.id,
role_definition_name=builtin.name,
principal_id=example_cluster.identity.principal_id)
example_account = azure.cosmosdb.Account("exampleAccount",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
offer_type="Standard",
kind="GlobalDocumentDB",
consistency_policy=azure.cosmosdb.AccountConsistencyPolicyArgs(
consistency_level="Session",
max_interval_in_seconds=5,
max_staleness_prefix=100,
),
geo_locations=[azure.cosmosdb.AccountGeoLocationArgs(
location=example_resource_group.location,
failover_priority=0,
)])
example_sql_database = azure.cosmosdb.SqlDatabase("exampleSqlDatabase",
resource_group_name=example_account.resource_group_name,
account_name=example_account.name)
example_sql_container = azure.cosmosdb.SqlContainer("exampleSqlContainer",
resource_group_name=example_account.resource_group_name,
account_name=example_account.name,
database_name=example_sql_database.name,
partition_key_path="/part",
throughput=400)
example_sql_role_definition = azure.cosmosdb.get_sql_role_definition_output(role_definition_id="00000000-0000-0000-0000-000000000001",
resource_group_name=example_resource_group.name,
account_name=example_account.name)
example_sql_role_assignment = azure.cosmosdb.SqlRoleAssignment("exampleSqlRoleAssignment",
resource_group_name=example_resource_group.name,
account_name=example_account.name,
role_definition_id=example_sql_role_definition.id,
principal_id=example_cluster.identity.principal_id,
scope=example_account.id)
example_database = azure.kusto.Database("exampleDatabase",
resource_group_name=example_resource_group.name,
location=example_resource_group.location,
cluster_name=example_cluster.name)
example_script = azure.kusto.Script("exampleScript",
database_id=example_database.id,
script_content=""".create table TestTable(Id:string, Name:string, _ts:long, _timestamp:datetime)
.create table TestTable ingestion json mapping "TestMapping"
'['
' {"column":"Id","path":"$.id"},'
' {"column":"Name","path":"$.name"},'
' {"column":"_ts","path":"$._ts"},'
' {"column":"_timestamp","path":"$._ts", "transform":"DateTimeFromUnixSeconds"}'
']'
.alter table TestTable policy ingestionbatching "{'MaximumBatchingTimeSpan': '0:0:10', 'MaximumNumberOfItems': 10000}"
""")
example_cosmosdb_data_connection = azure.kusto.CosmosdbDataConnection("exampleCosmosdbDataConnection",
location=example_resource_group.location,
cosmosdb_container_id=example_sql_container.id,
kusto_database_id=example_database.id,
managed_identity_id=example_cluster.id,
table_name="TestTable",
mapping_rule_name="TestMapping",
retrieval_start_date="2023-06-26T12:00:00.6554616Z")
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 builtin = azure.authorization.getRoleDefinition({
roleDefinitionId: "fbdf93bf-df7d-467e-a4d2-9458aa1360c8",
});
const exampleCluster = new azure.kusto.Cluster("exampleCluster", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
sku: {
name: "Dev(No SLA)_Standard_D11_v2",
capacity: 1,
},
identity: {
type: "SystemAssigned",
},
});
const exampleAssignment = new azure.authorization.Assignment("exampleAssignment", {
scope: exampleResourceGroup.id,
roleDefinitionName: builtin.then(builtin => builtin.name),
principalId: exampleCluster.identity.apply(identity => identity?.principalId),
});
const exampleAccount = new azure.cosmosdb.Account("exampleAccount", {
location: exampleResourceGroup.location,
resourceGroupName: exampleResourceGroup.name,
offerType: "Standard",
kind: "GlobalDocumentDB",
consistencyPolicy: {
consistencyLevel: "Session",
maxIntervalInSeconds: 5,
maxStalenessPrefix: 100,
},
geoLocations: [{
location: exampleResourceGroup.location,
failoverPriority: 0,
}],
});
const exampleSqlDatabase = new azure.cosmosdb.SqlDatabase("exampleSqlDatabase", {
resourceGroupName: exampleAccount.resourceGroupName,
accountName: exampleAccount.name,
});
const exampleSqlContainer = new azure.cosmosdb.SqlContainer("exampleSqlContainer", {
resourceGroupName: exampleAccount.resourceGroupName,
accountName: exampleAccount.name,
databaseName: exampleSqlDatabase.name,
partitionKeyPath: "/part",
throughput: 400,
});
const exampleSqlRoleDefinition = azure.cosmosdb.getSqlRoleDefinitionOutput({
roleDefinitionId: "00000000-0000-0000-0000-000000000001",
resourceGroupName: exampleResourceGroup.name,
accountName: exampleAccount.name,
});
const exampleSqlRoleAssignment = new azure.cosmosdb.SqlRoleAssignment("exampleSqlRoleAssignment", {
resourceGroupName: exampleResourceGroup.name,
accountName: exampleAccount.name,
roleDefinitionId: exampleSqlRoleDefinition.apply(exampleSqlRoleDefinition => exampleSqlRoleDefinition.id),
principalId: exampleCluster.identity.apply(identity => identity?.principalId),
scope: exampleAccount.id,
});
const exampleDatabase = new azure.kusto.Database("exampleDatabase", {
resourceGroupName: exampleResourceGroup.name,
location: exampleResourceGroup.location,
clusterName: exampleCluster.name,
});
const exampleScript = new azure.kusto.Script("exampleScript", {
databaseId: exampleDatabase.id,
scriptContent: `.create table TestTable(Id:string, Name:string, _ts:long, _timestamp:datetime)
.create table TestTable ingestion json mapping "TestMapping"
'['
' {"column":"Id","path":"$.id"},'
' {"column":"Name","path":"$.name"},'
' {"column":"_ts","path":"$._ts"},'
' {"column":"_timestamp","path":"$._ts", "transform":"DateTimeFromUnixSeconds"}'
']'
.alter table TestTable policy ingestionbatching "{'MaximumBatchingTimeSpan': '0:0:10', 'MaximumNumberOfItems': 10000}"
`,
});
const exampleCosmosdbDataConnection = new azure.kusto.CosmosdbDataConnection("exampleCosmosdbDataConnection", {
location: exampleResourceGroup.location,
cosmosdbContainerId: exampleSqlContainer.id,
kustoDatabaseId: exampleDatabase.id,
managedIdentityId: exampleCluster.id,
tableName: "TestTable",
mappingRuleName: "TestMapping",
retrievalStartDate: "2023-06-26T12:00:00.6554616Z",
});
resources:
exampleResourceGroup:
type: azure:core:ResourceGroup
properties:
location: West Europe
exampleAssignment:
type: azure:authorization:Assignment
properties:
scope: ${exampleResourceGroup.id}
roleDefinitionName: ${builtin.name}
principalId: ${exampleCluster.identity.principalId}
exampleAccount:
type: azure:cosmosdb:Account
properties:
location: ${exampleResourceGroup.location}
resourceGroupName: ${exampleResourceGroup.name}
offerType: Standard
kind: GlobalDocumentDB
consistencyPolicy:
consistencyLevel: Session
maxIntervalInSeconds: 5
maxStalenessPrefix: 100
geoLocations:
- location: ${exampleResourceGroup.location}
failoverPriority: 0
exampleSqlDatabase:
type: azure:cosmosdb:SqlDatabase
properties:
resourceGroupName: ${exampleAccount.resourceGroupName}
accountName: ${exampleAccount.name}
exampleSqlContainer:
type: azure:cosmosdb:SqlContainer
properties:
resourceGroupName: ${exampleAccount.resourceGroupName}
accountName: ${exampleAccount.name}
databaseName: ${exampleSqlDatabase.name}
partitionKeyPath: /part
throughput: 400
exampleSqlRoleAssignment:
type: azure:cosmosdb:SqlRoleAssignment
properties:
resourceGroupName: ${exampleResourceGroup.name}
accountName: ${exampleAccount.name}
roleDefinitionId: ${exampleSqlRoleDefinition.id}
principalId: ${exampleCluster.identity.principalId}
scope: ${exampleAccount.id}
exampleCluster:
type: azure:kusto:Cluster
properties:
location: ${exampleResourceGroup.location}
resourceGroupName: ${exampleResourceGroup.name}
sku:
name: Dev(No SLA)_Standard_D11_v2
capacity: 1
identity:
type: SystemAssigned
exampleDatabase:
type: azure:kusto:Database
properties:
resourceGroupName: ${exampleResourceGroup.name}
location: ${exampleResourceGroup.location}
clusterName: ${exampleCluster.name}
exampleScript:
type: azure:kusto:Script
properties:
databaseId: ${exampleDatabase.id}
scriptContent: |
.create table TestTable(Id:string, Name:string, _ts:long, _timestamp:datetime)
.create table TestTable ingestion json mapping "TestMapping"
'['
' {"column":"Id","path":"$.id"},'
' {"column":"Name","path":"$.name"},'
' {"column":"_ts","path":"$._ts"},'
' {"column":"_timestamp","path":"$._ts", "transform":"DateTimeFromUnixSeconds"}'
']'
.alter table TestTable policy ingestionbatching "{'MaximumBatchingTimeSpan': '0:0:10', 'MaximumNumberOfItems': 10000}"
exampleCosmosdbDataConnection:
type: azure:kusto:CosmosdbDataConnection
properties:
location: ${exampleResourceGroup.location}
cosmosdbContainerId: ${exampleSqlContainer.id}
kustoDatabaseId: ${exampleDatabase.id}
managedIdentityId: ${exampleCluster.id}
tableName: TestTable
mappingRuleName: TestMapping
retrievalStartDate: 2023-06-26T12:00:00.6554616Z
variables:
current:
fn::invoke:
Function: azure:core:getClientConfig
Arguments: {}
builtin:
fn::invoke:
Function: azure:authorization:getRoleDefinition
Arguments:
roleDefinitionId: fbdf93bf-df7d-467e-a4d2-9458aa1360c8
exampleSqlRoleDefinition:
fn::invoke:
Function: azure:cosmosdb:getSqlRoleDefinition
Arguments:
roleDefinitionId: 00000000-0000-0000-0000-000000000001
resourceGroupName: ${exampleResourceGroup.name}
accountName: ${exampleAccount.name}
Create CosmosdbDataConnection Resource
new CosmosdbDataConnection(name: string, args: CosmosdbDataConnectionArgs, opts?: CustomResourceOptions);
@overload
def CosmosdbDataConnection(resource_name: str,
opts: Optional[ResourceOptions] = None,
cosmosdb_container_id: Optional[str] = None,
kusto_database_id: Optional[str] = None,
location: Optional[str] = None,
managed_identity_id: Optional[str] = None,
mapping_rule_name: Optional[str] = None,
name: Optional[str] = None,
retrieval_start_date: Optional[str] = None,
table_name: Optional[str] = None)
@overload
def CosmosdbDataConnection(resource_name: str,
args: CosmosdbDataConnectionArgs,
opts: Optional[ResourceOptions] = None)
func NewCosmosdbDataConnection(ctx *Context, name string, args CosmosdbDataConnectionArgs, opts ...ResourceOption) (*CosmosdbDataConnection, error)
public CosmosdbDataConnection(string name, CosmosdbDataConnectionArgs args, CustomResourceOptions? opts = null)
public CosmosdbDataConnection(String name, CosmosdbDataConnectionArgs args)
public CosmosdbDataConnection(String name, CosmosdbDataConnectionArgs args, CustomResourceOptions options)
type: azure:kusto:CosmosdbDataConnection
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CosmosdbDataConnectionArgs
- 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 CosmosdbDataConnectionArgs
- 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 CosmosdbDataConnectionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args CosmosdbDataConnectionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args CosmosdbDataConnectionArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
CosmosdbDataConnection 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 CosmosdbDataConnection resource accepts the following input properties:
- Cosmosdb
Container stringId The name of an existing container in the Cosmos DB database. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Kusto
Database stringId The name of the database in the Kusto cluster. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Managed
Identity stringId The resource ID of a managed system or user-assigned identity. The identity is used to authenticate with Cosmos DB. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Table
Name string The case-sensitive name of the existing target table in your cluster. Retrieved data is ingested into this table. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Location string
The Azure Region where the Data Explorer should exist. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Mapping
Rule stringName The name of an existing mapping rule to use when ingesting the retrieved data. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Name string
The name of the data connection. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Retrieval
Start stringDate If defined, the data connection retrieves Cosmos DB documents created or updated after the specified retrieval start date. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Cosmosdb
Container stringId The name of an existing container in the Cosmos DB database. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Kusto
Database stringId The name of the database in the Kusto cluster. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Managed
Identity stringId The resource ID of a managed system or user-assigned identity. The identity is used to authenticate with Cosmos DB. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Table
Name string The case-sensitive name of the existing target table in your cluster. Retrieved data is ingested into this table. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Location string
The Azure Region where the Data Explorer should exist. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Mapping
Rule stringName The name of an existing mapping rule to use when ingesting the retrieved data. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Name string
The name of the data connection. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Retrieval
Start stringDate If defined, the data connection retrieves Cosmos DB documents created or updated after the specified retrieval start date. Changing this forces a new Kusto Cosmos DB Connection to be created.
- cosmosdb
Container StringId The name of an existing container in the Cosmos DB database. Changing this forces a new Kusto Cosmos DB Connection to be created.
- kusto
Database StringId The name of the database in the Kusto cluster. Changing this forces a new Kusto Cosmos DB Connection to be created.
- managed
Identity StringId The resource ID of a managed system or user-assigned identity. The identity is used to authenticate with Cosmos DB. Changing this forces a new Kusto Cosmos DB Connection to be created.
- table
Name String The case-sensitive name of the existing target table in your cluster. Retrieved data is ingested into this table. Changing this forces a new Kusto Cosmos DB Connection to be created.
- location String
The Azure Region where the Data Explorer should exist. Changing this forces a new Kusto Cosmos DB Connection to be created.
- mapping
Rule StringName The name of an existing mapping rule to use when ingesting the retrieved data. Changing this forces a new Kusto Cosmos DB Connection to be created.
- name String
The name of the data connection. Changing this forces a new Kusto Cosmos DB Connection to be created.
- retrieval
Start StringDate If defined, the data connection retrieves Cosmos DB documents created or updated after the specified retrieval start date. Changing this forces a new Kusto Cosmos DB Connection to be created.
- cosmosdb
Container stringId The name of an existing container in the Cosmos DB database. Changing this forces a new Kusto Cosmos DB Connection to be created.
- kusto
Database stringId The name of the database in the Kusto cluster. Changing this forces a new Kusto Cosmos DB Connection to be created.
- managed
Identity stringId The resource ID of a managed system or user-assigned identity. The identity is used to authenticate with Cosmos DB. Changing this forces a new Kusto Cosmos DB Connection to be created.
- table
Name string The case-sensitive name of the existing target table in your cluster. Retrieved data is ingested into this table. Changing this forces a new Kusto Cosmos DB Connection to be created.
- location string
The Azure Region where the Data Explorer should exist. Changing this forces a new Kusto Cosmos DB Connection to be created.
- mapping
Rule stringName The name of an existing mapping rule to use when ingesting the retrieved data. Changing this forces a new Kusto Cosmos DB Connection to be created.
- name string
The name of the data connection. Changing this forces a new Kusto Cosmos DB Connection to be created.
- retrieval
Start stringDate If defined, the data connection retrieves Cosmos DB documents created or updated after the specified retrieval start date. Changing this forces a new Kusto Cosmos DB Connection to be created.
- cosmosdb_
container_ strid The name of an existing container in the Cosmos DB database. Changing this forces a new Kusto Cosmos DB Connection to be created.
- kusto_
database_ strid The name of the database in the Kusto cluster. Changing this forces a new Kusto Cosmos DB Connection to be created.
- managed_
identity_ strid The resource ID of a managed system or user-assigned identity. The identity is used to authenticate with Cosmos DB. Changing this forces a new Kusto Cosmos DB Connection to be created.
- table_
name str The case-sensitive name of the existing target table in your cluster. Retrieved data is ingested into this table. Changing this forces a new Kusto Cosmos DB Connection to be created.
- location str
The Azure Region where the Data Explorer should exist. Changing this forces a new Kusto Cosmos DB Connection to be created.
- mapping_
rule_ strname The name of an existing mapping rule to use when ingesting the retrieved data. Changing this forces a new Kusto Cosmos DB Connection to be created.
- name str
The name of the data connection. Changing this forces a new Kusto Cosmos DB Connection to be created.
- retrieval_
start_ strdate If defined, the data connection retrieves Cosmos DB documents created or updated after the specified retrieval start date. Changing this forces a new Kusto Cosmos DB Connection to be created.
- cosmosdb
Container StringId The name of an existing container in the Cosmos DB database. Changing this forces a new Kusto Cosmos DB Connection to be created.
- kusto
Database StringId The name of the database in the Kusto cluster. Changing this forces a new Kusto Cosmos DB Connection to be created.
- managed
Identity StringId The resource ID of a managed system or user-assigned identity. The identity is used to authenticate with Cosmos DB. Changing this forces a new Kusto Cosmos DB Connection to be created.
- table
Name String The case-sensitive name of the existing target table in your cluster. Retrieved data is ingested into this table. Changing this forces a new Kusto Cosmos DB Connection to be created.
- location String
The Azure Region where the Data Explorer should exist. Changing this forces a new Kusto Cosmos DB Connection to be created.
- mapping
Rule StringName The name of an existing mapping rule to use when ingesting the retrieved data. Changing this forces a new Kusto Cosmos DB Connection to be created.
- name String
The name of the data connection. Changing this forces a new Kusto Cosmos DB Connection to be created.
- retrieval
Start StringDate If defined, the data connection retrieves Cosmos DB documents created or updated after the specified retrieval start date. Changing this forces a new Kusto Cosmos DB Connection to be created.
Outputs
All input properties are implicitly available as output properties. Additionally, the CosmosdbDataConnection 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 CosmosdbDataConnection Resource
Get an existing CosmosdbDataConnection 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?: CosmosdbDataConnectionState, opts?: CustomResourceOptions): CosmosdbDataConnection
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
cosmosdb_container_id: Optional[str] = None,
kusto_database_id: Optional[str] = None,
location: Optional[str] = None,
managed_identity_id: Optional[str] = None,
mapping_rule_name: Optional[str] = None,
name: Optional[str] = None,
retrieval_start_date: Optional[str] = None,
table_name: Optional[str] = None) -> CosmosdbDataConnection
func GetCosmosdbDataConnection(ctx *Context, name string, id IDInput, state *CosmosdbDataConnectionState, opts ...ResourceOption) (*CosmosdbDataConnection, error)
public static CosmosdbDataConnection Get(string name, Input<string> id, CosmosdbDataConnectionState? state, CustomResourceOptions? opts = null)
public static CosmosdbDataConnection get(String name, Output<String> id, CosmosdbDataConnectionState 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.
- Cosmosdb
Container stringId The name of an existing container in the Cosmos DB database. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Kusto
Database stringId The name of the database in the Kusto cluster. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Location string
The Azure Region where the Data Explorer should exist. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Managed
Identity stringId The resource ID of a managed system or user-assigned identity. The identity is used to authenticate with Cosmos DB. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Mapping
Rule stringName The name of an existing mapping rule to use when ingesting the retrieved data. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Name string
The name of the data connection. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Retrieval
Start stringDate If defined, the data connection retrieves Cosmos DB documents created or updated after the specified retrieval start date. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Table
Name string The case-sensitive name of the existing target table in your cluster. Retrieved data is ingested into this table. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Cosmosdb
Container stringId The name of an existing container in the Cosmos DB database. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Kusto
Database stringId The name of the database in the Kusto cluster. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Location string
The Azure Region where the Data Explorer should exist. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Managed
Identity stringId The resource ID of a managed system or user-assigned identity. The identity is used to authenticate with Cosmos DB. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Mapping
Rule stringName The name of an existing mapping rule to use when ingesting the retrieved data. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Name string
The name of the data connection. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Retrieval
Start stringDate If defined, the data connection retrieves Cosmos DB documents created or updated after the specified retrieval start date. Changing this forces a new Kusto Cosmos DB Connection to be created.
- Table
Name string The case-sensitive name of the existing target table in your cluster. Retrieved data is ingested into this table. Changing this forces a new Kusto Cosmos DB Connection to be created.
- cosmosdb
Container StringId The name of an existing container in the Cosmos DB database. Changing this forces a new Kusto Cosmos DB Connection to be created.
- kusto
Database StringId The name of the database in the Kusto cluster. Changing this forces a new Kusto Cosmos DB Connection to be created.
- location String
The Azure Region where the Data Explorer should exist. Changing this forces a new Kusto Cosmos DB Connection to be created.
- managed
Identity StringId The resource ID of a managed system or user-assigned identity. The identity is used to authenticate with Cosmos DB. Changing this forces a new Kusto Cosmos DB Connection to be created.
- mapping
Rule StringName The name of an existing mapping rule to use when ingesting the retrieved data. Changing this forces a new Kusto Cosmos DB Connection to be created.
- name String
The name of the data connection. Changing this forces a new Kusto Cosmos DB Connection to be created.
- retrieval
Start StringDate If defined, the data connection retrieves Cosmos DB documents created or updated after the specified retrieval start date. Changing this forces a new Kusto Cosmos DB Connection to be created.
- table
Name String The case-sensitive name of the existing target table in your cluster. Retrieved data is ingested into this table. Changing this forces a new Kusto Cosmos DB Connection to be created.
- cosmosdb
Container stringId The name of an existing container in the Cosmos DB database. Changing this forces a new Kusto Cosmos DB Connection to be created.
- kusto
Database stringId The name of the database in the Kusto cluster. Changing this forces a new Kusto Cosmos DB Connection to be created.
- location string
The Azure Region where the Data Explorer should exist. Changing this forces a new Kusto Cosmos DB Connection to be created.
- managed
Identity stringId The resource ID of a managed system or user-assigned identity. The identity is used to authenticate with Cosmos DB. Changing this forces a new Kusto Cosmos DB Connection to be created.
- mapping
Rule stringName The name of an existing mapping rule to use when ingesting the retrieved data. Changing this forces a new Kusto Cosmos DB Connection to be created.
- name string
The name of the data connection. Changing this forces a new Kusto Cosmos DB Connection to be created.
- retrieval
Start stringDate If defined, the data connection retrieves Cosmos DB documents created or updated after the specified retrieval start date. Changing this forces a new Kusto Cosmos DB Connection to be created.
- table
Name string The case-sensitive name of the existing target table in your cluster. Retrieved data is ingested into this table. Changing this forces a new Kusto Cosmos DB Connection to be created.
- cosmosdb_
container_ strid The name of an existing container in the Cosmos DB database. Changing this forces a new Kusto Cosmos DB Connection to be created.
- kusto_
database_ strid The name of the database in the Kusto cluster. Changing this forces a new Kusto Cosmos DB Connection to be created.
- location str
The Azure Region where the Data Explorer should exist. Changing this forces a new Kusto Cosmos DB Connection to be created.
- managed_
identity_ strid The resource ID of a managed system or user-assigned identity. The identity is used to authenticate with Cosmos DB. Changing this forces a new Kusto Cosmos DB Connection to be created.
- mapping_
rule_ strname The name of an existing mapping rule to use when ingesting the retrieved data. Changing this forces a new Kusto Cosmos DB Connection to be created.
- name str
The name of the data connection. Changing this forces a new Kusto Cosmos DB Connection to be created.
- retrieval_
start_ strdate If defined, the data connection retrieves Cosmos DB documents created or updated after the specified retrieval start date. Changing this forces a new Kusto Cosmos DB Connection to be created.
- table_
name str The case-sensitive name of the existing target table in your cluster. Retrieved data is ingested into this table. Changing this forces a new Kusto Cosmos DB Connection to be created.
- cosmosdb
Container StringId The name of an existing container in the Cosmos DB database. Changing this forces a new Kusto Cosmos DB Connection to be created.
- kusto
Database StringId The name of the database in the Kusto cluster. Changing this forces a new Kusto Cosmos DB Connection to be created.
- location String
The Azure Region where the Data Explorer should exist. Changing this forces a new Kusto Cosmos DB Connection to be created.
- managed
Identity StringId The resource ID of a managed system or user-assigned identity. The identity is used to authenticate with Cosmos DB. Changing this forces a new Kusto Cosmos DB Connection to be created.
- mapping
Rule StringName The name of an existing mapping rule to use when ingesting the retrieved data. Changing this forces a new Kusto Cosmos DB Connection to be created.
- name String
The name of the data connection. Changing this forces a new Kusto Cosmos DB Connection to be created.
- retrieval
Start StringDate If defined, the data connection retrieves Cosmos DB documents created or updated after the specified retrieval start date. Changing this forces a new Kusto Cosmos DB Connection to be created.
- table
Name String The case-sensitive name of the existing target table in your cluster. Retrieved data is ingested into this table. Changing this forces a new Kusto Cosmos DB Connection to be created.
Import
Kusto / Cosmos Database Data Connection can be imported using the resource id
, e.g.
$ pulumi import azure:kusto/cosmosdbDataConnection:CosmosdbDataConnection example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Kusto/clusters/cluster1/databases/database1/dataConnections/dataConnection1
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
azurerm
Terraform Provider.