PowerAzure365

View Original

e-Invoicing Service for Dynamics 365 Finance and Operations

Hello the Community, new year, new blog post! Let’s start in 2021 with a new feature that sounds very interesting for Dynamics 365 Finance: Electronic Service. Again a new feature out of the box by Microsoft, but you will see that we can really go further with the Electronic Reporting Module, as well as the RCS: Regulatory Service to manage different types of integration with the government like SDI Service for Italy, with certificates, EDI, transformation and direct integration.

SO… What is this new feature?

First, all this topic will be provided by the 10.0.18 (PU42) version of Dynamics 365 F&O. This feature is in GA state from 10.0.18. Please use this version to check Electronic Service. And Second, thank you Microsoft to have a close relationship with me about this feature, it’s great to have feedbacks and meetings to discuss, and share business requirements and participate with the roadmap. If you have (you the reader, yes you !) feedbacks to share or questions, don’t hesitate to put comments below at the end of this article.

—Update (May 2021): The feature is now on General Availability and available for everyone!—— Please forgive me if you read the article now and replace everykind of screenshot without the term “Preview” - I wrote the article first in January 2021 as it was in Preview back then. As you will see now in the release note with 10.0.19 + PU43, Microsoft will release much more configuration files for more countries / localization. It’s time for you to really use it and try it now ! :)

As always for you, as a customer and also a partner, I suggest going directly to the Yammer Insider Group of D365 F&O in which you can contact and get a lot of answers for you (you have a dedicated group for eInvoicing for example) : https://www.yammer.com/dynamicsaxfeedbackprograms/

Let’s talk about the business cases/requirements first to understand what are the goals behind the scene

Electronic Service in Dynamics 365 Finance and Operations (aka before e-Invoicing Service, yes an another tool rename again by Microsoft - it was the name during the Preview in fact), is a scalable multitenant to process invoice documents and other configurable document exchange to any government service. It’s fully configurable, editable as you want, using behind ER module/files from LCS as part of the Globalization features provided by Microsoft (SAF-T Files, invoice model, other Audit Files, Law requirements files etc…)

Electronic invoicing doesn't support on-premises deployments.

Electronic invoicing is available in several Azure datacenter geographies.

SERVICE ENDPOINT: Azure datacenter geography => United States, Europe, United Kingdom and Asia (as of today in May 2021 now)

As always now I would say, every global new feature is always using an LCS Add-in, outside of D365 F&O - and will use again Azure Components and other stuff that I will explain to you during this article.

To summarize, Electronic invoicing can help you achieve the following goals:

  • Fast and easy adoption of country/region-specific requirements

  • Standardized implementations of an Electronic invoicing solution

  • Enhanced traceability of document history

  • Easily adjustable configurations that don't require code changes

  • Simplified configuration packaging

  • Built-in export, import, and integration, and easy extensibility in the processing of e-invoice documents

  • Easy reuse of the same export, import, and integration configurations across companies

I put in bold, in my opinion, the 4 highlights features, and the main ones.

The common and basic scenario is to send the electronic document to a 3rd Party with the configurable flow, process action based on received data. You can use one of the Electronic Reporting File provided by Microsoft, from scratch, transform it if you want (JSON, XML, CSV files). A faster and easier option for new countries and regions instead of a long external development or especially by subscribing to a platform specialized in this field.

Other points to mention :

  • Configurable submission of e-invoices to external web services, including certification handling through digital signatures

  • Built-in, easily extendable, and configurable integration with additional content for several countries

  • Handling of responses from web services, including configurable exception message handling

  • Support for electronic signatures (for example, by using the XMLDSig signing algorithm)

  • Batch processing of e-invoice messages


Let’s talk first about Architecture Design Schema and flow. All the way it’s only on HTTPS of course :)

Again I realized a very quick schema (unsexy as usual) but hope that It will help you to well understand how this Addon works

  1. Dynamics 365 Finance send documents to the eInvoicing Service (invoice or project invoice) + 1.5 : you could also add internal data

  2. In the eInvoicing Service, every documents (received and created) will be stored with customer certificate and secrets with the Key Vault in the Azure BLOB Storage. In this part also, it’s here where you will configure and integrate the ER Model files from the RCS / transform it before of course sending it to the Government (e.g : applying digital signature, before calling external web service)

  3. Government send a response to the eInvoicing Service

  4. The client receives information about the completed processing execution and makes all the log information available. It also makes the document that was created or received during flow processing available.

