Azure PowerShell 1.4.0 breaks old Azure Resource Group projects


I'm working from home tonight on a new machine, so I've installed the latest Azure SDK and Azure PowerShell (1.4.0). Our existing Azure Resource Group project failed to deploy to my Azure environment using the Visual Studio deploy prorocess:

 The property 'Key1' cannot be found on this object. Verify that the property exists.
 At ***\Scripts\Deploy-AzureResourceGroup.ps1:70 char:5
 +     $StorageAccountKey = (Get-AzureRmStorageAccountKey -ResourceGroup ...
 +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : NotSpecified: (:) [], PropertyNotFoundException
     + FullyQualifiedErrorId : PropertyNotFoundStrict

 The variable '$StorageAccountKey' cannot be retrieved because it has not been set.
 At ***\Scripts\Deploy-AzureResourceGroup.ps1:90 char:82
 + ... irectory""", $ArtifactsLocation, "/DestKey:$StorageAccountKey", "/S", ...
 +                                                ~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : InvalidOperation: (StorageAccountKey:String) [], RuntimeException
     + FullyQualifiedErrorId : VariableIsUndefined

 The variable '$LASTEXITCODE' cannot be retrieved because it has not been set.
 At ***\Scripts\Deploy-AzureResourceGroup.ps1:91 char:9
 +     if ($LASTEXITCODE -ne 0) { return }
 +         ~~~~~~~~~~~~~
     + CategoryInfo          : InvalidOperation: (LASTEXITCODE:String) [], RuntimeException
     + FullyQualifiedErrorId : VariableIsUndefined

The line in question (well the first one that fails) is:

    $StorageAccountKey = (Get-AzureRmStorageAccountKey -ResourceGroupName $StorageAccountResourceGroupName -Name $StorageAccountName).Key1

It looks like the output of Get-AzureRmStorageAccountKey has changed in the 1.4.0 release of Azure PowerShell. (For those interested it looks like it returns an array of keys now, rather than an object with the keys as properties of a single object).

I started to get annoyed at breaking changes between teams at Microsoft with my twitter client ready to go. Just to be sure I created a brand new Resource Group project in a new solution. And low and behold the deploy process worked! The Deploy-AzureResourceGroup.ps1 file has been update and no longer uses the Get-AzureRmStorageAccountKey CmdLet. In fact it no longer uses AzCopy to copy the artifacts into a blob container (It now uses Set-AzureStorageBlobContent which seems much slower).

So the long and short is that I've now updated my existing Deploy-AzureResourceGroup.ps1 to use the new code and it all works now under 1.4.0.


Anthony Meehan

Read more posts by this author.


Additional Posts
Share This Post
Twitter Google+ Pinterest Facebook