Last active
August 29, 2015 14:03
-
-
Save mwinkle/a0b16be59b4e00de3bba to your computer and use it in GitHub Desktop.
Creating an HDInsight Cluster using a SAS protected storage container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This script lets you access data in a second storage account, where you are only granted access | |
#via a Shared Access Signature to a given container | |
#For more details on SAS, see this http://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-shared-access-signature-part-1/ | |
#Configure SAS key | |
$sasStorageAccountName = "YOUR_STORAGE_ACCCOUNT_NAME" | |
$sasContainerName = "YOUR_SAS_CONTAINER_NAME" | |
$context = New-AzureStorageContext -StorageAccountName $sasStorageAccountName -StorageAccountKey (Get-AzureStorageKey -StorageAccountName $sasStorageAccountName).Primary | |
$sas = New-AzureStorageContainerSASToken -Name $sasContainerName -Permission rl -Context $context -ExpiryTime (get-date).AddDays(3) | |
#Configure Cluster | |
$clusterDnsName = "YOUR_CLUSTER_NAME" | |
$clusterNodes = 4 | |
$storageAccountName = "DEFAULT_STORAGE_ACCOUNT" | |
$storageAccountKey = (Get-AzureStorageKey -StorageAccountName $storageAccountName).Primary | |
$containerName = "DEFAULT_CONTAINER_NAME" | |
$storageLocation = "Southeast Asia" | |
$creds = Get-Credential | |
#create config | |
#note that config value is fs.azure.sas.CONTAINER.ACCOUNT =Signature | |
$config = New-AzureHDInsightClusterConfig -ClusterSizeInNodes $clusterNodes | | |
Set-AzureHDInsightDefaultStorage -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey -StorageContainerName $containerName | | |
Add-AzureHDInsightConfigValues -Core @{ | |
"fs.azure.sas.$sasContainerName.$sasStorageAccountName.blob.core.windows.net"=$sas; | |
} | |
New-AzureHDInsightCluster -Config $config -Credential $creds -Name $clusterDnsName -Location $storageLocation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment