Reputation: 1
I want to create a container through Windows PowerShell and therefore try to obtain the account key via
$storageAccountKey = Get-AzureRmStorageAccountKey -ResourceGroupName $resourceGroupName -Name $storageAccountName | %{ $_.Key1 }
New-AzureStorageContext : Cannot validate argument on parameter 'StorageAccountKey'. The argument is null or empty. Provide an argument that is not null or empty, and then try the
command again.
Upvotes: 0
Views: 570
Reputation: 35358
This should work
$storageAccountKey = Get-AzureRmStorageAccountKey -ResourceGroupName $resourceGroupName -Name $storageAccountName | ? { $_.KeyName -eq 'Key1' } | % { $_.Value }
The problem is that the result is not a hashtable but a .NET generic list so it is not possible to access the value directly via the key name.
Upvotes: 1