How to create a Data Lake in Azure with ADLS Gen2
A Data Lake is the foundation of any modern data platform, and on Azure the recommended way to build one is with Azure Data Lake Storage Gen2 (ADLS Gen2). The difference from classic Blob Storage is the hierarchical namespace: instead of a flat list of blobs, you get real folders, which speeds up analytical operations and greatly simplifies permission management. You will create a Data Lake in Azure from scratch with the Azure CLI, in just a few minutes and without leaving the command line. By the end, you will have a storage account ready for analytics, with a sample folder and file already inside.
Prerequisites
- An active Azure subscription (the free tier is enough to experiment).
- Azure CLI 2.0.79 or later installed — check with
az --version. - Permission to create resources in the subscription (for example, the Contributor role).
Step 1: Authenticate to Azure
Start by signing in. The command opens the browser so you can authenticate with your Microsoft Entra ID account. You do not need to store any password: the session is cached locally and the following commands reuse it. If you have access to more than one subscription, explicitly choose which one to use so you don't create resources in the wrong place.
az login
az account set --subscription "Pay-As-You-Go"
Step 2: Create a resource group
Every Azure resource lives inside a resource group, which acts as a logical folder to organize and delete them together. Create one and pick the region closest to your users to reduce latency. A clear naming convention, such as rg-project-environment, helps keep things tidy as your platform grows.
az group create --name rg-datalake-demo --location westeurope
Step 3: Create the storage account with a hierarchical namespace
This is the step that turns an ordinary storage account into a Data Lake. The key is the --enable-hierarchical-namespace true parameter, which switches on ADLS Gen2 capabilities. The account name must be globally unique and use only lowercase letters and numbers.
az storage account create --name stdatalakedemo01 --resource-group rg-datalake-demo --location westeurope --sku Standard_LRS --kind StorageV2 --enable-hierarchical-namespace true
If you forget this parameter, you end up with classic Blob Storage and lose the real folders, atomic renames, and folder- and file-level ACLs. It is worth double-checking before moving on.
Step 4: Create a file system
In ADLS Gen2, the top-level container is called a file system. In practice it maps to a Blob Storage container, but with support for the ADLS Gen2 folder hierarchy. Note the --auth-mode login: it tells the CLI to use your Microsoft Entra ID identity instead of shared access keys — the recommended, more secure practice, aligned with the "no passwords" principle.
az storage fs create --name raw --account-name stdatalakedemo01 --auth-mode login
Step 5: Create folders and upload data
Now use the hierarchical namespace to organize the lake into layers — a common convention is raw, bronze, silver, and gold. Create a folder and upload a sample file to watch the structure take shape.
az storage fs directory create --name vendas/2026 --file-system raw --account-name stdatalakedemo01 --auth-mode login
az storage fs file upload --source ./vendas.csv --path vendas/2026/vendas.csv --file-system raw --account-name stdatalakedemo01 --auth-mode login
Verify the result
To confirm everything worked, list the contents of the file system:
az storage fs file list --file-system raw --account-name stdatalakedemo01 --auth-mode login --output table
You should see the vendas/2026 folder and the vendas.csv file. Alternatively, open the storage account in the Azure portal and confirm on the Overview tab that "Hierarchical namespace: Enabled" appears. If, when you open the container, you browse through folders instead of a flat list of blobs, your Data Lake is ready to use.
Conclusion
In just a few commands you have a working ADLS Gen2 Data Lake, with identity-based authentication and a folder structure ready to receive pipelines. The natural next step is to connect it to Azure Data Factory, Databricks, or Microsoft Fabric to start ingesting and transforming data. Before that, one tip that saves plenty of headaches: define your layer convention now and assign ACLs per folder instead of granting access to the whole account — it is far easier to govern an organized lake from day one than to tidy up the mess later. Which layers make the most sense for your use case?