Ready to get started?

Download a free trial of the Azure Data Lake Storage Data Provider to get started:

 Download Now

Learn more:

Azure Data Lake Storage Icon Azure Data Lake Storage ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with Azure Data Lake Storage.

LINQ to Azure Data Lake Storage Data



LINQ offers versatile querying capabilities within the .NET Framework (v3.0+), offering a straightforward method for programmatic data access through CData ADO.NET Data Providers. In this article, we demonstrate the use of LINQ to retrieve information from the Azure Data Lake Storage Data Provider.

This article illustrates using LINQ to access tables within the Azure Data Lake Storage via the CData ADO.NET Data Provider for Azure Data Lake Storage. To achieve this, we will use LINQ to Entity Framework, which facilitates the generation of connections and can be seamlessly employed with any CData ADO.NET Data Providers to access data through LINQ.

See the help documentation for a guide to setting up an EF 6 project to use the provider.

  1. In a new project in Visual Studio, right-click on the project and choose to add a new item. Add an ADO.NET Entity Data Model.
  2. Choose EF Designer from Database and click Next.
  3. Add a new Data Connection, and change your data source type to "CData Azure Data Lake Storage Data Source".
  4. Enter your data source connection information.

    Authenticating to a Gen 1 DataLakeStore Account

    Gen 1 uses OAuth 2.0 in Azure AD for authentication.

    For this, an Active Directory web application is required. You can create one as follows:

    1. Sign in to your Azure Account through the .
    2. Select "Azure Active Directory".
    3. Select "App registrations".
    4. Select "New application registration".
    5. Provide a name and URL for the application. Select Web app for the type of application you want to create.
    6. Select "Required permissions" and change the required permissions for this app. At a minimum, "Azure Data Lake" and "Windows Azure Service Management API" are required.
    7. Select "Key" and generate a new key. Add a description, a duration, and take note of the generated key. You won't be able to see it again.

    To authenticate against a Gen 1 DataLakeStore account, the following properties are required:

    • Schema: Set this to ADLSGen1.
    • Account: Set this to the name of the account.
    • OAuthClientId: Set this to the application Id of the app you created.
    • OAuthClientSecret: Set this to the key generated for the app you created.
    • TenantId: Set this to the tenant Id. See the property for more information on how to acquire this.
    • Directory: Set this to the path which will be used to store the replicated file. If not specified, the root directory will be used.

    Authenticating to a Gen 2 DataLakeStore Account

    To authenticate against a Gen 2 DataLakeStore account, the following properties are required:

    • Schema: Set this to ADLSGen2.
    • Account: Set this to the name of the account.
    • FileSystem: Set this to the file system which will be used for this account.
    • AccessKey: Set this to the access key which will be used to authenticate the calls to the API. See the property for more information on how to acquire this.
    • Directory: Set this to the path which will be used to store the replicated file. If not specified, the root directory will be used.

    Below is a typical connection string:

    Schema=ADLSGen2;Account=myAccount;FileSystem=myFileSystem;AccessKey=myAccessKey;InitiateOAuth=GETANDREFRESH
  5. If saving your entity connection to App.Config, set an entity name. In this example we are setting ADLSEntities as our entity connection in App.Config.
  6. Enter a model name and select any tables or views you would like to include in the model.

Using the entity you created, you can now perform select commands. For example:

ADLSEntities context = new ADLSEntities(); var resourcesQuery = from resources in context.Resources select resources; foreach (var result in resourcesQuery) { Console.WriteLine("{0} {1} ", result.Id, result.FullPath); }

See "LINQ and Entity Framework" chapter in the help documentation for example queries of the supported LINQ.