Configure Azure SQL Database Data Set Mappings

The azure-native:datashare:SqlDBTableDataSetMapping resource, part of the Pulumi Azure Native provider, defines where shared SQL table data lands in the consumer’s subscription: which SQL server, database, schema, and table receive the incoming data. This guide focuses on one capability: mapping shared SQL tables to destination databases.

Dataset mappings are created by data consumers after accepting a share subscription. They require an existing Data Share account, share subscription, SQL server, and database. The examples are intentionally small. Combine them with your own Data Share infrastructure and access policies.

Map a shared SQL table to your database

When you receive a shared SQL table, you create a mapping that routes incoming data to a specific database and table in your subscription.

import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const sqlDBTableDataSetMapping = new azure_native.datashare.SqlDBTableDataSetMapping("sqlDBTableDataSetMapping", {
    accountName: "Account1",
    dataSetId: "a08f184b-0567-4b11-ba22-a1199336d226",
    dataSetMappingName: "DatasetMapping1",
    databaseName: "Database1",
    kind: "SqlDBTable",
    resourceGroupName: "SampleResourceGroup",
    schemaName: "dbo",
    shareSubscriptionName: "ShareSubscription1",
    sqlServerResourceId: "/subscriptions/433a8dfd-e5d5-4e77-ad86-90acdc75eb1a/resourceGroups/SampleResourceGroup/providers/Microsoft.Sql/servers/Server1",
    tableName: "Table1",
});
import pulumi
import pulumi_azure_native as azure_native

sql_db_table_data_set_mapping = azure_native.datashare.SqlDBTableDataSetMapping("sqlDBTableDataSetMapping",
    account_name="Account1",
    data_set_id="a08f184b-0567-4b11-ba22-a1199336d226",
    data_set_mapping_name="DatasetMapping1",
    database_name="Database1",
    kind="SqlDBTable",
    resource_group_name="SampleResourceGroup",
    schema_name="dbo",
    share_subscription_name="ShareSubscription1",
    sql_server_resource_id="/subscriptions/433a8dfd-e5d5-4e77-ad86-90acdc75eb1a/resourceGroups/SampleResourceGroup/providers/Microsoft.Sql/servers/Server1",
    table_name="Table1")
package main

