You can configure ImageKit.io to fetch images from your Azure blob storage. This allows you to start leveraging ImageKit.io real-time image resizing, optimization, and fast CDN delivery for thousands or millions of existing images within minutes.
Note: We do not start copying images from your storage as soon as you add it. Instead, we will fetch the particular image when you request it through ImageKit.io URL-endpoint. Learn more to understand how this works. The images accessed from this origin will not appear in your Media library.
The following tutorial will help you create a Shared Access Signature (SAS) token that will allow ImageKit to access the images in your Azure storage container. This allows you to restrict ImageKit to only reading objects from your container. i.e. ImageKit will not be able to create/delete/update objects in your container.
Sign in to your Azure Account through the Azure portal.
Select Storage Accounts.
Select the corresponding storage account.
Search for the Shared Access Signature setting in the settings pane on the left.
Now, select the options as shown in the following image. This ensures that ImageKit is allowed to only read images from your Azure container.
Enter an End expiry time that is practically infinite. Preferably, enter a time 10 years from the start time (which should be right now)
Click on 'Generate SAS and connection string'
Note down the SAS token generated.
We have now created a SAS token for ImageKit and granted it the Read permission for your container, which means that ImageKit can do nothing more than just read objects in your container. At this point, you should have the following values with you:
Azure storage account name: The name of your storage account.
Azure storage container name: Name of the container that you want to integrate.
SAS Token: As generated in step 1.
Now, go to the External Storage section in the dashboard, click on the Add New Origin button, select Azure Storage in the Origin Type field, and enter the corresponding values, and click submit.
When you add your first origin in the dashboard, the origin is by default made accessible through the default URL-endpoint of your ImageKit.io account. For subsequent origins, you can either create a separate URL-endpoint or edit the existing URL-endpoint (including default) and make this newly added origin accessible by editing the origin preference list.
Let's look at a few examples to fetch the images:
Original image through Azure blog storage (old URL) https://storagesamples.blob.core.windows.net/rest-of-the-path.jpg
The same master image using ImageKit.io URL-endpoint https://ik.imagekit.io/your_imagekit_id/rest-of-the-path.jpg
Resized 300x300 image
So when you request
ImageKit.io uses the SAS token provided by you to fetch the original image from the path
rest-of-the-path.jpg in the Azure container using the official Azure SDK.
URL-endpoint transformation image path┌─────────────────────────────────────┐┌─────────────┐┌───────────────────┐https://ik.imagekit.io/your_imagekit_id/tr:w-300,h-300/rest-of-the-path.jpg
If you get a "Not found" error while accessing the image, check out this troubleshooting guide.
Now start using ImageKit.io URL endpoint in your application to accelerate image loading.
Get started with our quick start guides and SDKs:
Learn about real-time image resizing: