Image
{{'2017-08-18T09:29:39.3174828Z' | utcToLocalDate }}
Richie Lee

Uploading Files To Data Lake Storage With PowerShell Part Three

Picking up from where we left off last month, we’re today we’re looking at setting the Azure Data Lake Storage account. This post is part of a series on automating the process of uploading files to Azure Data Lake Store, Although the entire script is available on Git (posted below) I’m going to go into one function per post so that I can go in greater depth. Part One of this blog series focused on logging in to an Azure Subscription. Part Two focused on setting the Resource Group.

As mentioned, today’s function starts on row 74 and is called Set-AzureDataLakeStoreAccount. As I mentioned in Part Two, approved verbs in PowerShell are important, but I’m not going to begin my lecture here. We should all know by now what “Set” implies.

image

 

Using the PowerShell Azure functions, we test to see if the Storage Account exists, and if it does not, then we create it. And whilst we have the Create in a try/catch, after the fact we test again to make sure the account exists. If the account already exists then we do not make any changes. So once again, we have an idempotent script that we can call again and again, and I use Write-Verbose to log messages.

 

comments powered by Disqus