Configure Azure Data Share ADLS Gen2 File Datasets

The azure-native:datashare:ADLSGen2FileDataSet resource, part of the Pulumi Azure Native provider, registers an ADLS Gen2 file as a dataset within an Azure Data Share, making it available for sharing with recipients. This guide focuses on one capability: adding files to existing shares.

Datasets belong to Data Share accounts and shares, and reference files in ADLS Gen2 storage accounts that must exist separately. The example is intentionally minimal. Combine it with storage account references and file paths for complete dataset registration.

Add an ADLS Gen2 file to a data share

Data providers register files from ADLS Gen2 storage as datasets within shares, making them available to recipients.

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

const adlsGen2FileDataSet = new azure_native.datashare.ADLSGen2FileDataSet("adlsGen2FileDataSet", {
    accountName: "Account1",
    dataSetName: "Dataset1",
    resourceGroupName: "SampleResourceGroup",
    shareName: "Share1",
});
import pulumi
import pulumi_azure_native as azure_native

adls_gen2_file_data_set = azure_native.datashare.ADLSGen2FileDataSet("adlsGen2FileDataSet",
    account_name="Account1",
    data_set_name="Dataset1",
    resource_group_name="SampleResourceGroup",
    share_name="Share1")
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.NewADLSGen2FileDataSet(ctx, "adlsGen2FileDataSet", &datashare.ADLSGen2FileDataSetArgs{
			AccountName:       pulumi.String("Account1"),
			DataSetName:       pulumi.String("Dataset1"),
			ResourceGroupName: pulumi.String("SampleResourceGroup"),
			ShareName:         pulumi.String("Share1"),
		})
		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 adlsGen2FileDataSet = new AzureNative.DataShare.ADLSGen2FileDataSet("adlsGen2FileDataSet", new()
    {
        AccountName = "Account1",
        DataSetName = "Dataset1",
        ResourceGroupName = "SampleResourceGroup",
        ShareName = "Share1",
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.datashare.ADLSGen2FileDataSet;
import com.pulumi.azurenative.datashare.ADLSGen2FileDataSetArgs;
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 adlsGen2FileDataSet = new ADLSGen2FileDataSet("adlsGen2FileDataSet", ADLSGen2FileDataSetArgs.builder()
            .accountName("Account1")
            .dataSetName("Dataset1")
            .resourceGroupName("SampleResourceGroup")
            .shareName("Share1")
            .build());

    }
}
resources:
  adlsGen2FileDataSet:
    type: azure-native:datashare:ADLSGen2FileDataSet
    properties:
      accountName: Account1
      dataSetName: Dataset1
      resourceGroupName: SampleResourceGroup
      shareName: Share1

The accountName and shareName properties identify the parent Data Share account and share. The dataSetName provides a unique identifier for this dataset within the share. The resourceGroupName locates the Data Share account. To complete the registration, you’ll need to add properties that identify the storage account (storageAccountName, subscriptionId, resourceGroup) and file location (fileSystem, filePath).

Beyond these examples

This snippet focuses on dataset registration within shares. It’s intentionally minimal rather than a complete data sharing configuration.

The example references pre-existing infrastructure such as Azure Data Share accounts and shares, ADLS Gen2 storage accounts with files, and resource groups. It focuses on dataset configuration rather than provisioning the surrounding infrastructure.

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

  • Storage account identification (storageAccountName, subscriptionId, resourceGroup)
  • File location specification (fileSystem, filePath)
  • Cross-subscription or cross-region sharing
  • Dataset mapping and synchronization configuration

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

Let's configure Azure Data Share ADLS Gen2 File Datasets

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
What properties are required beyond what the examples show?
The examples only show accountName, dataSetName, resourceGroupName, and shareName, but you must also configure filePath, fileSystem, kind, resourceGroup, storageAccountName, and subscriptionId to create the resource.
What value should I use for the kind property?
The kind property must be set to AdlsGen2File.
How do I specify which file to share?
Use filePath to specify the file path within the file system, fileSystem to identify the ADLS Gen2 file system, and storageAccountName to identify the source storage account.
Naming & Identification
What's the difference between accountName and storageAccountName?
accountName refers to the Data Share account (where the share is created), while storageAccountName refers to the source ADLS Gen2 storage account (where the file is stored).
What's the difference between resourceGroupName and resourceGroup?
resourceGroupName is the resource group containing the Data Share account, while resourceGroup is the resource group containing the source storage account.
Immutability & Lifecycle
Which properties can't be changed after creation?
Four properties are immutable: accountName, dataSetName, resourceGroupName, and shareName. Changing any of these forces resource replacement.
Import & Management
How do I import an existing ADLS Gen2 file data set?
Use pulumi import azure-native:datashare:ADLSGen2FileDataSet <name> /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataShare/accounts/{accountName}/shares/{shareName}/dataSets/{dataSetName}.

Using a different cloud?

Explore analytics guides for other cloud providers: