hdinsight / hdinsight-storm-examples

This is a repository for complete and easy to use samples that demonstrate the use of Apache Storm on HDInsight
Apache License 2.0
58 stars 52 forks source link

"Cannot get Storage Key" exception thrown #19

Open bcraun opened 7 years ago

bcraun commented 7 years ago

Am trying to stand up the cluster using the PS prepare.ps1 script and am seeing the following error. Have tried multiple times. Any ideas?

2016-07-07T07:46:36.7815892-07:00 [INFO] [CreateStorageAccountARM.ps1(ln:54)] - Getting Storage Key for iot201607070742
2016-07-07T07:46:37.0940803-07:00 [INFO] [CreateStorageAccountARM.ps1(ln:59)] - Storage Account: iot201607070742 successfully created in Resource Group: iot-group-201607
070742 at Location: Central US. Time: 33.2957405 secs
Cannot get Storage Key
At C:\projects\hdinsight-storm-examples\scripts\azure\CreateAzureResources.ps1:207 char:5
+     throw "Cannot get Storage Key"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Cannot get Storage Key:String) [], RuntimeException
    + FullyQualifiedErrorId : Cannot get Storage Key

PS C:\projects\hdinsight-storm-examples\IotExample>
davidrpk commented 7 years ago

The new version of Azure Powershell returns the Storage Key in a slightly different format. See here for more info: http://www.codeisahighway.com/breaking-change-with-get-azurermstorageaccountkey-in-azurerm-storage-v1-1-0-azurerm-v1-4-0/

To get around this modify line 55 in scripts\azure\Storage\CreateStorageAccountARM.ps1 to the following:

$PrimaryKey = $(Get-AzureRmStorageAccountKey -ResourceGroupName $ResourceGroupName -StorageAccountName $AccountName)[0].Value