Create Data Lake Store In Azure Using PowerShell Cmdlets

Introduction

In this article, I will explain about creating a Data Lake Store with default storage using Windows PowerShell.

Prerequisite

  • An active Azure subscription.
  • Windows PowerShell.

Steps for creating data lake store using PowerShell

Step 1

Run Windows PowerShell as administrator.

Step 2

I have provided the commands for creating the data lake store in Azure. Open Windows PowerShell and enter the following command.

Login-AzureRmAccount

Step 3

You will be redirected to the Azure portal for sign-in process. Enter your login id and password.

Step 4

After logging in to the Azure portal, you will get a reply from it. Now, you need to register for data lake store, followed by executing the following command.

Register-AzureRmResourceProvider -ProviderNamespace "Microsoft.DataLakeStore"

Create a resource group for the data lake store account using the provided command, replace the resource group name and location with your desired ones.

$resourceGroupName = "<your new resource group name>"
New-AzureRmResourceGroup -Name $resourceGroupName -Location "<your desire location>"

Step 5

Now, we need to create a Data lake store account and provide the name in lowercase and numbers. I have provided the command below.

$dataLakeStoreName = "<your new Data Lake Store name>"
New-AzureRmDataLakeStoreAccount -ResourceGroupName $resourceGroupName -Name $dataLakeStoreName -Location "<your desire location>"



Step 6

This article explains about creating a default storage account and for that, we need to specify a root directory for the data lake store. For creating a root directory, use the following command.

$myrootdir = "/"

Create a new directory with a desired name using the following command.

New-AzureRmDataLakeStoreItem -Folder -AccountName $dataLakeStoreName -Path $myrootdir/<your directory name>

And now, we need to verify whether the directory Is created or not, followed by the command -

Get-AzureRmDataLakeStoreChildItem -AccountName $dataLakeStoreName -Path $myrootdir

Step 7

Finally, we have created a data lake store. When we do not need it, we can delete the store using the following command - (when prompted, press Y to delete the account).

Remove-AzureRmDataLakeStoreAccount -Name $dataLakeStoreName