Microsoft gave me a much better architecture diagram : hell yeah I think it’s better than me :) and much more details ! Thank you !

An another one to have a complete global overview for you !


Let’s go now on the configuration part, first one is to go to LCS - and of course as of now, you can activate and test this feature on a TIER2 Sandbox where you had copy your PROD DB on it. Just a double check before going to the environment - at first let’s go to Preview Feature Management

After go to your environment, and you will have to add the LCS Addin feature : eInvoicing Service (this setup will be familiar for most of you, as this configuration will be very similar for common OOTB external Addon. (aka Micro Service) - Update May 2021 : Be sure that you have linked your TIER2 instance on a Power Platform environment. It’s now required and mandatory.


And select Electronic Service , for your tenant ID you could catch it directly in your AZURE Active Directory part and for AAD Client ID (be careful) it’s a FIXED one by Microsoft, you should put this one : 091c98b0-a1c9-4b02-b62c-7753395ccabe

(PS : I already give a feedback to Microsoft, don’t worry if the LCS Addin is stuck in Installing mode)

You can verify if all is OK by going to the AZURE AD again, but on the Enterprise Application part, and verify you have the eInvoicing Service like me :

OK you are all good for LCS now :)

You could stay in AZURE, since we will create 2 main components: a BLOB Storage and a Key Vault. Very similar as the DataLake configuration.

First, let’s create a basic BLOB Storage (DON’T use the same as the DataLake if you had one like me, you should create a “Classic Blob Storage with a container”)

Select the good location here, of course as I am on Azure WEU DC, I will keep it like this - same DC as my F&O instance. Keep StorageV2 option

Click directly to Review + Create.

After creation, go to the storage, and create a BLOB Container, like me “eInvoicing Service” or whatever name you want…

You should add the e-Invoicing App in the IAM part as Owner of this storage.

After, let’s go to the Access Policy part (SAS)

Create a new one (be careful on the expiration date here) - select, of course, Allowed Resource Type “Container” and keep the result in a NOTE ! You will need after ;)

Last part on AZURE, it’s the Key Vault : like usual… :)

Create new one, or you could (like me) keep the one you have already (like if you have a DataLake integration with F&O)

Create / Generate a new Secret (eInvoicing), with the SAS URI of your storage you created before.

You should finally create an Access Policies with the AAD App you have created with the LCS Addin - with Get and List permission (Key,Secret, Certificate)

You are now all good for the Azure part, fast right ?


We will now go to D365 F&O instance Sandbox in which you have installed the LCS Addin. And go the Feature Management workspace.

Search for “e-Invoicing Service integration” and activate it.

So now it’s the “funny” part… I am on a Self Service Architecture - well now Microsoft will finalize to migrate all customers to this new Architecture in 2021, so you are probably already like me. And yes even by activating it, you will not see any Menu Items in the Organization Administration Module…
But the “Search for a page” bar is always the good place to go and found it ! Like Export Data Lake Tables feature or other Preview feature. So you can type : (Preview) and you will see all the new Menu items on Electronic Document*******



But, before configure D365 F&O and test, you should for now switch a little bit on the configuration of the RCS / ER files - model to activate the Service.

First, go the Electronic Reporting Workspace, and click on the Regulatory Service :

You should login or signup a new RCS environment if you don’t created one so far.

You will have first to activate the Globalization Feature (keep in mind to read the RCS goal and really it’s a wonderful feature for PARTNER and of course customer of F&O with multiple legal entities in the world and production instance) than the standard LCS Asset Library to store all ER model files.

Go to Globalization workspace now. And the tile “Environments e-Invoicing”
We will create a new Service Environment with the AZURE components you have created before

For the Key Vault first, put the DNS / URI of your Azure Key Vault, as well as the name of the secret name when you have past the SAS of your Azure Storage

If your country/region-specific invoice requires a chain of certificates to apply a digital signature, select Chain of certificates on the Action Pane, and then enter the sequence of certificates or key vault secrets that make up the chain.

Now go back to the Globalization Workspace and click on the Electronic Reporting Parameters on the right panel



