d365fo.integrations – Auto refresh your data entity list

MarijanFinance & Operations3 years ago10 Views

Meet the little brother of the d365fo.tools – d365fo.integrations. To be honest I wasn’t fully aware about this one until @splaxi mentioned them. But after a quick look into this module I’m more than excited to share this.

Ever wondered why you need to manually refresh the data entity list in your Tier-2 environment after a deployment while almost everything else is automated? Worry no more – here come the d365fo.integrations! Thanks to the wizard @gertvdheyden we can use this module to automate the entity refresh.
The awesome thing is, with this you should even be able to refresh the entity list in your production environment.

Setup d365fo.integrations locally

Before we get the magic done in an Azure DevOps Pipeline we’ll set it up locally to get a better understanding of the module.
To get started we need an application registration in the Azure portal as well as some configuration in the D365 system. You can follow the documentation if you haven’t already set it up: Service endpoints overview – Finance & Operations | Dynamics 365 | Microsoft Docs
Remember to take note of the following things while setting up the registration:

  • ClientId of the Azure AD Registered Application
  • ClientSecret of the Azure AD Registered Application
  • Guid of the Azure AD tenant where the Registered Application is created

Now lets install the d365fo.integrations. Open an elevated PowerShell command prompt and use the following command.

Install-Module -Name d365fo.integrations

To set the configuration just add the values from the Azure application registration and add your D365-url.

Add-D365ODataConfig -Name "D365EntityRefresh" -Tenant "AzureTenantID" -url "https://yoursandbox.sandbox.operations.dynamics.com" -ClientId "AzureApplicationId" -ClientSecret "AzureApplicationClientSecret"

And that is all. Now we’ve configured PowerShell to execute commands against our D365 environment.
To refresh the entity list we simply need to call

Invoke-D365DmfInit

Head over to your system and you’ll see the magic at work:

All in all the setup took me like 15 minutes, granted that I already had an application registration setup.

Setup d365fo.integrations in an Azure DevOps Pipeline

Okay, so let’s get to the exciting part, triggering the entity refresh through an Azure DevOps pipeline.
All we need is a PowerShell task in the pipeline.

Here we can choose between the “File Path” and the “Inline” type. Personally I like to store the PowerShell commands inside a file. But to simplify just choose the “Inline” type, insert the following script and add your values.

Install-PackageProvider nuget -Scope CurrentUser -Force -Confirm:$false
write-host "nuget installed"

Install-Module -Name AZ -AllowClobber -Scope CurrentUser -Force -Confirm:$False -SkipPublisherCheck
write-host "az installed"

Install-Module -Name d365fo.integrations  -AllowClobber -Scope CurrentUser -Force -Confirm:$false
write-host "d365fo.integrations installed"

Add-D365ODataConfig -Name "D365EntityRefresh" -Tenant "AzureTenantId" -url "https://yourenvironment.sandbox.operations.dynamics.com" -ClientId "AzureApplicationId" -ClientSecret "AzureApplicationClientSecret"
write-host "Config added"

Set-D365ActiveODataConfig -Name D365EntityRefresh
write-host "Config as default"

$token = Get-D365ODataToken
write-host "Token generated"

Invoke-D365DmfInit -verbose -Token $token
write-host "dmf init called"

That’s it, you can place this script in your existing release pipeline, or trigger it after the deployment in a single pipeline.
I had a small problem calling this from the pipeline so I settled to use a token created from the module.

Also setting up the pipeline didn’t take too much time and now we’re ready to refresh the entity list automatically after every time we deploy to one of our environments.

As a disclaimer, I had one environment where the refresh wasn’t reliable, as it kept failing sometimes. I couldn’t figure out why this was happening. Maybe someone has an idea why this could happen.
But for this project everything went fine, in a cloud hosted development environment as well as in a Tier-2 machine.
So once again thank you @gertvdheyden and @splaxi for this one!

Original Post https://d365fostuff.wordpress.com/2021/03/31/d365fo-integrations-auto-refresh-your-data-entity-list/

0 Votes: 0 Upvotes, 0 Downvotes (0 Points)

Leave a reply

Join Us
  • X Network2.1K
  • LinkedIn3.8k
  • Bluesky0.5K
Support The Site
Events
March 2025
MTWTFSS
      1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31       
« Feb   Apr »
Follow
Sign In/Sign Up Sidebar Search
Popular Now
Loading

Signing-in 3 seconds...

Signing-up 3 seconds...