Working hard on my PowerShell skills and really enjoying myself in de process. But I was figuring out this one-liner today and thought that this was maybe a bit complicated and should be able to do this easier. So this is why I thought to post my "creation" here.. Again, it's nothing fancy, but I accomplished my goal and just want to know if there was a easier way on doing this..
So here is my "one-liner" The idea is that I wanted to put my StorageAccountKey in a variable which I then can use. But the hard thing (for me) was to get only the first key, you het two keys when you use the Get-AzureRmStorageAccountkey cmdlet.
# For Azure PowerShell version 1.4, and later versions
$StorageKey = (Get-AzureRmStorageAccountkey -ResourceGroupName "ResourceGroup" -Name "storageaccount").value
# For Azure PowerShell version 1.3.2, and previous versions
$StorageKey = (Get-AzureRmStorageAccountkey -ResourceGroupName "ResourceGroup" -Name "storageaccount").Key1
The topic ‘Love to get some feedback on this..’ is closed to new replies.