Magento 2 Azure Blob storage Extension is a useful module that supports media files (like product images, media in the product description and short description, etc.) for all types of products.
Moreover, the extension enables the admin to upload media files of different product types from its local disk to the Azure server.
With this module, you can connect Azure Blob Storage with Magento 2(Adobe Commerce Cloud). You can save your product assets on the cloud.
Azure Blob storage is Microsoft’s object storage solution for the cloud. Blob storage helps in storing massive amounts of unstructured data.
Check a brief overview of the plugin –
now. Read More
Features of Magento 2(Adobe Commerce) Azure Blob Storage
- Support all Magento 2 product types.
- Also, all media files of all types of products (like product images, media in the product description, short description, editing images, etc) are stored and retrieved from the Microsoft Azure Blob Storage container.
- Moreover, flexible settings to configure the module settings.
- Store and download the files from Microsoft Azure Blob Storage Server.
- Check the container availability in just a click.
- Customers can download the files from the Microsoft Azure Blob Storage irrespective of time and place.
- Additionally, the extension is fully open source and easy to use.
- One can save Static files on the Microsoft Azure Blob Storage ie (HTML, CSS, JS).
Customers will get a zip folder and they have to extract the contents of this zip folder on their system.
The extracted folder has an src folder, inside the src folder you have the app folder.
After that, you need to transfer this app folder into the Magento 2 root directory on the server as shown below.
After the successful installation of the Magento 2(Adobe Commerce Cloud) Azure Blob Storage module, you have to run these commands in the Magento 2 root directory.
First Command –
composer require microsoft/azure-storage-blob
Second Command –
php bin/magento setup:upgrade
Third Command –
php bin/magento setup:di:compile
Fourth Command –
php bin/magento setup:static-content:deploy
Moreover, after running the commands, you have to flush the cache from the Magento admin panel by navigating through->System->Cache management as shown below.
Thus, in this way, you can install the module.
Therefore, for Multilingual support, please navigate to Store>Configuration>General >Locale Options. Also, select your desired language from the Locale option.
Thus, in this way, a multi-lingual configuration can be done.
For module translation, navigate to the following path in your system app/code/Webkul/AzureBlobStorage/i18n/en_US.csv.
Open the file named en_US.CSV for editing as shown in the below screenshot.
Then replace the words after the comma(,) on the right in the file with your translated words.
After editing and translating the CSV file, you need to save the translated file name according to your region language and country code such as – de_DE.CSV.
Followed by uploading the translated file to the same folder from where you have obtained it. Now your module translation is complete.
Thus, in this way, language translation can be done.
Setup Credentials in Azure Blob Storage
Follow the steps mentioned below to create Azure Blob Storage Credentials-
Now, go to ABS Login and click on the Create an ABS Account.
After that, you will get two options: Create an ABS account for the new users.
Furthermore, Sign in to an existing ABS account for the already registered users followed by multi-factor authentication.
Alternatively, after the creation of the account successfully and next move forward to the Dashboard.
Create Storage Container
Afterward, go to the Dashboard> Storage Accounts and then move forward to creating the account as shown in the below image.
Afterward, move to the next step to click on the Create button to create a storage container.
Furthermore, move to the next step, here to need to fill in Project Details credentials to create a storage container.
Home>Storage Accounts>Basics>Project Details
- Subscription- Select the subscription in which to create the new storage account
- Resource Group- Choose a new or existing resource group to organize and manage your storage account together with other resources.
Furthermore, also need to fill in Instance Details for making storage containers-
Home>Storage Accounts>Basics>Instance Details
- Storage Account Name- Here fill storage account name to create a storage account.
- Region- To select the region, where to store the data.
- Performance- Determine, whether you want to have premium performance for block blobs, file shares, or page blobs in your storage account or to select standard as per the select plan.
- Redundancy- The data in your Azure storage account is always replicated to ensure durability and high availability. Choose a replication strategy that matches your durability requirements. Some settings can’t be changed after the storage account is created.
In the section of Security, there is a need to tick or not common features according to requirements.
Home>Storage Accounts>Advanced>Instance Security
- Require secure transfer for REST API operations– The secure transfer option enhances the security of your storage account by only allowing REST API operations on the storage account using HTTPS.
- Enable infrastructure encryption- By default, Azure encrypts storage account data at rest. Infrastructure encryption adds a second layer of encryption to your storage account’s data
- Enable blob public access- When blob public access is enabled, one is permitted to configure container ACLs to allow anonymous access to blobs.
- Enable storage account key access- When storage account key access is disabled, any requests to the account that are authorized with Shared Key, including shared access signatures (SAS), will be denied.
- Default to Azure Active Directory authorization in the Azure portal- When this property is enabled, the Azure portal authorizes requests to blobs, queues, and tables with Azure Active Directory by default.
- Minimum TLS version- Set the minimum TLS version needed by applications using your storage account’s data.
Data Lake Storage Gen2
Home>Storage Accounts>Advanced>Data Lake Storage Gen2
SSH File Transfer Protocol (SFTP)
Home>Storage Accounts>Advanced>SSH File Transfer Protocol (SFTP)
Furthermore, Enables the SSH File Transfer Protocol for your storage account that allows users to access blobs via an SFTP endpoint
Home>Storage Accounts>Advanced>Blob Storage
- Enable network file system v3- Enables the Network File System Protocol for your storage account that allows users to share files across a network. This option must be set during storage account creation.
- Allow cross-tenant replication- Allow object replication to copy blobs to a destination account on a different Azure Active Directory (Azure AD) tenant.
- Access tier- Select the tier either hot or cool.
Home>Storage Accounts>Azure Files
- Enable large file shares– Therefore, select large store files or disable this feature.
Tables and Queues
Home>Storage Accounts>Tables and Queues
- Enable support for customer-managed keys– When turned on, enables support for using customer-managed keys (CMKs) to encrypt your tables and queues.
Home>Storage Accounts>Networking>Networking Connectivity
- Connectivity method- Afterward, you can connect to your storage account either publicly, via public IP addresses or service endpoints, or privately, using a private endpoint.
Home>Storage Accounts>Networking>Networking Routing
- Routing preference– Therefore, Microsoft network routing will direct your traffic to enter the Microsoft cloud as quickly as possible from its source. Internet routing will direct your traffic to enter the Microsoft cloud closer to the Azure endpoint.
Home>Storage Accounts>Data Protection>Recovery
Therefore, to select the recovery options as per requirements.
Home>Storage Accounts>Data Protection>Tracking
Afterward, enable or disable tracking features for recovering the data.
Home>Storage Accounts>Data Protection>Access Control
Therefore, enable this feature to set a default policy at the account level. Without enabling this, you can still set a default policy at the container level or set policies for specific blob versions.
Tags are name/value pairs that enable you to categorize resources and view consolidated billing by applying the same tag to multiple resources and as well as resource groups. Therefore, if you create tags and then change resource settings on other tabs, your tags will be automatically updated.
Afterward, all the accounts storage successfully selected and review and create is a final step to create a storage account and then click on the create button after its successfully created.
Afterward, it finally create a storage account as shown in the below image.
Resource Sharing (CORS)
Afterward, after creating successfully storage, then here to check sharing resources at recent resources and select in the drop-down list Resource Sharing ie Allowed origins, Allowed methods, Allowed headers, Exposed headers Max age
Afterward, click on the Save button to move further step as shown in the below image-
The two keys allow you to replace one while still using the other and remember to update the keys with any Azure resources and apps that use this storage account.
Azure Blob Storage Extension
After the extension installation, the admin will configure the module settings by navigating to the Stores > Configuration > Azure Blob Storage as per the below image:
Static View Files Settings:
Therefore, the admin under general settings will:
- Allow files to save on Azure Blob – to save the file on Azure Blob Storage set this as YES else set it as NO.
- Account Name– Put the account name which you have created in the Azure Blob Storage account.
- Account Key – Fill out the Azure Blob storage secret key which you will get after creating the account on Azure Blob Storage.
- Container Name – Put the container name which you have created in the Azure Blob Storage account.
- Check container Availability – Click the “check” button to check the container availability. If it is available and exists in the Azure Blob Storage, it shows the message “the specified container already exists.
Else, the container doesn’t exist in azure blob storage, then it will automatically create one.
Commands to Configure the Module Settings through Command Line Interface
You can check the command line below for configuring the credentials in Magento 2 Azure Blob Storage Extension:
Active- php bin/magento config:set azureblob/general_settings/active
Account Name- php bin/magento config:set azureblob/general_settings/account_name
Account Key – php bin/magento config:set azureblob/general_settings/account_key
Container – php bin/magento config:set azureblob/general_settings/container
You need to provide the value after each command.
Static View File Settings
Another section of the admin configuration is the Static View File Settings where the admin needs to configure fields such as Enable for Static View Files, and Container Name, as shown in the image below.
The admin can configure the following fields under Static View Files Settings-
- Enable for Static View Files- The admin can set this field as Yes or No.
- Container Name– Now, the admin needs to add a name for the Container.
Storage Configuration for Media in Magento 2 Azure Blob Storage
Firstly, the admin can run the command in the Magento 2 root directory:
php bin/magento azureblob:export
Therefore, just after running this command, the Media Storage field will get set to the Azure Blob Storage automatically and all media will get synchronized.
Secondly, this can be done manually by moving to the Advanced > System menu option under the configuration setting. For setting up the Storage Configuration for Media.
Under the Media Storage field, the admin will select the media storage location where all the website media will get the store.
After selecting the Azure Blob Storage from the list, the admin needs to click on the Synchronize button to synchronize all media with the Azure Blob Storage and then “Save Config“.
Note:- Media will not be available in the new location until the synchronization process is complete.
Setting Up Base Url and Base Url (Secure) in Magento 2 Azure Blob Storage for user media files
The admin needs to now navigate to the web sub-menu option under the general setting option, to configure the Base URLs settings.
Further, in the Base URL for User Media Files option, the admin will enter the Azure Blob Storage Container URL that saves and retrieves the media files.
Navigate to Azure blob storage dashboard>select container>Conatiner Properties than check container URL as below image:
Also, we can set the base URL for media file running the following command-
Base Url change:
Media file: php bin/magento config:set web/unsecure/base_media_url
Base Url Secure change:
Media file: php bin/magento config:set web/secure/base_media_url
Setting Up Base Url in Magento 2 Azure Blob Storage for Static files
Initially, the admin needs to run the following command-
php bin/magento azureblob:static-content-export
Once the above-mentioned command run, all the static files will be import to the server as shown in the image below.
Also, we can set the base URL for static file running the following command-
Base Url change:
Static file: php bin/magento config:set web/unsecure/base_static_url
Base Url Secure change:
Static file: php bin/magento config:set web/secure/base_static_url
*Above-mentioned command will be followed by the Azure Blob Storage Container URL( container URL followed by the forward slash)
- One must always run “php bin/magento import:static-content” command, just after “php bin/magento setup:static-content:deploy” command.
- It is better to use the static files feature in the production mode.
The Azure Blob Storage Container URL is responsible for saving and retrieving the static files.
Uploading Downloadable Product
After the successful module configuration by the admin, the admin can now upload the media files concerning the products on the Azure Blob Storage.
For this, the admin will navigate to the Products -> Catalog -> Add Product as per the below image.
Select Downloadable Product from the Add Product drop-down list. This will navigate you to the New Product page.
Here, the admin will fill in all the required details of the downloadable product and upload the downloadable file, and hit the Save button.
After saving the downloadable product, the file gets saved on the Blob Storage and therefore, will get the link.
Note: The admin will get the Azure Blob Storage link only after saving the product successfully.
The customer will download the product from Azure Storage just like any other product from the local Server.
However, if we are talking regarding the downloadable product, the customer can download the product only after the admin has created the order invoice.
1. For previously created downloadable products, we have to again save these products for storing downloadable product files to Azure Blob Storage
2. To whitelist domain for downloadable product use command: php bin/magento downloadable:domains:add <domain_url>
Further, in this module, the data will get stored in Azure Blob Storage for all types of products. The data includes media files.
Media files are the images/ videos associated with the products. These images and videos are generally used to show the product details and give a better description of the same.
For example, the product’s main image, configurable images, demo product video, description image, GIFs, audio node, etc all fall under the category of media files.
So, whether it is any of the simple, virtual, configurable, grouped, bundle, and downloadable products, the media files will get store in the Azure Blob Storage Container.
Further, when the customers will view the product they will get to see the product image will appear quickly. Also, the upload and retrieval rates are pretty quick for media files.
Frontend Product Page View
Hence, the appearance of the same product in the store frontend will be the same as shown in the image below.
Moreover, if the customer will view the image in the new tab, the source includes the URL as shown in the image below.
CMS Page View
The images or media files are present anywhere in the store. Therefore take an example of the CMS pages. This CMS page contains regular images, these will also be fetch.
Furthermore, the same will happen with the images in CMS pages too.
Now, wrapping this up, this shows that all the images get retrieved from the Azure Blob Storage if the same will be used as the storage area.
Thus, that’s all for the Magento 2(Adobe Commerce) Azure Blob Storage Extension module. Furthermore, if you still, have any issues, feel free to add a ticket at webkul.uvdesk.com
Current Product Version - 5.0.0
Supported Framework Version - 2.0.x, 2.1.x, 2.2.x,2.3.x, 2.4.x