Open In App

How To Get Blob-URL After File Upload In Azure ?

Azure Blob Storage is a PaaS (Platform as a Service) offering by Microsoft’s cloud solution Azure, to store unrestricted amounts of data objects. Here, object refers to any unstructured data such as documents (text, log files that are updated), binary data, and virtual hard drives. Blob storage resources are also used as storage during backup and restore operations in Azure. In the cloud computing world, the features of a cloud service depend highly on its durability, scalability, accessibility, and security.

Azure Blob Storage Performance Tiers

Depending on the performance requirements to access data (low latency), Azure provides two tiers that can be selected while creating a storage account:



Importance of Blob-URL in Azure for accessing uploaded files.

Every blob file uploaded is given a unique URL (demonstrated below). The BLOB URLs follow the fixed pattern, in that the URLs are made up of the below pattern:

<StorageAccountName>.blob.core.windows.net/<ContainerName>/<FileNameWithExtension>

Eg: demostorage.blob.core.windows.net/test/toronto-skyline-from-park.jpg



Blob URLs are very useful to perform various operations on the uploaded file. For example, if an image file needs to be rendered in HTML, the URL can be used as the image source.

Using Blob URLs one can:

Storage Access Levels Hierarchy

Retrieving or accessing a blob file after uploading to a storage account in Azure, depends primarily on the access permissions at three levels:

When a storage account is created (whether Standard or Premium), by default anonymous or public access is disallowed on the level of the storage account itself. This means the blob files individually and the ability to enumerate the list of files in a container is disallowed. To allow anonymous access to storage accounts, it can configured on the storage account configuration.

Go to Storage Account and select Configuration on the left panel. Enable the “Allow Blob anonymous access”

Step-By-Step Guide To Upload a File To Azure BLOB Storage

Now we can create a container in the storage account that will store all BLOB files for us. Note, that while creating a container now, we are given the ability to set a granular access level to the container itself, since the storage account does not have restricted access anymore. Here, the container can be set to private, blob (only individual blobs of the container can be accessed on its own), and container (the blobs in the container and the container itself can be accessed, with this it is possible to enumerate all the contents of the container unlike blob access).

Once the container is created, navigate to the container. We upload a BLOB file by clicking on “Upload” in the container.Fetch the BLOB File URL since we have container level access, now all the blob files within it are also accessible anonymously. To access the file, click on it and check the URL Properties of the file.
Copy it and open it in another window. Now you are able to access the blob files via its URL.

Blob-URL After File Upload In Azure – FAQ’s

Can I prevent a blob file from having a URL so it cannot be accessed ?

Every blob file is given a unique URL by default. For making the access to a blob more restrictive you can set private access control on the storage account or container or on specific Blob files. You can generate SAS tokens on the Blob file to give temporary “time or IP address” based secure access and build your application to use these SAS tokens. One the SAS is generated, Azure provides a new Blob SAS URL with the SAS Token appended.

I have thousands of Blob documents to be stored. How can I manage them effectively ?

Containers are a great way to provide folder like segregation to your data. You can also provide tags to your Blob files based on which you can logically define your data. For example in the example of the image shown in this article, a tag with key=city and value=toronto can be added. You can then use Blob URL and REST API commands to access data based on tags you provide.

I uploaded a Blob and copied the URL but I get an error while accessing it

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>PublicAccessNotPermitted</Code>
<Message>Public access is not permitted on this storage account. RequestId:8d409365-b01e-0035-64b1-602098000000 Time:2024-02-16T08:22:45.6970043Z</Message>
</Error>

This is a common error if “Allow Blob anonymous access” is disabled on the storage account. Navigate to the Configuration blade on the storage account and set “Allow Blob anonymous access” to enabled.


Article Tags :