All Media files for Umbraco Cloud projects are stored in Azure Blob Storage containers. Each environment has a separate container linked to it.
All media files on your Umbraco Cloud projects are stored using Azure Blob Storage. This means that the media files are not stored with the rest of your project files but in an external storage system.
To access the media files on your Umbraco Cloud project you can either:
Clone your Cloud environment to your local machine (Recommended)
Azure Blob Storage is an external storage system, that the Umbraco Cloud service uses to store all media files on Umbraco Cloud projects. This includes everything that is added to the Media library through the Umbraco backoffice, eg. images, PDFs, and other document formats.
You can learn more about Azure Blob Storage in the Microsoft Documentation.
When you clone one of your Cloud environments to your local machine, you will need to run a content restore from the backoffice to get a copy of all the media files from the Azure Blob Storage container connected to that environment.
You can learn more about how this works in the Restoring content article.
When you add new media files to your project while working on a local clone, the files will automatically be added to the Azure Blob Storage container connected to the environment you deploy to.
Each environment on your Umbraco Cloud project has a separate Azure Blob Storage container. Each of your environments uses a storage container specific to that environment.
When you deploy between two environments on your Umbraco Cloud project the media files will be copied from one storage to the other, depending on which environment is being transferred to and from.
As an example, imagine that you are transferring new content changes from your Development environment to your Live environment. When you initiate the transfer, all media files from the Azure Blog Storage container connected to your Development environment will be copied and pasted into the container connected to your Live environment. Once all content changes have also been transferred, and the transfer is complete, your Media libraries on the two environments will now be in sync.
You will notice that there is a Media (wwwroot/media
) folder in your project files. This folder usually holds all media files associated with a Umbraco project. As your Umbraco Cloud environments are all configured with Azure Blob Storage, the media files are not in this media folder.
Instead, you will find a project.assets.json
file in the obj
folder. This file is used to connect the Media library on your Cloud environment to an Azure Blob Storage container.
In some cases, you might want to connect to your Azure Blob Storage container for the environments on your Umbraco Cloud project. This could be to clean up unwanted media files or to download the current contents of the library.
Instead of connecting to your Azure Blob Storage container using the following approach, you can clone your Cloud environment to your local machine and access the files from there.
You should only use the following approach when you do not have the option to clone down the environment to your local machine.
To do this, you need to know some details about the connection between the environment and the Azure Blob Storage containers. Below are the steps you need to follow, to locate the necessary variables:
Access Kudu on your Cloud environment.
Locate the Environment page in the top navigation.
Scroll to the section containing Environment variables.
There are 4 variables related to the Azure Blob Storage container in your environment:
APPSETTING_UMBRACO__CLOUD__STORAGE__AZUREBLOB__CONTAINERALIAS
APPSETTING_UMBRACO__CLOUD__STORAGE__AZUREBLOB__CONTAINERNAME
APPSETTING_UMBRACO__CLOUD__STORAGE__AZUREBLOB__ENDPOINT
APPSETTING_UMBRACO__CLOUD__STORAGE__AZUREBLOB__SHAREDACCESSSIGNATURE
Once you have the variables, use the "Connect to Azure Storage Explorer" guide to connect to your storage container.
Connect to Cloud environment's Azure Blob Storage programmatically.
This article provides the steps needed to programmatically connect to your Umbraco Cloud Environment's Azure Blob Storage containers, to persist files programmatically. You will need access to the Blob Storage credentials to authenticate and find the files created programmatically in the Azure Blob Storage.
By the end of this article you will have connected and uploaded a file to your Cloud Blob Storage. The list of the files within the folder will only be available on the Azure Storage so they are not visible publicly. This is with the exception of each individual file that can be shared publicly via the *.blob.core.windows.net
URL.
An alternative to this guide is to use Umbraco Storage Providers package or MediaFileManager.FileSystem
abstraction from the Custom File Systems (IFileSystem) article.
Follow these steps to get started:
Clone down your Umbraco Cloud Project. You can find more information on how to clone a project in the Working Locally article.
Run your project.
Install Azure.Storage.Blobs
package on your project. You can do it either via NuGet Package Manager on Visual Studio or install it via NuGet.
Run the project to complete the installation of the package.
Add a new class called BlobStorageService
which serves as a service that has a method to connect to Blob Storage:
Add a new class called BlobStorageComposer
to inject the service:
Add a new class called BlobStorageController
which serves as the Surface Controller:
Here, the controller is used to create a directory named FolderProgramatically
and a .txt
file in Azure Blob Storage.
In the above code, update the SASUrl
and containerName
values with your own from the Umbraco Cloud Settings. To find these values, refer to the instructions in the Connect to Azure Storage Explorer to upload files manually article.
You can also secure the values in Secrets Management in the project Settings on Umbraco Cloud so you do not store them in code. For more information, see the Secrets Management article.
Run the project.
Visit the {{yourProjectURL}}/umbraco/surface/BlobStorage/BlobUpdate
endpoint in the backoffice of your project to manually trigger the creation of the file to the Blob Storage.
Connect to your Blob Storage and there you will find the folder and file that has been created programmatically:
For more information, see the following articles from Microsoft:
All Media files for Umbraco Cloud projects are stored in Azure Blob Storage containers. Each environment has a separate container linked to it.
In case, you want to manually upload files to the Azure Blob Storage container provided to your Umbraco Cloud environments, you can take advantage of the "Microsoft Azure Storage Explorer" software.
This article provides the steps you need, to connect to your Azure Blob Storage containers using Azure Storage Explorer.
We strongly recommend that you add all the media items to your Cloud environments through the backoffice. Clone your environment to your local machine to manage the files of your media library.
Important: If you upload your media files manually using this method, they will not be available in the backoffice.
All media needs to be added through the Umbraco backoffice.
The first thing to sort out, if you want to connect to the Azure Blob Storage container of your environment is the credentials. You can find the credentials under the Connection Details`section from the Settings dropdown on the Umbraco Cloud portal for your Umbraco Cloud project.
The next step is to have Azure Storage Explorer installed on your local computer. Download the storage explorer, and run through the installer.
Let's use the information you have gathered, and connect Azure Storage Explorer to the Blob storage container:
Click the Open connect dialogue button to get the Connect dialogue.
Select Blob container in the first prompt.
Select Shared access signature URL (SAS) in the second prompt.
Input the information you have gathered earlier in the following format [Endpoint][ContainerName][SharedAccessSignature]
, in the URI field. See below for an example.
Ensure that the credentials are correctly set in the Connection Summary prompt.
Select Connect.
Open the media folder. You now have access to the Azure Blob Storage container for your environment.