Why would you want to print your D365FO reports to Azure storage?

Azure Blob Storage

If you check your options with SSRS print management, you will see that they are pretty modest. You can view or print reports, and do some basic emailing and archiving. For example, reports are emailed without the email body and archived with no metadata. Not so good distribution options, right? Fortunately, Docentric delivers significantly improved print destinations to the D365FO community completely free of charge. Find out more >>

One of the improvements we delivered is printing reports to Azure Blob storage. One might ask, why would you want to do that? Well, back then in AX 2012 you could simply print your report output files to a shared network folder, or at least use File system for saving temporary files for some custom scenarios or integrations. Today, in the D365FO cloud environments when printing reports as files, we are limited to downloading the generated documents in the browser. Consequently, we cannot even print report output files in batch!

This is why Docentric introduced printing reports to SharePoint, OneDrive, Attachments and Azure Blob storage – all of them with dynamic and multilingual print settings. For example, you can set up the output filename or SharePoint target folder to contain labels and placeholders, e.g. @SYS14204@ @InvoiceID@.pdf > Rechnung CIV-00045.pdf.

D365FO Azure Blob storage

In D365FO, Azure Blob storage became a kind of substitute for File system, at least in terms of storage for temporary files such as EMF images consumed by DRA or files sent to users for downloading in the browser. Also, D365FO permanently stores documents from Attachments in Azure Blob storage, if their Document type is of that kind (Location = Azure storage).

How to print a report to D365FO Azure Blob storage

You can easily print a report to Azure Blob storage by using Docentric File print destination.

 

Note that you can use placeholders to make the print settings dynamic. We used @COMPANYID@ and @CURRENTYEAR@ in the Blob path setting.

Let’s now see what you can do next if you’ve printed your reports to Azure Blob storage.

Microsoft Azure Storage Explorer

First of all, you can browse or download your printed documents from Azure Blob storage using Microsoft Azure Storage Explorer.

Microsoft Azure Storage Explorer

Learn how to connect to D365FO Azure storage from MS Azure Storage Explorer >>

Advanced reporting scenarios inside D365FO

As mentioned earlier, you can use Azure Blob storage for some custom scenarios. We created one such example, where we used Docentric File print destination to save generated invoices to Azure storage during the posting. At the same time, the blob name is stored in Invoice journal, so a user can download the invoice document directly from the journal anytime.

Later on, at the end of the billing period (e.g. each month), a user can send all customer invoices from the current billing period in the single email. This is possible because we stored the posted invoice documents on Azure Blob storage, and we could fetch them when creating emails with multiple invoices for each customer.

Learn how to send multiple customer invoices in a single email >>

Integration scenarios

For customizations inside D365FO as described previously, using D365FO Azure Blob storage is sufficient. However, since this is the internal storage dedicated to a D365FO environment, it is not recommended to use it for integration scenarios with other parties. This is why Docentric, starting from the 3.3.8 version, also supported saving reports to any Azure Blob storage, not just the internal one.

Printing reports to an external Azure Blob storage

In order to print a report to an external Azure Blob storage, you have to set up Azure storage account and its connection string first (Docentric AX workspace > Related links > Setup > Azure storage accounts). Afterwards, in Docentric File print destination, just select the new account in the Azure storage account combobox and print the report.

 

Using Azure Blob storage with Azure Functions and Event Grid

Let’s say that we need to save invoices, which are automatically generated during the posting process, to our Customer Portal, where the customers can browse and download them. There are many ways to implement this scenario, and one of them is to use Azure Blob storage in combination with Azure Functions.

Azure Functions are serverless functions that allow running custom code without worrying about application infrastructure, are highly scalable and cost-effective, and can be triggered by Blob storage events, Event Grid, HTTP requests, Timers, Service Bus Queue messages, and more.

The idea here is to enable the printing of invoices during the posting to a particular blob container located in an external Azure Blob storage. We can do this by using Docentric File print destination as described above.

Next, we will need an Azure Function that will be triggered automatically each time a new blob (i.e. invoice document) is added to our blob container, without any type of polling or fixed run schedulers. We can do this by using a blob-triggered function but, according to Microsoft, a blob-triggered function may not be triggered immediately and also there is no guarantee that all events will be captured, which means that it’s possible for some new blobs to be missed and not processed.

The reliable alternative to a blob-triggered function is to use Azure Event Grid, an eventing service which can also trigger Azure Functions to handle Azure Blob storage events such as adding a new blob to a particular container by creating an Event Grid subscription in Azure portal.

Basically, the only thing left for implementation here is the Azure Function, which should copy a newly inserted blob (i.e. invoice document) to our Customer Portal.

Conclusion

Saving reports to D365FO Azure Blob storage can be useful if you need to accomplish some advanced scenarios inside D365FO, because it is a good choice for permanent but also for temporary file storage.

On the other hand, saving reports to an external Azure Blob storage is suitable for integration scenarios, and it’s quite easy to implement one, highly scalable and cost-effective, by using Azure Blob storage in combination with Azure Functions and Event Grid.

It’s definitely a good news that you can now print your reports to the internal or any external Azure Blob storage by using Docentric and more easily achieve advanced reporting and integration scenarios.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Docentric respects your privacy. Learn how your comment data is processed >>