attachment management u azure blob storage · this solution benefits organizations with large...

20
Page 1 | 20 ATTACHMENT MANAGEMENT USING AZURE BLOB STORAGE A Solution to help optimize Dynamics 365 CRM storage by automatically saving file attachments to Azure Blob Storage MICROSOFT LABS

Upload: others

Post on 04-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 1 | 20

ATTACHMENT MANAGEMENT

USING AZURE BLOB STORAGE

A Solution to help optimize Dynamics 365 CRM storage by automatically saving file attachments to Azure Blob Storage MICROSOFT LABS

Page 2: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 2 | 20

Table of Contents 1 Overview ....................................................................................................................................... 4 2 Attachment Management Configuration ......................................................................................... 4

2.1 UI Configuration ...................................................................................................................... 5

2.2 Optional Configuration ............................................................................................................ 6 3 End User Experience ...................................................................................................................... 8 4 Notes Attachment Settings.….……………………………………...…………………………….11

4 a. Reports and Admin…………………………………………………………………………….12 5 How to confirm files are getting stored in Blob……………………………………………………………………………………13

6 Custom entity access, by other Roles (apart from SYSTEM ADMIN)………………………………………………………….…………....16 7 How to Generate SAS Key………………………………………………………………………………………………………………... 19 8 Troubleshooting Steps ........................................................................................................................................................................ ..21

Page 3: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 3 | 20

1 Overview

The Attachment Management Solution is an add-on feature to dynamics 365 CRM to manage note

and email attachments using Azure Blob storage. It enables users to create and maintain files stored

on Azure Blob through the D365 CRM application. This solution benefits organizations with large

amounts of file attachments by storing the files in Azure Storage rather than the CRM database. This

reduces the cost of storage since Azure Storage is significantly less expensive than additional

Dynamics 365 Storage.

Attachment Management benefits:

All attachments stored in Azure Blob • Optimizes the use of Dynamics 365 storage. • Attachment retrieval on demand.

Multi attachment upload/Download Control (Optional) • Drag/Drop. • One-click download of multiple selected attachments. • Preview of attachments.

This solution is built on Dynamics 365 and seamlessly works on Dynamics CRM 2016 and above.

2 Attachment Management Configuration

The Attachment Management solution can be used for any Dynamics 365 system or custom entity,

which is enabled for Notes and attachments.

The below diagram summarizes the configuration and usage of Attachment Management solution

and the processes that runs in the backend.

This section outlines the steps to be performed by a System Administrator to make Solution

available to the end users.

Pre-requisites:

1. Valid Windows Azure Subscription and Storage Account (Blob) created

2. Attachment Management solution installed in the Dynamics 365 organization

Page 4: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 4 | 20

2.1 UI Configuration

1. Open Microsoft Dynamics 365 2. Navigate to Azure Attachment Storage -> Azure Attachment Storage Configuration

3. Click on Azure Attachment Storage Configuration to provide azure storage configuration information

Name: Azure Storage Account Name SAS token: SAS token available in the Storage Account. (How to Generate SAS) Note: Please make sure the Start Time and End Times are chosen correctly while generating

the SAS token. Please refer “Best practices when using SAS” section here for more

Page 5: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 5 | 20

information on Start Time. Notes attachment Container Name: Container name created for Notes Email Attachment Container Name: Name of the container created for the email attachment.

Page 6: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 6 | 20

2.2 Optional Configuration

This section provides information on optional functionality of uploading multiple Notes and

attachments at one go offered by Attachment Management solution by using web resources into the

Entity form. Here we have provided example of tab created on business entity case main form. Below are the required web resources for attachment functionality.

msdyn_filesandattachments.html – This web resource will list all the Notes and email attachments in grid format on the form.

User, would able to delete and download single /multiple files from the grid.

msdyn_multiple_uploads.html – This web resource contains the code to upload multiple files. Also, contains the code to show

only the email attachments when it is used in Email form.

Steps to configure web resources for multiple file upload functionality

1. Edit Entity form to create new tab and insert “msdyn_multiple_uploads.html” web-

resource for the multiple upload functionality for Notes and attachment.

Page 7: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 7 | 20

2. Publish all changes made and navigate to case entity and open case form. User should be able to see the tab created for the Notes and attachment uploading.

3. Create another Tab named “Attachments” to download and delete uploaded files in one go.

Insert html web resource msdyn_filesandattachments.html in newly created tab.

4. Publish all changes made and navigate to Case main form. The User should then be

able to see below tab on the form.

Page 8: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 8 | 20

3 End User Experience

Once the solution is imported and configured in the Dynamics 365 organization, a user can

upload and create Notes and store the attachments in Azure Blob Storage. The steps

outlined below illustrate creating a note with attachment and verifying the attachment is

stored in Bob Storage.

1. Navigate to a Business Entity (e.g. Case)

Page 9: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 9 | 20

2. Open a Case record

3. Create a note against the case with an attachment.

4. Verify the Notes attachment is stored in Azure Blob storage. The file name is formed by concatenating the parent entity record ID (here Case GUID) and attachment file name (Agreement_Details.docx): 5b40dd-34c6-e611-80ee-346bac894c_Agreement_Details.docx

5. If a user deletes a Notes record, any related attachment will be deleted from the

Azure Blob Storage.

Page 10: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 10 | 20

4 Notes Attachment Settings This section provides information on, the purpose of Notes Attachment Setting.

