The Attachment Management Add-in is out there on the AppSource for quite some time, I recently enabled it for an internal Dynamics 365 implementation where the native SharePoint integration couldn’t be used due to the multiple tenant authentication issues and the new storage model licence wasn’t there to store/attach documents on default CDS file storage.
This add-on feature is to manage note and email attachments using the Azure Blob storage which will enable users to create and maintain files stored on Azure Blob via the Dynamics 365 app.
If someone is previously using this add-on, in the latest release, we also have a choice to move to default CDS file storage instead of a Custom Blob storage.
For those who don’t have appropriate licence of default CDS storage, this add-in will benefit them managing large number of file attachments by storing the files in Azure Storage rather than the D365 DB, reducing the cost of storage as Azure Storage is significantly less expensive than additional Dynamics 365 Storage.
Following are the benefits of using Attachment Management Add-on:
So, let’s have a look at this feature using the Azure Blob storage.
Prerequisites:
The only prerequisite is to have a valid Azure Subscription and a Blob Storage Account.
Install Attachment Management Solution:
Let’s begin by installing the ‘Attachment Management’ solution from the AppSource.
Step 1: Go to the attachment management add-in on the AppSource and click on ‘Get it now’ button.
Step 2: When prompted, we will need to sign in with our admin credentials for the Dynamics 365 app to install the solution, accept the terms & conditions and click continue.
Step 3: On the Power Platform Admin Center page, select the environment, accept the terms & click on the Install button.
It can take some time for the solution to be installed to your environment, once done, we can verify the solution on https://make.powerapps.com/
Create and Configure Azure Blob Storage Account:
Please refer to this article for the detailed steps to create an Azure Blob Storage account.
Once we have the blob storage account created, we can proceed with creating containers (documents will be stored) and generate the SAS key.
We’ll need to create two containers as follows:
Step 1: Log in to the Azure Portal and navigate to the Azure blob storage account à Look for ‘Containers’ under the Blob service area and click on the + button to create new blob containers.
Please remember to select the access level as ‘Blob’ type.
Step 2: Once containers were created generate the SAS key and connection string for the connection with dynamics 365.
Click on the Storage Account where we create the containers for Emails and Notes Attachment Containers à Go to ‘Shared Access Signature’ to generate SAS key.
Before clicking on the ‘Generate SAS and connection string’ button, ensure that resource type and date time zone are selected correctly.
Click on ‘Generate SAS and connection string’ button and take note of the SAS Token.
Configure Dynamics 365 Blob Storage Connection and Entity forms:
The next steps will be to connect the Dynamics 365 app with our storage account and configure the entity forms to display the attachment web resources.
Step 1: Navigate to Dynamics 365 à Azure Attachment Storage settings à click on Azure Blob Storage Set up.
Complete the details as given below:
Storage Account Name: this will be the Aure storage account name.
SAS Token: place the SAS key we generated in the previous step.
Notes Attachments Container : provide the exact name of the notes container we created in the previous step.
Email Attachments Container : provide the exact name of the email container we created in the previous step.
Organization GUID : This is optional, The Organization GUID value provided here will be taken as a reference while deleting attachments from the blob.
Click confirm to save the configurations.
Step 2: Navigate to the ‘Notes Attachment Entity Settings’.
This area will display a list of all entities that are mapped with or without associated container names. Selecting the entity and setting the container name effectively maps the attachments to Azure Storage Blob container.
Click on Save to save the configurations.
Step 3: Now let’s configure the entity to display the web resource to allow users to view/upload attachments.
The solution comes with two web resources:
msdyn_filesandattachments.html: to manage the Notes and Attachments within a Grid-style format, allowing for single or multiple selections for download or delete.
msdyn_multiple_uploads.html: this page provides code to upload multiple files, as well as code for saving email attachments using the Email form.
Add the web resources by selecting the entity form. You may need to add a new tab and sections.
Click on Save and Publish all customisations.
Step 4: Navigate to any account record and ‘Blob Attachments’ tab to access the feature.
Click browse to upload the file(s) or drag and drop files to the space available.
The uploaded field can be viewed under the “Notes Attachments” section.
The uploaded files are also available on the Azure Blob storage container.
Important Notes:
Hope you find this post helpful.
Please drop your questions or suggestions in the comment box below.
Thank you for reading.
Original Post https://virendraagrawal.com/2020/10/26/manage-dynamics-365-attachments-using-azure-blob-storage/