Cost Saving in Dynamics 365 Online with Portals

If you’re a Dynamics 365 Online (D365) developer, you’ll know about that pesky yellow bar that pops up every time you near your storage quota. What’s even worse is that at the time of writing this article it’ll cost you an extra £9.99 per month per GB of space. Now, for those who have bottomless pockets this is probably fine but for those who are cautious about how much they’re spending we want a way to reduce this cost.

D365 is made up of several components: entities, records, lists, dashboards, reports etc… Each of these have a storage requirement attached to them. As we create more and more records the requirement for a larger storage quota increases. This solution isn’t designed to fix this but rather support the storage of documents without the need of storing them in D365. Additionally, we’ll also cover how these can be integrated with a Dynamics Portal. Now if you do want to store documents in D365 you can always tailor the attachment file size limits through the system settings, but this still means you’re paying for that “premium” storage. Instead we can utilise an Azure Storage Account to store these attachments externally.

The first thing we need is to setup an Azure subscription. This is where you can create the Storage Account and ultimately where your documents will end up. Once that’s completed we can provision a new Storage Account resource. Here is where your D365 documents will be stored in an easy to navigate file structure. Before you move onto the next step be sure to get the connection string from one of your keys by navigating to “Access Keys” on the account. Once we’ve got these keys we can move onto configuring D365. You need to create a new setting to accept the new storage container this is achieved by navigating to D365 > Settings > Settings. Name it as follows:

FileStorage/CloudStorageContainerName

Once this has been added we need to add a cross-origin resource sharing (CORS) rule on the storage account. This ensures that these documents are marked as being in Azure in D365. Further details of this configuration can be found here:

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/portals/enable-azure-storage

When integrating with the Dynamics Portals be sure to add your connection string to the site settings through Portals > Site Settings. Again, this information can be found through the above link. But we’re not done there! We still need a way to upload documents from D365 to Azure. We can read them just not write. Here’s where we need to make some custom changes to your web forms. To do this navigate to the entity through the editor and open the form editor where your form can be modified.

In the form editor insert a new web resource and select the following:

Adx_annotations/adx.annotations.html

A name and label can be added to this resource, be sure to add the following custom parameter:

azureEnabled=true

Once you’ve saved and published this new control it’ll be present to Portal and D365 users. Their documents can now be uploaded and downloaded from either platform. More information about this integration can be found here:

https://docs.microsoft.com/en-us/dynamics365/customer-engagement/portals/add-web-resource

About the author