0

I have an account key and corresponding account name. How can I find the storage options it has?

Using: az storage account list retrieves the accounts that my subscription has access to, and I get the access points:

   "primaryEndpoints": {
      "blob": "https://MYACCOUNT.blob.core.windows.net/",
      "dfs": "https://MYACCOUNT.dfs.core.windows.net/",
      "file": "https://MYACCOUNT.file.core.windows.net/",
      "internetEndpoints": null,
      "microsoftEndpoints": null,
      "queue": "https://MYACCOUNT.queue.core.windows.net/",
      "table": "https://MYACCOUNT.table.core.windows.net/",
      "web": "https://MYACCOUNT.z6.web.core.windows.net/"
   }

I want to obtain a similar endpoint for an account for which I have an account key, how to do this?

Then, if there is a 'blob' access point, I know that I can call:

az storage fs list --account-name "MYACCOUNT" --account-key "MYKEY"

to get the list of blob containers.

Bonus question: how to know whether the key is for a Gen1 or Gen2 type account?

Ansuman Bal
  • 9,705
  • 2
  • 10
  • 27
  • The account you want to check is not in your subscription ? You only have the credentials for it ? By the way, for any azure storage account, the endpoints URLs will be the same structure for all, for example for a blob endpoint `.blob.core.windows.net` so if you have credentials you know the url for it. – Flo Jun 28 '21 at 14:30
  • Correct, it is not in my subscription, I have just been given an account key and an account-name. Maybe it is my understanding not deep enough - can I assume that if I have a key and a name, then it is a 'Gen2' account type? – keldstefan Jun 28 '21 at 14:34
  • If it's not in your subscription, `az cli` won't help you as it interacts with Azure using the credentials stored when doing `az login`. So you can only interact with the resources that you have permissions in Azure subscriptions. If the storage was recently created, I guess it's a Gen2 account (as Gen1 will be deprecated in few years). I'm not sure there's a way to determine if it's a Gen1 or Gen2 (i've only worked with Gen2). If u have a gui, you could use "azure storage explorer" with credentials and see the storage account infos (local and linked account > (right click) storage account). – Flo Jun 28 '21 at 14:45
  • I can access the account through CLI: list blob storages (as in my question 'az storage fs list') and list the files contained in each of the blob storages ('az storage blob list') using the account key and name. Same for download and upload. I'm looking to generalize and find out which options I have with the key I'm given. – keldstefan Jun 28 '21 at 15:00

2 Answers2

0

I have an account key and corresponding account name. How can I find the storage options it has? (question from user)

  • If you are using the cli , you need to connect to the subscription where the storage account is present & run the below commnads to show list of storage options/access endpoints & properities of that particular storage without using the account key.
az login
az account set --subscription 
az storage account show --Name "accountname" --resource-group "resource-groupname"

enter image description here

  • As per the documentation the cmdlets "az storage fs" are used to manage the file systems in azure data lake storage gen2 account.
  • Azure don't have any mechanism to identify a storage account generations using access key generally When you create a storage account, Azure generates two 512-bit storage account access keys. These keys can be used to authorize access to data in your storage account via Shared Key authorization.
  • Alternatively, you can use Azure storage explorer from (Portal/Desktop version) to check the storage options and type of storage account it is as shown in below image if the HNS value of the storage account is true then it is a ADLS gen2 account.enter image description here
VenkateshDodda
  • 4,723
  • 1
  • 3
  • 12
0

Using Azure Cli , and use --query parameter to filter result

az storage account show --name $storage_account_name --resource-group $ResourceGroup