Notes Attachment Setting Page, is to provide the System Admin a complete choice of

choosing the entities (annotations attached), to move only notes attachment to Azure Blob

Storage from CRM, which are associated with Annotations entity.

System Admin, can select the required entities in the list (Entities available in the list are

with Schema Names. For Eg: If it’s the Case entity that Admin wants to select, it’s available

as incident in the list) available on the Notes Attachment Setting Page, as shown below.

Once the System Admin selects entities and clicks on Save button, the notes attachments

which are available in the selected entities will only be moved to Azure Blob Storage

Settings.

Note:

1. If none of the entities have been selected from the available entities in the Notes Attachment Setting Entity list, notes attachments won’t be moved to Azure Blob Storage.

2. CRM Portal: To reflect the UI changes done on CRM Portals, the CSS and Image files to be stored in CRM only. So, while selecting the entities from the Notes Attachment Setting Entity list, please un-select the entity called adx_webfile in order to maintain the UI changes implemented on portals.

Page 11: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 11 | 20

4 a. Reports and Admin

This section provides information on Reports and Admin Dashboard.

Reports and Admin, is a useful tracker for CRM system Admins to track the available

attachments in CRM and number of attachments moved from CRM to blob and

displays the Notes Attachment and Email Attachments count available in CRM and

moved to blob from CRM as shown below. System Admin, now can easily move

existing attachments stored in CRM, after installing the Azure Attachment

Management.

Move To Blob:

When user clicks on Move To Blob button, it will start processing all the attachments

data stored in CRM to Azure blob storage at one go. (Once, user clicks the button, it

will take care of the all the attachments processing of moving them from CRM to

Azure Blob.)

Stop Processing:

After clicking of Move To Blob button, in case if the user/system admin wants to

stop the process of moving the attachments from CRM to Azure Blob storage, yes,

they can do that any point of time once by clicking Stop Processing button. It will

Stop Processing of moving the attachments data from CRM to Azure Storage blob.

Page 12: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 12 | 20

5 How to confirm files are getting stored in Blob

For Notes: Approach 1:

1. Attaching a file to a case record

2. Checking the file size with the help of Advanced Find query: Where File Size = 0 From the above result, it’s confirmed that, the file size is ZERO in CRM DB.

Page 13: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 13 | 20

Approach 2:

1. Checking the file size with the help of Advanced Find query: Where File Size > 0

2. The result we get is “No Note records are available in this view“.

So, the second query also confirmed that the file is not getting stored in CRM.

Email Attachments: Approach 1:

1. Attaching a file to an Email Record

2. Checking the file size with the help of Advanced Find query: Where File Size = 0

Page 14: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 14 | 20

From the above result, it’s confirmed that, the file size is ZERO in CRM DB. Approach 2:

1. Checking the file size with the help of Advanced Find query: Where File Size > 0

2. The result we get is “No Email records are available in this view“. So, the second query also confirmed that the file is not getting stored in CRM.

Note: The File Size field value in the Advanced Find query, gets populated dynamically from the related Blob information of that particular attachment, which is being handling thru a plugin in the back-end.

Page 15: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 15 | 20

6 Custom entity (Azure Blob Storage Settings) access, by other Roles (apart from SYSTEM ADMIN)

This section helps on how to provide custom entity access (Custom Audit History), to other

roles (apart from System Admin).

Scenario: System Admin, wants to provide Audit related info access to Sales Manager role.

1. Login to the CRM, and Go to Settings > Security.

2. Click Security Roles and click on Sales Manager role.

Page 16: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 16 | 20

Page 17: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 17 | 20

3. Go to Custom Entities tab and provide all these read/write/update/assign/assigned

permissions for Sales Manager, as shown below

Page 18: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 18 | 20

How to Generate SAS Key This section, helps with the steps to generate the SAS Key

1. Go to https://ms.portal.azure.com

2. Click on the Storage Account, created for Emails and Notes Attachment

Containers.

3. You can find, Shared Access Signature, below to Add Azure Search, as shown

below

Page 19: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 19 | 20

You will be taken to SAS key generating page, as shown below

Before, clicking on Generate SAS, please make sure the Start and End times

for SAS key, because by default it would be in UTC time zone, which varies

with local time zone.

Best Approach is to take your local Previous Date as Start Date and any

Future Date as End Date while Generating SAS KEY, in order to avoid access

related issues.

Page 20: ATTACHMENT MANAGEMENT U AZURE BLOB STORAGE · This solution benefits organizations with large amounts of file attachments by storing the files in Azure Storage rather than the CRM

P a g e 20 | 20

8 Troubleshooting Steps

System Administrators can use the quick tips below for troubleshooting in case of any issues:

1. Ensure Azure Storage account details have been entered correctly.

2. Ensure the plugin steps have been registered for the event e.g. Post Create of Entity.

3. Navigate to ‘Customize the System’ and ensure you click ‘Publish all

Customizations’.

4. Make sure the Azure Blob Settings configuration information is correct e.g. The

“Name” in the Container properties pane should match the name of the Container.

Please make sure the Start Time and End Times are chosen correctly while generating the

SAS token.

5. To get the custom entity (Azure Blob Storage Settings) in the Settings module, please

follow the below steps.

a. Click Settings, click Customizations and click Customize the System.

b. Under Components, expand Entities and select Azure Blob Storage Settings entity.

c. Under the Areas that display this entity, select the areas to display the custom entity.