Setting a Dynamic 365 for Operations cloud hosted environment in Maintenance mode

Some configurations in Dynamics requires you to be in Maintenance Mode. Some of these are:

  • Activating dimensions
  • Changing license keys

The limitations of maintenance mode is that you will need to be Admin or maintenance mode user to log in.

  1. Log into the VM using RDP
  2. Start an elevated command prompt
  3. Go to K:\AosService\PackagesLocalDirectory\Bin\ (in this case K is the service volume)
  4. För följande:
    Microsoft.Dynamics.AX.Deployment.Setup.exe --metadatadir K:\AosService\PackagesLocalDirectory --bindir K:\AosService\PackagesLocalDirectory\Bin --sqlserver . --sqldatabase axdb --sqluser  --sqlpwd [sqlpassword] --setupmode maintenancemode --isinmaintenancemode true

To set it back run this

Microsoft.Dynamics.AX.Deployment.Setup.exe --metadatadir K:\AosService\PackagesLocalDirectory --bindir K:\AosService\PackagesLocalDirectory\Bin --sqlserver . --sqldatabase axdb --sqluser  --sqlpwd [sqlpassword] --setupmode maintenancemode --isinmaintenancemode false

and then IISRESET

NOTE: Maintenance mode of a Production environment is set by a service request to DSE.

UPDATED NOTE: There is now a Deployable Package for enabling/disabling Maintenance Mode so you don´t have to bother DSE. It is in the Asset Library.

NOTE: On Sandbox Environments, do the above procedure on one of the AOSes. You might need to run IISreset on all AOSes.


Adding users WITHOUT an Azure AD Accounts to Dynamics 365 for Finance and Operations

Normally when using Dynamics 365 for Finance and Operations all you users are part of an Azure AD. This is created when ordering your license and is used for authentication. This AD is either stand-alone or synced with you OnPrem AD.

There might be situations where you need to add external users to your Dynamics installation and if these are part of an Azure AD you just use this guide but if the external part does not have Azure AD then it is a bit more problematic… You do not want to add them to your organization since this might add security issues and sometimes licensing costs, and you might not be able to force them to get their own Azure AD tenant.

There is however another way to do this. It will require the user to get a Microsoft Account, that should not be an issue since it is a free account.

  1. Log into the azure portal and go to Azure AD – All Users
  2. Click New Guest User
  3. Add the users Microsoft account (eg *, *
  4. Go to D365FO and choose Import users
  5. Select the new account, import it and give it the correct user role.

Now the user can log in using their hotmail adress

That’s all for today


Force running distribution jobs in Dynamics 365 for Operations Retail

When working with retain in Dynamics 365 for Finance and Operations, distribution jobs are used for moving data between Channel Database and the “AX” transaction database.

The jobs with the prefix P are inbound to AX and the other once are for outgoing sync. In some cases we need to trigger these jobs manually. To do this go to Retail IT – Distribution Schedule. Select the job and click Run Now

When the job is run click the History button to verify that it ran OK.



Call to TTSCOMMIT without first calling TTSBEGIN when installing a Deployable package

I just got an issue when running the DataUpgrade package to 8.1 form the command prompt in a Cloud hosted environment. The package failed on Step 6 with this error:

Application configuration sync failed. Microsoft.Dynamics.AX.Framework.Database.TableSyncException: Custom action sync failed with error: ‘InfoException:Stack trace: Call to TTSCOMMIT without first calling TTSBEGIN.

… followed by a huge stack trace… and since I am not fluent in stack trace I did what everyone does… I call a friend 😉

Fortunately I have great colleagues and I got the instant tip to restart IIS on the server; so I did and I reran the runbook :

AXUpdateInstaller.exe execute -runbookid=[yourrunbookid] -rerunstep=6

Presto… it worked…


Editing an runbook that fails

Today I had an issue with installing a deployable package from the sommand prompt. When the runbook tried to stop the Retail Server i got the following error on step 1:

System.Runtime.InteropServices.COMException (0x800706BA): The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)

I then saw that it was using the server name, and I thought that it might work using locka host instead… the only problem was that I had imported the runbook and it had failed… how am I supposd to fix this?

I found my runbook file in the folder where I had extracted the package. I opened it in Notepad and ran search and replace on the file. I saved the file and tried to import it again using:

AXUpdateInstaller.exe import -runbookfile=”[runbookfilename]”

and then I restarted the package install using:

AXUpdateInstaller.exe execute -runbookid=[runbookid] -rerunstep=1

Wohoo… it worked!!!

Remember: If you are running AXUpdateInstaller from powershell you need to add .\ before the command


Configuring a LCS Repository for Electronic Reporting in Dynamics 365 for Finance and Operations

In Dynamics 365 for Finance and Operations, Microsoft provides a large repository for Electronic Reports. These cover a lot of scenarios but for those scenarios that requires custom reports you can use LCS to store these in order to share them between environments.