import (
	datashare "github.com/pulumi/pulumi-azure-native-sdk/datashare/v3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := datashare.NewSqlDBTableDataSetMapping(ctx, "sqlDBTableDataSetMapping", &datashare.SqlDBTableDataSetMappingArgs{
			AccountName:           pulumi.String("Account1"),
			DataSetId:             pulumi.String("a08f184b-0567-4b11-ba22-a1199336d226"),
			DataSetMappingName:    pulumi.String("DatasetMapping1"),
			DatabaseName:          pulumi.String("Database1"),
			Kind:                  pulumi.String("SqlDBTable"),
			ResourceGroupName:     pulumi.String("SampleResourceGroup"),
			SchemaName:            pulumi.String("dbo"),
			ShareSubscriptionName: pulumi.String("ShareSubscription1"),
			SqlServerResourceId:   pulumi.String("/subscriptions/433a8dfd-e5d5-4e77-ad86-90acdc75eb1a/resourceGroups/SampleResourceGroup/providers/Microsoft.Sql/servers/Server1"),
			TableName:             pulumi.String("Table1"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var sqlDBTableDataSetMapping = new AzureNative.DataShare.SqlDBTableDataSetMapping("sqlDBTableDataSetMapping", new()
    {
        AccountName = "Account1",
        DataSetId = "a08f184b-0567-4b11-ba22-a1199336d226",
        DataSetMappingName = "DatasetMapping1",
        DatabaseName = "Database1",
        Kind = "SqlDBTable",
        ResourceGroupName = "SampleResourceGroup",
        SchemaName = "dbo",
        ShareSubscriptionName = "ShareSubscription1",
        SqlServerResourceId = "/subscriptions/433a8dfd-e5d5-4e77-ad86-90acdc75eb1a/resourceGroups/SampleResourceGroup/providers/Microsoft.Sql/servers/Server1",
        TableName = "Table1",
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.datashare.SqlDBTableDataSetMapping;
import com.pulumi.azurenative.datashare.SqlDBTableDataSetMappingArgs;
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) {
        var sqlDBTableDataSetMapping = new SqlDBTableDataSetMapping("sqlDBTableDataSetMapping", SqlDBTableDataSetMappingArgs.builder()
            .accountName("Account1")
            .dataSetId("a08f184b-0567-4b11-ba22-a1199336d226")
            .dataSetMappingName("DatasetMapping1")
            .databaseName("Database1")
            .kind("SqlDBTable")
            .resourceGroupName("SampleResourceGroup")
            .schemaName("dbo")
            .shareSubscriptionName("ShareSubscription1")
            .sqlServerResourceId("/subscriptions/433a8dfd-e5d5-4e77-ad86-90acdc75eb1a/resourceGroups/SampleResourceGroup/providers/Microsoft.Sql/servers/Server1")
            .tableName("Table1")
            .build());

    }
}
resources:
  sqlDBTableDataSetMapping:
    type: azure-native:datashare:SqlDBTableDataSetMapping
    properties:
      accountName: Account1
      dataSetId: a08f184b-0567-4b11-ba22-a1199336d226
      dataSetMappingName: DatasetMapping1
      databaseName: Database1
      kind: SqlDBTable
      resourceGroupName: SampleResourceGroup
      schemaName: dbo
      shareSubscriptionName: ShareSubscription1
      sqlServerResourceId: /subscriptions/433a8dfd-e5d5-4e77-ad86-90acdc75eb1a/resourceGroups/SampleResourceGroup/providers/Microsoft.Sql/servers/Server1
      tableName: Table1

The dataSetId identifies the source dataset from the provider’s share. The sqlServerResourceId points to your SQL server, while databaseName, schemaName, and tableName specify where the data lands. The kind property must be “SqlDBTable” for SQL database table mappings. Azure Data Share uses this configuration to write incoming data during synchronization.

Beyond these examples

This snippet focuses on SQL table dataset mapping configuration. It’s intentionally minimal rather than a complete data sharing workflow.

The example references pre-existing infrastructure such as Azure Data Share account and share subscription, SQL server and database for receiving data, and source dataset ID from the data provider. It focuses on configuring the mapping rather than provisioning the surrounding infrastructure.

To keep things focused, common mapping patterns are omitted, including:

  • Mapping validation and provisioning state monitoring
  • Cross-subscription or cross-region mappings
  • Alternative sink types (Data Lake, Synapse)
  • Mapping updates or reconfiguration

These omissions are intentional: the goal is to illustrate how the dataset mapping is wired, not provide drop-in data sharing modules. See the SqlDBTableDataSetMapping resource reference for all available configuration options.

Let's configure Azure SQL Database Data Set Mappings

Get started with Pulumi Cloud, then follow our quick setup guide to deploy this infrastructure.

Try Pulumi Cloud for FREE

Frequently Asked Questions

Resource Basics
What does a SQL DB table data set mapping do?
It maps a SQL DB table data set in Azure Data Share, allowing you to configure how shared SQL database tables are received in your subscription.
What properties are required to create this mapping?
You must provide dataSetId, databaseName, kind (set to “SqlDBTable”), schemaName, sqlServerResourceId, and tableName.
Configuration
What's the default schema name if I don't specify one?
The default schema name is dbo.
What value should I use for the kind property?
Set kind to “SqlDBTable”, which is the expected value for this resource type.
Resource Lifecycle
What properties can't I change after creating the mapping?
Four properties are immutable: accountName, dataSetMappingName, resourceGroupName, and shareSubscriptionName. Changing any of these requires replacing the resource.
How do I import an existing SQL DB table data set mapping?
Use the import command with the full resource identifier: pulumi import azure-native:datashare:SqlDBTableDataSetMapping <name> /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/dataSetMappings/{dataSetMappingName}

Using a different cloud?

Explore database guides for other cloud providers: