Skip to content

Instantly share code, notes, and snippets.

@RichieBzzzt
Created December 13, 2017 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RichieBzzzt/f1af624ccbf97f2802983506abb3d84a to your computer and use it in GitHub Desktop.
Save RichieBzzzt/f1af624ccbf97f2802983506abb3d84a to your computer and use it in GitHub Desktop.
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