This requires a configuration in D365

First you need to add a configuration provider:

  1. In D365FO search for “Electronic Reporting”
  2. In the right click Configuration Providers
  3. Click New, Give it a Name and a URL and click save
  4. Back in the GER Workspace select the new provider and click Repositories
  5. On the Configuration repositories screen click Add – LCS and Create Repository. Select the correct LCS project and click OK.
    Note: Sometimes you need to make a connection to LCS. To do that click “Click here to connect to LifeCycle Services”. This is done in a separate tab. When it is done switch back to the previous tab and click OK. If you get an error, try again.

    EDIT 2019-06-03 If you are not seeing the the option to select an LCS project at all, you will need to make a connection between Dynamics 365 FO and LCS. This is done in the System Administration – Setup – System Parameters – Help Tab.

    When you click the Help Tab you will see the option to authenticate to LCS. Click “Click here to connect to LifeCycle Services”. Authiorization is done in another tab.

    Close the new tab and click OK on the previous tab.

    Select your LCS project

    You will need to have a user in LCS that uses the same Azure AD credentials as the one you are logged into D365FO with.

  6. To look at the reports in the repository, select it and click Open. You will see the reports stored in the LCS repository.




    7. You are also able to see them directly in LCS, in the Asset Library. If you are working as a consultant this report can then be saved to your personal Asset Library and shared with your colleagues

    8. To give your organization access to your custom report, go to the Shared Asset Library, select it and click Publish



Resetting the DataMart in Financial Reporting for Dynamics 365 for Finance and Operations

There is a universal solution for most problems in Financial Reporting (used to be Management Reporter) and that is to reset the DataMart. The DataMart is an internal data warehouse for Financial Reporting and when something goes wrong it is usually because of bad data in the DataMart. Another reason for resetting it when you do a refresh of the transaction database in D365/AX. Here is how you do it.

  1. In D365 search for “Financial Reports”
  2. Depending on if you see reports or not either select a report and click edit or click new. This will open the Report Designer. Note that you will need to enable pop-ups. Also note that if you are doing this in Chrome you will need an extension called ClickOnce in order to run the designer.
  3. You will need to log in using your Dynamics Account.
  4. Choose a default company /which does not really matter for this operation)
  5. If there are any open report definition close it

  6. Go to Tools – Reset Data Mart…
  7. Check Reset data mart and select the correct reason for the reset

  8. Click OK

    The Data Mart is now reset and filled with fresh data.

  9. Wait for the reset to finish

  10. When all lines have Status RanToCompletion the reset is done.

Renaming a OneBox Dev environment


Tonight I helped one of my developer colleagues who had issues with one of his DEV environments. The issue was that he had renamed the VM (you cannot have multiple machines in Azure DevOps with the same name). The problem was that he had not completed all the steps that is required to rename so it was behaving a bit weird.

First of all we were not able to connect to Reporting Services Configuration Manager. The solution was unfortunately not very logical… In the onebox environment there is a couple of SQL components installed from different SQL Server Versions:

If you use the wrong SSRS Configuration Manager it is not able to connect to the SSRS Server and get the error message: No report servers were found

The correct version is 2016! Completely logical… NOT!

When this was done we just followed this guide to complete the rename and all is well 🙂



Uninstalling Excel Addin

This one was an annoying one…

I had to help a customer uninstall the Excel addin for Dynamics 365 for Operations. This should be a simple task (everything is if you know how to do it). So I went into Excel Add-ins using File – Options – Add-Ins… No Dynamics Excel addin:

WFT!!! A nice person then showed me that there is another place for Excel Addins (obviously)… You go to Insert – My Add-ins… Presto!


Blocking sessions in Azure SQL

Some environments in Dynamics 365 for Finance and Operations are using Azure SQL. In LCS you can see blocked sessions for the environment but you are not able to do anything about them. To solve the issue you need to log into one of the AOSes using RDP and start Management Studio.

The issue in SMSS when sonnecting it to Azure SQL is that you do not have assess to Activity Monitor… you need to solve the issue using T-SQL.

In order to find the blocking session, run this query:

    blocking_session_id AS BlockingSessionID,
    session_id AS VictimSessionID,
    (SELECT  FROM sys.sysprocesses
     CROSS APPLY sys.dm_exec_sql_text([sql_handle])
     WHERE spid = blocking_session_id) AS BlockingQuery,
     AS VictimQuery,
    wait_time/1000 AS WaitDurationSecond,
    wait_type AS WaitType,
    percent_complete AS BlockingQueryCompletePercent
FROM sys.dm_exec_requests
CROSS APPLY sys.dm_exec_sql_text([sql_handle])
WHERE blocking_session_id > 0

To kill the blocking sessions

Kill [SessionID]

That is it…

Note that when you kill a session in SQL the server rolls the transactions back and that might take some time