> ## Content Index
> Fetch the complete content index at: https://codeisahighway.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Breaking change with Get-AzureRmStorageAccountKey in AzureRM.Storage v1.1.0 - AzureRM v1.4.0
- URL: https://codeisahighway.com/breaking-change-with-get-azurermstorageaccountkey-in-azurerm-storage-v1-1-0-azurerm-v1-4-0/
- Published: 2016-05-12T20:11:00.000Z
- Updated: 2026-08-10T07:12:48.000Z
- Author: Stephane Lapointe
- Tags: PowerShell, Azure Resource Manager, Automation, Storage, Breaking Change, #Import 2023-07-11 16:44, #Import 2026-09-04 10:31, #Import 2026-09-04 13:56

A nasty breaking change has slipped into version 1.1.0 of AzureRM.Storage which coincide with the release v1.4.0 of AzureRM module. If you use the return object of the `Get-AzureRmStorageAccountKey` command you are impacted.

This is because the object that was coming out of Get-AzureRmStorageAccountKey was `Microsoft.Azure.Management.Storage.Models.StorageAccountKeys` and it is now a list of `Microsoft.Azure.Management.Storage.Models.StorageAccountKey` objects.

## The old output

In your code you probably have a code like this... You get the storage account keys to then create a storage context.

```powershell
$keys = Get-AzureRmStorageAccountKey -ResourceGroupName $ResourceGroupName -Name $StorageAccountName 
$context = New-AzureStorageContext -StorageAccountName $StorageAccountName -StorageAccountKey $keys.Key1

```

Before, each key was stored as a string in `Key1` and `Key2` properties.

- $keys.Key1
- $keys.Key2

## The new output

The new type is a `List<Microsoft.Azure.Management.Storage.Models.StorageAccountKey>`. Each object in the list has 3 members: `KeyName`, `Value` & `Permissions`.

![New output object of Get-AzureRmStorageAccountKey](https://codeisahighway.com/content/images/2016/05/Get-AzureRmStorageAccountKey-NewOutput.png)

To get the keys you now need to do this:

- $keys\[0\].Value
- $keys\[1\].Value

## Anothe, simplier way to obtain an AzureStorageContext

If you need to get the keys only to create an `Microsoft.WindowsAzure.Commands.Common.Storage.AzureStorageContext` object you can use the `.Context` member of a `Microsoft.Azure.Commands.Management.Storage.Models.PSStorageAccount` object like this:

```powershell
$storage = Get-AzureRmStorageAccount -ResourceGroupName $ResourceGroupName -Name $StorageAccountName
$storage.Context 

```

![Another way to obtain a storage account context](https://codeisahighway.com/content/images/2016/05/StorageAccount-Context.png)

![Microsoft.Azure.Commands.Management.Storage.Models.PSStorageAccount.Context](https://codeisahighway.com/content/images/2016/05/Storage-Context.png)

## Conclusion

This is a breaking change and should not have ended up in a minor version upgrade like it did. Microsoft need to be more cautious and build checks to prevent this from happening again. This will impact a LOT of scripts out there.