118

I am starting with Windows Azure. I have an Azure account with Microsoft and would like to use it from my Visual Studio project

In the Azure management portal, I can see the primary access key and secondary access key. However Visual Studio needs the account name and account key.

Are these related or am I missing something? If so, how can I get my account name and account key from the Azure management portal?

2
  • For anyone else coming here, here the account key can be either secondary or primary key. Just the names make it very un-intuitive.
    – gideon
    Jan 6, 2012 at 7:53
  • 2
    for someone else who didnt find the Name and Key he first make sure that the Storage Account is created. Because One can create Database but dont have the Storage Account which is required to get access to Database...and then inside the Storage Account you see "Manage Access Keys" button for Name and Key
    – TaLha Khan
    Apr 4, 2014 at 18:43

4 Answers 4

90

If you're referring to a Windows Azure Storage account, the storage account name would be the dns prefix you created (e.g. mystorage.blob.core.windows.net - the name would be mystorage).

You then get two keys - primary and secondary. Specify either. You have two so you can give one out to someone (such as giving the secondary key to a 3rd-party monitoring company) and revoke it by changing the key, without impacting you (assuming you're using the primary key for yourself).

4
  • 19
    The primary purpose of the two keys was for key-rolling. You could swap one out while you regenerated the other without incurring downtime. Of course, you can also give out a copy of the key to someone, but be careful doing so - as both keys are masters and all powerful for the account.
    – dunnry
    Aug 8, 2011 at 21:17
  • 1
    Agree w/dunnry, but... for services like AzureWatch or tools like Cerebrata Cloud Storage Studio, you'll need to offer up a key. And it's nice to have the 'regenerate' capability if you cancel your service or have your laptop access compromised. Aug 8, 2011 at 21:23
  • who is the secret key first one or second one?
    – Chandni
    Feb 8, 2021 at 9:28
  • @Chandni - not sure I entirely understand your question but... with storage accounts, both keys are secret keys. You get two of them. Feb 8, 2021 at 13:00
73

The user interface changed a little bit but it's generally the same place:

screenshot

Note that on the right side of the key you have a Connection String. There you can clearly see the name and the key as well.

1
  • Note that you have to press on "show keys" on the top in order to view them. Jun 23, 2022 at 20:07
6

Adding a new answer as Azure UI is updated.

So, after selecting the storage account(in my case its inAFlash) select Access keys option you will get the following screen shown in the screenshot

Blade

Here you see two key's Primary and secondary. So, previously these were key1 and key2.

Reason for two keys? it's to avoid downtime. let's say, if you had only one key and used it multiple places. Suddenly you had to share it to someone for some reason. So, you might need to regenerated this key(As you have already shared it) and update it in all places where you used it previously. So, to avoid this, we have secondary key, which you can share and regenerate it so that, primary key will be still valid.

2
  • where is the secret key?
    – Chandni
    Feb 8, 2021 at 9:31
  • i crossed them off. Secret keys are the same as access keys
    – rawwar
    Feb 9, 2021 at 10:02
3

You can check it by using Azure CLI:

az login
az storage account list -o table
az storage account keys list -n YourAccount

To extract the first key, you can use the following command:

az storage account keys list -n YourAccount -o json --query "[0].value"

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.