On the Electronic Invoicing services tab, in the Service endpoint URI field, enter the value closed to your Azure region, for that I’ll suggest to check the Microsoft documentation :

  1. In the Application ID field, verify that it shows the ID 0cdb527f-a8d1-4bf8-9436-b352c68682b2. This value is a fixed value.

  2. In the LCS Environment ID field, enter the ID of your LCS subscription account.

Go to the Service Environment now, you should now finalize the configuration (technical one) by creating your e-Invoicing Service :

Create a new one like me below and select your Key Vault (Storage SAS Token Secret) and add your system user. As a test I will pick my System Admin user , but could be a service end-to-end user with specific security duty / permission needed for this service.

And last, but not least, don’t forget to Publish it at the end !


Now go back to your D365 F&O instance.

And like I said, go up on the Search Page and type “Electronic Document parameters”

Go to the Submission Service, and put the same URL (as before in RCS) and of course the name of e-Service environment you have published just before

Import the ER configurations

To enable business data to be collected and sent to the Electronic invoicing service, you must import the ER data model and ER data model configuration that is related to the country/region-specific e-Invoicing feature that you want to use.

  1. In the Electronic reporting workspace, in the Configuration providers section, select the Microsoft tile. Make sure that this configuration provider is set to Active. For information about how to set a provider to Active, see Create configuration providers and mark them as active.

  2. Select Repositories.

  3. Select Global resource, and then select Open.

  4. In the Connect to Lifecycle Services dialog box, select Click here to connect to Lifecycle Service.

  5. Depending on the country or region where you want to use the e-Invoicing feature, you must import the applicable data model, data model mapping, and formats. For information about the ER configurations that you should import, see the country/region-specific "Get started with the Electronic invoicing" topic.

  6. Import Customer invoice context model. This model contains additional parameters that describe, among other things, the environment in Finance that is used for the Electronic invoicing during the submission of business data.

To turn on country/region-specific e-Invoicing features so that they work with the Electronic invoicing, you must turn on the feature in each legal entity where you want to use it. Afterward, the old electronic invoicing integration can no longer be used, and the integration with the new Electronic invoicing is turned on.

I will explain at the end each country feature (especially for ITALY SDI and Brazil NFI)

You should now go to the Electronic Document and select the table (like Customer Invoice Journal) the Document context that you have imported before in the ER module and also the mapping coming from the RCS (transformation and mapping document)

(Btw Microsoft, please rename CDS by Dataverse here ;)

As I said at first, Microsoft provide some EXAMPLE, but it’s totally up to you and you can configure it for any kind of government specification law. But if you want to found more informations on the example that they gave for now, you could check this part of the article of Microsoft :

We are almost finished now… yes believe me !

Before sending and test the service, you should go back to the RCS Globalization Feature

1/ Select the good Active Provider that you have setup in the ER Module and all imported LCS Asset Library models from Microsoft - but also your custom one if you want !

It’s here where you will setup everything in fact, like the ER model file attached, transform it, select your e-Invoicing Service Environment you have created, configuration and URI of the Government Web Service. (SDI for Italy - Digital Signature , variables, application, token, well in fact all needed to call and also get the response from their service and go back data response to F&O)

Don’t forgot to Deploy at the end on the “Versions” part

But at the end I would suggest to read this article if you want more details on this part !

Microsoft gave me once again a cool schema / applicability rules logic if you want to understand the whole process behind configuration


We are now good to go (really yes…) so go to D365 F&O instance and like always search for the Menu items hidden :

You have 2 dialog that you can run (for Batch / Periodic in each legal entity you have setup for this e-Invoicing Service)

  1. Submit electronic documents

  2. Receive electronic documents

And you have also a LOG for those 2 batchs

For the 1st warmup process I would suggest to click on “Resubmit documents” flag / checkbox to ON. You could also setup a QUERY to not send every kind of Sales Order Invoices )

After the 1st warmup you could setup a process as a BATCH every minute to see if there are new invoice to use this e-Invoicing Service and send to the Government with all transformation, digital signature. I would say the same thing too for the Receive part.

After that you should get notified in the top right of F&O instance.

I would also suggest to check the LOG part, as well as the Activity in your Azure Storage account / BLOB Container

Finally I will also in the coming weeks, test it in a deep dive mode (for Italy and Brazil) and doing a PART2 of this article, meanwhile I hope this introduction will give you more insights and that you can try it yourself !

Stay Safe and see you next time !

Aurelien