Create a gist now

Instantly share code, notes, and snippets.

Embed
Login-AzureRmAccount
$subscriptionName = ""
$ResourceGroupName = ""
$location = ""
$dataLakeStoreName = ""
Select-AzureRmSubscription -SubscriptionName $subscriptionName
Write-Host "Step 2 - Configure Resource Group" -ForegroundColor White -BackgroundColor DarkGreen
try {
$CheckResourceGroupExists = Get-AzureRmResourceGroup -Name $ResourceGroupName
}
catch {
Write-Host "oh dear" -ForegroundColor Black -BackgroundColor DarkRed
throw
}
if ($CheckResourceGroupExists -eq $false) {
"Resource Group doesn't exist. Creating..."
New-AzureRmResourceGroup -Name $ResourceGroupName -Location $location
}
elseif ($CheckResourceGroupExists -eq $true) {
"Resource Group exists."
}
Write-Host "Step 3 - Configure Data Lake Store Account" -ForegroundColor White -BackgroundColor DarkGreen
try {
$CheckDataLakStoreAccountExists = Test-AzureRmDataLakeStoreAccount -Name $dataLakeStoreName
}
catch {
Write-Host "oh dear" -ForegroundColor Black -BackgroundColor DarkRed
throw
}
if ($CheckDataLakStoreAccountExists -eq $false) {
"Data Lake Storage Account doesn't exist. Creating..."
New-AzureRmDataLakeStoreAccount -Name $dataLakeStoreName -ResourceGroupName $ResourceGroupName -Location $location
}
elseif ($CheckDataLakStoreAccountExists -eq $true) {
"Data Lake Storage Account exists."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment