How to list storage blob url using az cli?

2.1k Views Asked by At

I want to list (programmatically) the url of my blob storage. The url I am looking for is https://my_storageaccount_name.blob.core.windows.net/my_container_name/my_file_name

I tried az storage account list and az storage blob show but neither of them display the url.

There is a az storage blob url but that creates a url. I am interested in listing the url.

Does anyone know how to obtain this ?

2

There are 2 best solutions below

1
Tomasz Kaniewski On

If the url for the blobs is always

https://my_storageaccount_name.blob.core.windows.net/my_container_name/my_file_name

without any custom domains configured, just list all containers with blobs, take the container name and blob name, and put it in the URL.

Ref: https://my_storageaccount_name.blob.core.windows.net/my_container_name/my_file_name

0
harshityadav95 On

You can get Storage account URL Using

az storage account show --name $storage_account_name --resource-group $ResourceGroup --query "primaryEndpoints.blob")

or all the properties without using query from which you can pick whichever property you want

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