Wednesday, 13 January 2016

Create script HDInsight Cluster

Login-AzureRmAccount
Import-AzurePublishSettingsFile "F:\Microsoft Azure Sponsorship-12-16-2015-credentials (2).publishsettings"
Get-AzureRmSubscription  # list your subscriptions and get your subscription ID
$subscriptionName="Microsoft Azure Sponsorship"
#Select-AzureRmSubscription -SubscriptionId "<Your Azure Subscription ID>"
Select-AzureRmSubscription -SubscriptionName $subscriptionName

$resourceGroupName = "hdinsight_southeastasia"

$storageAccountName = "XXXXXXXXXXXXXX"
$containerName = "XXXXXXXXXXXXX"

$clusterName = "XXXXXXXXXXXXX"
$location = "Southeast Asia"
$clusterNodes = "4"
$clusterType="HBase"
$ClusterVersion="3.2.7.757"

# Get the Storage account key
$storageAccountKey = Get-AzureRmStorageAccountKey -ResourceGroupName $resourceGroupName -Name $storageAccountName | %{ $_.Key1 }
echo "Authentication Done ..!!!"
echo "Cluster creation in Progress"
# Create a new HDInsight cluster
New-AzureRmHDInsightCluster -ResourceGroupName $resourceGroupName `
    -ClusterName $clusterName `
    -Location $location `
    -DefaultStorageAccountName "$storageAccountName.blob.core.windows.net" `
    -DefaultStorageAccountKey $storageAccountKey `
    -DefaultStorageContainer $containerName  `
    -ClusterSizeInNodes $clusterNodes `
-ClusterType $clusterType `


echo "Cluster Created.."

No comments:

Post a Comment