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 Configuration & Requirements
What value should I use for the kind property?
The kind property must be exactly AdlsGen2Folder. This is a discriminator that identifies the mapping type.
Why don't the examples show all the required properties?
The examples only demonstrate the four immutable properties (accountName, dataSetMappingName, resourceGroupName, shareSubscriptionName). You must also provide dataSetId, fileSystem, folderPath, kind, resourceGroup, storageAccountName, and subscriptionId for a complete configuration.
What are the required properties for creating a data set mapping?
You need seven required properties: dataSetId (source data set ID), fileSystem (ADLS Gen2 file system), folderPath (folder path), kind (must be ‘AdlsGen2Folder’), resourceGroup (storage account resource group), storageAccountName (storage account name), and subscriptionId (storage subscription ID).
Immutability & Updates
What properties can't be changed after creating the mapping?
Four properties are immutable: accountName, dataSetMappingName, resourceGroupName, and shareSubscriptionName. Changing any of these requires recreating the resource.
Resource Groups & Subscriptions
What's the difference between resourceGroup and resourceGroupName?
resourceGroup specifies the resource group of the storage account containing your data, while resourceGroupName specifies the resource group where the data set mapping resource itself is deployed.
What's the difference between subscriptionId and the mapping's subscription?
subscriptionId specifies the subscription containing the storage account, while the mapping resource itself is deployed in the subscription where you run your Pulumi program.
Monitoring & Management
How can I check if my data set mapping is working?
Check the dataSetMappingStatus output property for the mapping status, and provisioningState for the provisioning state. Both are computed fields updated by Azure.
How do I import an existing data set mapping?
Use pulumi import with the resource identifier format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shareSubscriptions/{shareSubscriptionName}/dataSetMappings/{dataSetMappingName}.

Using a different cloud?

Explore storage guides for other cloud providers: