Dynamics 365

Interpreting compiler results in D365FO using PowerShell

When you build your code, the results are hard to interpret and are being capped at 1000 entries per category within the Visual Studio error pane. The compiler does generate output files with more valuable content within each package. We have written PowerShell code for analyzing and interpreting compiler results of Microsoft Dynamics 365 for Finance and Operations in a more meaningful way.

The BuildModelResult.LOG and XML files have the details of your errors, warnings and tasks. Running the following script parses these files and counts the warnings and errors, to get a better idea of the remaining work during your implementation and upgrade:

$displayErrorsOnly = $false # $true # $false
$rootDirectory = "C:\AOSService\PackagesLocalDirectory"

$results = Get-ChildItem -Path $rootDirectory -Filter BuildModelResult.log -Recurse -Depth 1 -ErrorAction SilentlyContinue -Force
$totalErrors = 0
$totalWarnings = 0

foreach ($result in $results)
{
    try
    {
        $errorText = Select-String -LiteralPath $result.FullName -Pattern ^Errors: | ForEach-Object {$_.Line}
        $errorCount = [int]$errorText.Split()[-1]
        $totalErrors += $errorCount

        $warningText = Select-String -LiteralPath $result.FullName -Pattern ^Warnings: | ForEach-Object {$_.Line}
        $warningCount = [int]$warningText.Split()[-1]
        $totalWarnings += $warningCount

        if ($displayErrorsOnly -eq $true -and $errorCount -eq 0)
        {
            continue
        }

        Write-Host "$($result.DirectoryName)\$($result.Name) " -NoNewline
        if ($errorCount -gt 0)
        {
            Write-Host " $errorText" -NoNewline -ForegroundColor Red
        }
        if ($warningCount -gt 0)
        {
            Write-Host " $warningText" -ForegroundColor Yellow
        }
        else
        {
            Write-Host
        }
    }
    catch
    {
    Write-Host
    Write-Host "Error during processing"
    }
}

Write-Host "Total Errors: $totalErrors" -ForegroundColor Red
Write-Host "Total Warnings: $totalWarnings" -ForegroundColor Yellow

The compiler results are displayed in the following format as an overview:

compiler results

If you want to do a detailed analysis, we also have PowerShell scripts prepared for extracting the errors and saving them in a CSV file for better processing. Opening it with Excel allows you to format them into a table.

We typically copy all error texts to a new sheet, run the duplicate entries removal, then do a count on what is the top ranking error to see if we have any low-hanging fruits to be fixed.

=SUMPRODUCT(('JADOperation-Warning'!$D$2:$D$1721=Sheet1!A2)+0)

You could be very efficient about deciding what things to fix first and next, and is easier to delegate tasks this way.

Source code for all four scripts are available on GitHub.

Archiving SQL database backups using Azure blob storage

It is a good practice to keep multiple copies of our most precious data. By using on-premises SQL Server databases for AX 2012 or Dynamics 365 Finance and Operations, archiving SQL database backups to offsite-locations are a must. I have built automation for archiving SQL database backups using Azure Blob Storage.

Overview of the processes

Maintenance regime

Our maintenance regime looks like the following:

  • 1x Weekly Full backup
  • 6x Daily Differential backup
  • 15 minute Transactional log backups

They are captured locally on the primary SQL instance, to keep the timestamps for last successful backups in our AlwaysOn cluster. Then we move the files to a shared network storage, which is visible to both High Availability sites, in case there is an outage and we need to a fail over and restore data.

In case of a natural disaster due to the close geographical proximity of the sites we needed an additional layer of safety.

Archiving offsite

Every night we are running a PowerShell script that uses the AzCopy utility. It is uploading our backup files on a Microsoft Azure cloud storage account.

You are paying for the network usage (IO) and the size occupied on the disks, so it is a good idea to have some sort of housekeeping. Our solution was to use an Azure RunBook to determine what to keep and what to delete. The current setup is to have 1 full backup file for a year available every quarter (4x 400 GB), and keep all full / differential / transactional files for the last month (4x 400 GB + 26x 10 GB).

This puts the total size occupied around 4 TB, and costs about 35 GBP a month using a cold storage. This price could go up if you also want to utilize a hot tier storage for the latest backup set. That is useful if you want to come back from the cloud on a short notice.

(more…)

Dynamics Zero to Hero introduction vlog

As it has been announced last week the Dynamics Zero to Hero channel is now up and running on YouTube. The brief introduction video is now up, and there are more to follow in the upcoming days and weeks:

For privacy reasons YouTube needs your permission to be loaded.
I Accept

Being nervous does show, and it does not help with my accent :)
I am sure the content is going to make up for the lack of vlogging experience on the long run, hopefully you will like it.

If you have topics you would like me to touch up on, feel free to leave a comment, or send an e-mail.

Plans for 2020 and going forward

It has been a quiet couple of months as the community has probably noticed by the lower number of blog posts and forum answers. Working on our MSDyn365FO upgrade at JJ Food Service has been a demanding task, but progress is steady. Now it is time to do the plans for 2020.

Soon I can get back to publishing blog articles on a regular basis. Not just that, but the big announcement is: DAXRunBase is going online with Video Logs!

Plans for 2020 - vlog

Make sure you bookmark and subscribe for the Dynamics Zero-To-Hero channel.

(more…)

Dynamics 365 Dubai Summit 2020

With only 1 week left until the Microsoft Dynamics 365 Dubai Summit 2020, I would like to remind you that there are still a couple of sets available for this amazing, free event.

Dubai Summit 2020

Dubai Summit 2020 website link

This is one of the largest conference in the region dedicated to Dynamics 365 with 5 tracks available in: Finance and Operations, Customer Engagement, Retail, Unified Operations and Power Platform.

It falls in line with the Dynamics 365 Saturdays event series, which has a goal of sharing the latest and greatest about our ERP platform and connected technologies freely. You can find more details at https://www.365portal.org/.

The Dubai Summit conference is a 365 Saturday on steroids and will be span across 3 days, 700 participants, with 29th of February being dedicated for various in-depth sessions held by fellow professionals and enthusiasts from Microsoft, Customers and Partners. Sunday will be a Power Platform bootcamp, and Monday will be a CDS core exam cram.

I will be presenting 2 sessions about the journey of moving the AX 2012 R3 implementation of JJ Food Services into the cloud. It will cover business and technical aspects and challenges of getting a large-scale enterprise system up and running within Azure.

Hope to see you all soon at the Dynamics 365 Dubai Summit on 29th of February!