Configure Azure Data Share ADLS Gen2 Folder Mappings

The azure-native:datashare:ADLSGen2FolderDataSetMapping resource, part of the Pulumi Azure Native provider, defines how shared ADLS Gen2 folder datasets map to a consumer’s storage account. This guide focuses on one capability: creating data set mappings within share subscriptions.

Data set mappings belong to share subscriptions within Data Share accounts and reference ADLS Gen2 storage infrastructure that must exist separately. The example is intentionally minimal. Combine it with your own Data Share accounts, share subscriptions, and storage configuration.

Map a shared folder to your storage account

When you receive shared datasets, you need to map incoming data to your own ADLS Gen2 storage, specifying where folders should land.

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

const adlsGen2FolderDataSetMapping = new azure_native.datashare.ADLSGen2FolderDataSetMapping("adlsGen2FolderDataSetMapping", {
    accountName: "Account1",
    dataSetMappingName: "DatasetMapping1",
    resourceGroupName: "SampleResourceGroup",
    shareSubscriptionName: "ShareSubscription1",
});
import pulumi
import pulumi_azure_native as azure_native

adls_gen2_folder_data_set_mapping = azure_native.datashare.ADLSGen2FolderDataSetMapping("adlsGen2FolderDataSetMapping",
    account_name="Account1",
    data_set_mapping_name="DatasetMapping1",
    resource_group_name="SampleResourceGroup",
    share_subscription_name="ShareSubscription1")
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.NewADLSGen2FolderDataSetMapping(ctx, "adlsGen2FolderDataSetMapping", &datashare.ADLSGen2FolderDataSetMappingArgs{
			AccountName:           pulumi.String("Account1"),
			DataSetMappingName:    pulumi.String("DatasetMapping1"),
			ResourceGroupName:     pulumi.String("SampleResourceGroup"),
			ShareSubscriptionName: pulumi.String("ShareSubscription1"),
		})
		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 adlsGen2FolderDataSetMapping = new AzureNative.DataShare.ADLSGen2FolderDataSetMapping("adlsGen2FolderDataSetMapping", new()
    {
        AccountName = "Account1",
        DataSetMappingName = "DatasetMapping1",
        ResourceGroupName = "SampleResourceGroup",
        ShareSubscriptionName = "ShareSubscription1",
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.datashare.ADLSGen2FolderDataSetMapping;
import com.pulumi.azurenative.datashare.ADLSGen2FolderDataSetMappingArgs;
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 adlsGen2FolderDataSetMapping = new ADLSGen2FolderDataSetMapping("adlsGen2FolderDataSetMapping", ADLSGen2FolderDataSetMappingArgs.builder()
            .accountName("Account1")
            .dataSetMappingName("DatasetMapping1")
            .resourceGroupName("SampleResourceGroup")
            .shareSubscriptionName("ShareSubscription1")
            .build());

    }
}
resources:
  adlsGen2FolderDataSetMapping:
    type: azure-native:datashare:ADLSGen2FolderDataSetMapping
    properties:
      accountName: Account1
      dataSetMappingName: DatasetMapping1
      resourceGroupName: SampleResourceGroup
      shareSubscriptionName: ShareSubscription1

The accountName identifies your Data Share account, while shareSubscriptionName specifies which subscription receives the data. The dataSetMappingName provides a unique identifier for this mapping within the subscription. This minimal configuration establishes the mapping’s identity; additional properties (not shown here) would specify the actual storage destination, file system path, and source data set reference.

Beyond these examples

This snippet focuses on data set mapping creation and naming. It’s intentionally minimal rather than a complete data sharing configuration.

The example references pre-existing infrastructure such as Data Share accounts, share subscriptions, and ADLS Gen2 storage accounts and file systems. It focuses on creating the mapping resource rather than provisioning the surrounding infrastructure.

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

  • Storage destination configuration (dataSetId, fileSystem, folderPath)
  • Storage account identity (storageAccountName, subscriptionId, resourceGroup)
  • Source data set references

These omissions are intentional: the goal is to illustrate how the mapping resource is wired, not provide drop-in data sharing modules. See the ADLS Gen2 Folder Data Set Mapping resource reference for all available configuration options.

Let's configure Azure Data Share ADLS Gen2 Folder 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 & Configuration
What does an ADLS Gen2 folder data set mapping do?
It maps a source data set to a destination ADLS Gen2 folder location, enabling data sharing between Azure Data Share accounts.
What's required to create an ADLS Gen2 folder data set mapping?
You must provide seven required properties: dataSetId, fileSystem, folderPath, kind, resourceGroup, storageAccountName, and subscriptionId. Additionally, you need four immutable identifiers: accountName, dataSetMappingName, resourceGroupName, and shareSubscriptionName.
What value should I use for the kind property?
The kind property must be set to AdlsGen2Folder for this resource type.
Immutability & Lifecycle
What properties can't I change after creating the mapping?
Four properties are immutable: accountName, dataSetMappingName, resourceGroupName, and shareSubscriptionName. Changing these requires replacing the resource.
Can I import an existing data set mapping into Pulumi?
Yes, you can import existing mappings using the resource’s full identifier path with the format /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/dataSetMappings/{dataSetMappingName}.
Monitoring & State
How do I check the status of my data set mapping?
Two computed output properties provide status information: dataSetMappingStatus shows the mapping status, and provisioningState shows the provisioning state.

Using a different cloud?

Explore storage guides for other cloud providers: