Installing a deployable package in Dynamics 365 for Operations using command-line

Today we will be installing a deployable package using command line… this article is mostly for creating a condensed version for my own use… for a complete version please look at the link at the bottom of the page

1. From the Dynamics Server (using RDP) log into https://lcs.dynamics.com and select the correct project.
2. Goto Asset Library and download the package to D:\
3. Goto Properties for the file and unblock it
4. Unzip the file

NOTE: The folder where the files are unziped/stored must not contain spaces

5. Edit the DefaultTopologyData.xml file to look like this (for a onebox environment):

<?xml version=”1.0″ encoding=”utf-8″?>
<TopologyData xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
   <Name>AX topology</Name>
   <MachineList>
     <Machine>
       <Name>localhost</Name>
       <ServiceModelList>
         <string>AOSService</string>
         <string>ALMService</string>
         <string>BIService</string>
         <string>DevToolsService</string>
         <string>DIXFService</string>
         <string>DocumentRoutingAgent</string>
         <string>MROneBox</string>
         <string>PayrollTaxModule</string>
         <string>PerfSDK</string>
         <string>ReportingService</string>
         <string>RetailCloudPos</string>
         <string>RetailHQConfiguration</string>
         <string>RetailSDK</string>
         <string>RetailSelfService</string>
         <string>RetailServer</string>
         <string>RetailStorefront</string>
         <string>SCMSelfService</string>

    <!– DefaultTopologyData are only for dev vhd, which we only support AOS update–>
         <!– Create a new topology data for your Cloud AX topology–>
       </ServiceModelList>
     </Machine>
   </MachineList>
   <BackupScript>
     <FileName />
     <Automated>false</Automated>
     <Description>Please backup your environment now, set this step to complete once you finished backup</Description>
   </BackupScript>
</TopologyData>

6. Run these commands to install the file:

AXUpdateInstaller.exe generate -runbookid=name-runbook -topologyfile=DefaultTopologyData.xml -servicemodelfile=DevInstallServiceModelData.xml -runbookfile=name-runbook.xml
AXUpdateInstaller.exe import -runbookfile=”name-runbook.xml”
AXUpdateInstaller.exe execute -runbookid=”name-runbook”

Links:
https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/deployment/install-deployable-package

Configuring access for mobile warehousing app in Dynamics 365 for Operations

Today I am setting up the mobile warehouse app in Dynamics 365 for Operations… there is a very nice Wiki article here with the walkthrough but I am doing a slightly condensed version.

Edit 180108: Step has been edited to work in the new portal

  1. Go to the azure portal. In Azure Active Directory – App Registrations create a web application for the warehouse portal

    Name: WhatEverYouWant
    Application Type: Web app/API
    Sign-on URL: https://[theURLforyourdynamicsinstance]/oauth

  2. Open the application to edit it
  3. Verify Application ID. If you create the Application in the new new portal it will auto generate an AppID which is random. If you use the old portal to create the application you will have to add the App ID URI. Make sure that this URI is NOT your Dynamics 365 for operations URL because this will break for instance Excel Add-in and Management Reporter. For more information look here
  4. Go to Required Permissions and click Add
  5. Select the API called Microsoft Dynamics ERP (Microsoft.ERP)
  6. Under Permissions to other applications click add application and add Microsoft Dynamics ERP
  7. Add the following permissions

    Access Dynamics AX online as organization users
    Access Dynamics AX data
    Access Dynamics AX Custom Service

  8. Go to API Access – Keys, enter the name for your new key and set a duration. When you click save you will get the key. Please remember to copy and save it some where because it will not be visible later.
  9. Now you need to save the ClientID (Old Portal)/Application ID (New Portal) for later.
  10. Log into Dynamics 365 for Operations and go to System Administration – Users and create a new user (in my case called WMAPP. The email address can be anything since it will never be used. The user needs these roles

    Warehouse mobile device user

  11. Now we need to associate the user to the AD Application which is done on System Administration – Setup – Azure Active Directory applications. Here we paste the App ID/ClientID from before and select the user we created. Click Save and you are done.
  12. Install the App from app store and enter these settings:

    SNAGHTML12dda1b

    1. Azure Active Directory ID: AppID/CleintID from step 9
    2. Azure Active Directory Client Secret: The key from step 8
    3. Azure Active Directory Resource: Your Dynamics 365 URL
    4. Azure Active Directory Tennant: https://login.windows.net/yourADtennant
    5. Company: Dynamics 365 for Operations Legal Entity

Links:
https://ax.help.dynamics.com/en/wiki/install-and-configure-dynamics-365-for-operations-warehousing/

Using the Retail Reprovisioning tool for Dynamics 365 for Operations

When you do any kind of copying between environments in Dynamics there are some settings which are copied that are actually wrong for the destination environment. To fix these you need to run a tool called Retail Reprovisioning tool (also called Environment retargeting tool)

At the beginning this was only supposed to be run for environments actively using the Retail Components. The recommendation at the moment (2017-11-29) is to run it for every environment since al of the actually contains Retail components.

1. To make sure that you have the latest version of the tool go to LCS – Asset Library. Go to Software Deployable Packages – Import  and Select the latest Environment Reprovisioning tool.

2. The next step is different depending on which type of environment you are using.

If you are using a 2-tier environment; go to the environment, select Maintain and  Apply Updates. Select the Environment Reprovisioning tool and click Apply. Continue to Step 5

If you are using a Dev environment you are not able to deploy using LCS and you will have to deploy from command line according steps 3 – 4

3. Unblock the downloaded file by Right-clicking the file and going to Properties – General Unblock for the fil

4. Extract the file to a temporary directory

Install using these command lines:

AXUpdateInstaller.exe list

Fix the DefaultTopologyData.xml and make it look like this:

<?xml version=”1.0″ encoding=”utf-8″?>
<TopologyData xmlns:xsd=”
http://www.w3.org/2001/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”>
   <Name>AX topology</Name>
   <MachineList>
     <Machine>
       <Name>localhost</Name>
       <ServiceModelList>
         <string>RetailServer</string>
         <string>ALMService</string>
         <string>AOSService</string>
         <string>BIService</string>
         <string>DevToolsService</string>
         <string>DIXFService</string>
         <string>DocumentRoutingAgent</string>
         <string>MROneBox</string>
         <string>PayrollTaxModule</string>
         <string>PerfSDK</string>
         <string>ReportingService</string>
         <string>RetailCloudPos</string>
         <string>RetailHQConfiguration</string>
         <string>RetailSDK</string>
         <string>RetailSelfService</string>
         <string>RetailStorefront</string>
         <string>SCMSelfService</string>
         <!– DefaultTopologyData are only for dev vhd, which we only support AOS update–>
         <!– Create a new topology data for your Cloud AX topology–>
       </ServiceModelList>
     </Machine>
   </MachineList>
   <BackupScript>
     <FileName />
     <Automated>false</Automated>
     <Description>Please backup your environment now, set this step to complete once you finished backup</Description>
   </BackupScript>
</TopologyData>

Generate The Runbook
AXUpdateInstaller.exe generate -runbookid=[runbookID] -topologyfile=[topologyFile] -servicemodelfile=[serviceModelFile] -runbookfile=[runbookFile]
AXUpdateInstaller.exe import -runbookfile=[runbookFile]

Verify the runbook

AXUpdateInstaller.exe list

Execute the runbook

AXUpdateInstaller.exe execute -runbookid=[runbookID]

Post Steps:

5. After the retargeting tool is run you need to run these four steps

a. Open the “Retail Parameters” form, and press the “Initialize” link under the “General” tab. Answer “Yes” to the prompt. This will provide any new Retail seed data.

clip_image001

b. Open the “Initialize Retail Scheduler” form, and run it with “delete existing configuration” set to “Yes“.

c. Restart the “Microsoft Dynamics AX Batch Service” on all AOS VMs. This will update any cached connection credentials that may be used when running a CDX data sync. (done by DSE if PROD => you need to raise a ticket)

d. Navigate to the “Channel Database” form and run a CDX 9999 sync (full sync). This should succeed if everything is properly configured for Retail.

6. Sometimes there is issues with some columns in some tables in the channel database looses their setting for full text indexing (this seems to be an effect of the BacPac procedure when sopying to and from an Azure Environment), this results in not being able to search in for instance MPOS. To verify this you can use this script:

SELECT
SCHEMA_NAME(t.schema_id) as TableSchema,
       t.name AS TableName,
       c.name AS CatalogName ,
       i.name AS UniqueIdxName,
       cl.name AS ColumnName,
COLUMNPROPERTY(t.object_id, cl.name, ‘IsFulltextIndexed’) as IsFullTextEnabledOnTable,
          fi.is_enabled AS isEnabledOnColumn
FROM
sys.tables t
INNER JOIN
sys.fulltext_indexes fi
ON
    t.[object_id] = fi.[object_id]
INNER JOIN
sys.fulltext_index_columns ic
ON
    ic.[object_id] = t.[object_id]
INNER JOIN sys.columns cl ON
        ic.column_id = cl.column_id
AND ic.[object_id] = cl.[object_id]
INNER JOIN
sys.fulltext_catalogs c
ON
    fi.fulltext_catalog_id = c.fulltext_catalog_id
INNER JOIN
sys.indexes i
ON
        fi.unique_index_id = i.index_id
AND fi.[object_id] = i.[object_id]
where c.name like ‘COMMERCEFULLTEXTCATALOG’
order by Tablename ASC

look for the ones having a ‘0’ in any column and fix them by runing:

ALTER FULLTEXT INDEX
ON [ax].tablename
ENABLE

ALTER FULLTEXT INDEX
ON [ax].tablename
SET CHANGE_TRACKING=MANUAL;
GO

ALTER FULLTEXT INDEX ON [ax].tablename START FULL POPULATION;
GO

ALTER FULLTEXT INDEX
ON [ax].tablename
SET CHANGE_TRACKING=AUTO;
GO

Links:
https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/deployment/install-deployable-package

Retail servicing data is not present in the RetailServer web.config when running Retail Retargeting tool

Thi is an issyue we have noticed on especially new environments that we have refreshed with a database from an existing Retail Enable environment. After refreshing the database we need to run the retargeting tool to make sure that all settings are corrected.

When the tool is run it fails at step 3 and when we look in the Step3RetargetRetailServer-logfile we find this:

12/6/2017 9:35:52 AM:     – Trying to get information of the website – AOSService …
Unexpected error. Microsoft.Dynamics.ApplicationPlatform.Environment.Settings.ConfigurationKeyNotFoundException: No setting keys found for prefix ‘CertificateHandler’.
    at Microsoft.Dynamics.ApplicationPlatform.Environment.Settings.BaseConfigSetting.GetSettingsForPrefix(String prefix)
    at ConfigEncryptor.Program.Main(String[] args).
12/6/2017 9:35:52 AM:
PSMessageDetails      :
Exception             : System.Management.Automation.RuntimeException: Retail servicing data is not present in the
                         RetailServer web.config, please contact DSE team.
TargetObject          : Retail servicing data is not present in the RetailServer web.config, please contact DSE team.
CategoryInfo          : OperationStopped: (Retail servicin…ntact DSE team.:String) [], RuntimeException
FullyQualifiedErrorId : Retail servicing data is not present in the RetailServer web.config, please contact DSE team.
ErrorDetails          :
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at <ScriptBlock>, F:\DeployablePackages\a2f41617-591e-45c9-bce4-1934c1b17ca6\RetailServer\scrip
                         ts\RetargetRetailServer.ps1: line 299
                         at <ScriptBlock>, <No file>: line 3
                         at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
12/6/2017 9:35:52 AM: Executed:
F:\DeployablePackages\a2f41617-591e-45c9-bce4-1934c1b17ca6\RetailServer\scripts\RetargetRetailServer.ps1
Exiting with error code .

This error is due to missing information in the Web.Config file for Retail. Fortunately there is a fairly easy fix… there is a script in the Retail Retargeting tool called Update-RetailServicingInformation.ps1 which populates the web.config file with the correct information. The parameters you will need to provide is the database name which you can find in SQL Server Management Studio and the SQL Server name. The server name for OneBox Environments is Localhost. For Tie-2 and up you will need to provide the Azure SQL name which you can find in LCS, don´t forget to add database.windows.net to make it a FQDN

/Johan

Running out of space on a Dynamics 365 for Operations Vm in Azure–Part 1

When setting up environments for Dynamics 365 for Operation in Azure you are using a tool called LCS (Life Cycle Services). This allows you to set up VMs in different sizes and once the are up it does not allow you to change them. When using the VMs they tend to, sooner or later, fill up and run out of disk space. There are two main ways to fix this… clean up or make the disk bigger (this will be handled in another article which I will link here). In this article we will look at things you can clean up.

1. Remove files in C:\TEMP
Note: Do NOT remove the C:\DIXF folder… that will make DIXF fail. If you remove it, by mistake, you will have to recreate it and manually set permissions on it.

2. You can also clean out files in C:\MonAgentData\SingleAgent\Tables\. To do this you first have to stop the Monitoring Agent Service.

Bye for today

Links
https://devserra.wordpress.com/2016/03/03/ax7-release-hd-space-on-your-ctp8-vm/

Detailed Version Information in LCS

When contacting Microsoft Support about Dynamics 365 for Operations they often ask you for the version information for an environment. We have been having an issue with seeing it for our Cloud Hosted Environments… it simply was not there:

SNAGHTML9e3aa91

I finally found a way to fix this and it is Very Simple (onece you know it)

Go to the adress bar in your browser… At here end of your URL you will find:

&IsDiagnosticsEnabledEnvironment=false

change it to:

&IsDiagnosticsEnabledEnvironment=true

and presto!!!

SNAGHTML9e78d61

/Johan

Error importing Electronic Reporting Configurations

Hi…

Today we are looking at an issue that one of my colleagues had. This is actually an Application issue but I am writing it up for future reference.

When we are importing Electronic Reporting configuration in Dynamics 365 for Operation we get the following error:

clip_image001

Since it is a bit intermittent and works for some configurations we have suspected a timeout… we were on the right track… When speaking to Microsoft Support we got the tip to change a parameter in the configuration for Electronic Reporting to allow more multiple parallel threads for loading data:

image

Go to Organization administration – Workspaces – Electronic reporting – Electronic Reporting parameters and change Number of parallel threads to load data to 15 (the default is 5)

BR

Johan

Error in Environment Reprovisioning tool

I have been working with an upgrade of Dynamics 365 for Operations now for a while and found an issue when it comes to Environment Reprovisioning tool, also known as Retail Retargeting Tool. This is a tool used to fix the retail conponents in an environment after you have done a database copy to the environment from another environment. We did this as part of the upgrade to Platfor Update 10.

When we ran the tool from the command prompt in the environemnt we gor the following error:

The step completed
Executing step: 3
GlobalUpdate script for service model: RetailServer on machine: localhost
Run RetargetRetailServer.ps1
RetargetRetailServer.ps1 failed.
The step failed
The step: 3 is in failed state, you can use rerunstep command to debug the step explicitly
at Microsoft.Dynamics.AX.AXUpdateInstallerBase.RunbookExecutor.executeRunbookStepList(RunbookData runbookData, List`1 runbookStepList, String updatePackageFilePath, Boolean silent, String stepID, ExecuteStepMode executeStepMode, Boolean versionCheck, Boolean restore, Parameters parameters)
at Microsoft.Dynamics.AX.AXUpdateInstallerBase.RunbookExecutor.executeRunbook(RunbookData runbookData, String updatePackageFilePath, Boolean silent, String stepID, ExecuteStepMode executeStepMode, Boolean versionCheck, Boolean restore, Parameters parameters)
at Microsoft.Dynamics.AX.AXUpdateInstallerBase.AXUpdateInstallerBase.execute(String runbookID, Boolean silent, String updatePackageFilePath, IRunbookExecutor runbookExecutor, Boolean versionCheck, Boolean restore)
at Microsoft.Dynamics.AX.AXUpdateInstaller.Program.InstallUpdate(String[] args)
at Microsoft.Dynamics.AX.AXUpdateInstaller.Program.Main(String[] args)

So this error was not that obvious to me… So I took a look at the loggs for the Deployable package which are located in the RunbookWorkingFolder (located in the folder where you extracted the package). There I found this:

Exception : System.Management.Automation.RuntimeException: The servicing data of this box has not been migrated yet, please rerun this tool with axlocaladmin
TargetObject : The servicing data of this box has not been migrated yet, please rerun this tool with axlocaladmin

This made me think… The older environments always had an account called axlocaladmin but the newer ones does not. After some digging around in the script called RetargetRetailServer.ps1 I found this (on line 302) :

if($env:UserName -ne ‘axlocaladmin’)
{
$errorMessage = “The servicing data of this box has not been migrated yet, please rerun this tool with axlocaladmin”
Log-TimedMessage $errorMessage
throw $errorMessage
}

I simply changed it to:

if($env:UserName -ne ‘adminXXXXXXXXXX’)
{
$errorMessage = “The servicing data of this box has not been migrated yet, please rerun this tool with axlocaladmin”
Log-TimedMessage $errorMessage
throw $errorMessage
}

where adminXXXXXXXXXX is the account name for my user and the i re-ran:

AXUpdateInstaller.exe execute -runbookid=env-reprovision -rerunstep=3

And presto… it worked 🙂

Note that this is the reprovisioning tool from 8/30/2017, I have not looked at any other verisons.

/Johan

Issues after Database copy

Yesterday we did a database refresh between two of our Non-Production OneBox environments an this morning I got an email. The users where having problem viewing invoices in All Sales Orders. The error they got looked like this:

“Something went wrong while generating the report. Please try again”

That was not extremely helpful so I started looking around and found information on how to get a detailed log:

1. Click on Environment monitoring.
2. Click on Raw logs
3. In the query name field, select “All events for activity”
4. Copy 78ca1c74-3c56-4f6b-8c18-a4034876780d in the activity ID
5. Click on shows options and set Row limit to 5000.
6. Click on search.
7. Scroll down towards the end to see exception message.

And that got me (not very useful):

at [aoskernel.dll]Microsoft.Dynamics.Ax.MSIL.Interop.GetManagedCallStack(basic_string<wchar_t\,std::char_traits\,std::allocator >* ) at [aoskernel.dll]Microsoft.Dynamics.Ax.Services.AOSAppDomainHelper.callGetManagedCallStack(basic_string<wchar_t\,std::char_traits\,std::allocator >* ) at callGetManagedCallStack(basic_string<wchar_t\,std::char_traits\,std::allocator >* ) at cqlClass.callEx(cqlClass* , Char* , interpret* ) at cqlClass.callEx(cqlClass* , Char* , interpret* ) at [aoskernel.dll]Microsoft.Dynamics.Ax.MSIL.cqlClassIL.Call(IntPtr c, String methodName, Object[] parameters, Type[] types, Object[] varargs, Type[] varargsTypes) at [Microsoft.Dynamics.AX.Server.Core.dll]Microsoft.Dynamics.Ax.Xpp.XppObjectBase.Call(String methodName, Object[] parameters, Type[] types, Object[] varargs) at [Microsoft.Dynamics.AX.Xpp.Support.dll]Dynamics.AX.Application.xInfo.add(Exception exception1, String text1, String text2) at [Dynamics.AX.ApplicationPlatform.dll]Dynamics.AX.Application.Info.`add(Exception _exception, String _txt, String _helpUrl, XppObjectBase _sysInfoAction, Boolean buildprefix, String _label, Boolean @_helpUrl_IsDefaultSet, Boolean @_sysInfoAction_IsDefaultSet, Boolean @buildprefix_IsDefaultSet, Boolean @_label_IsDefaultSet) in xppSource://Source/ApplicationPlatform\AxClass_Info.xpp:line 335 at [Dynamics.AX.ApplicationPlatform.dll]Dynamics.AX.Application.Info.InfoCoCHelper.`add(Info instance, Exception arg0, String arg1, String arg2, XppObjectBase arg3, Boolean arg4, String arg5, Boolean , Boolean , Boolean , Boolean ) at [Dynamics.AX.ApplicationPlatform.dll]Dynamics.AX.Application.Info.add(Exception _exception, String _txt, String _helpUrl, XppObjectBase _sysInfoAction, Boolean buildprefix, String _label, Boolean @_helpUrl_IsDefaultSet, Boolean @_sysInfoAction_IsDefaultSet, Boolean @buildprefix_IsDefaultSet, Boolean @_label_IsDefaultSet) at [Dynamics.AX.ApplicationPlatform.dll]Dynamics.AX.Application.Info.add(Exception _exception, String _txt) at [Dynamics.AX.ApplicationFoundation.dll]Dynamics.AX.Application.SrsReportViewerControl.`displayErrorMessage(String message) in xppSource://Source/ApplicationFoundation\AxClass_SrsReportViewerControl.xpp:line 870 at [Dynamics.AX.ApplicationFoundation.dll]Dynamics.AX.Application.SrsReportViewerControl.SrsReportViewerControlCoCHelper.`displayErrorMessage(SrsReportViewerControl instance, String arg0) at [Dynamics.AX.ApplicationFoundation.dll]Dynamics.AX.Application.SrsReportViewerControl.displayErrorMessage(String message) at SrsReportViewerControl::displayErrorMessage(Object , Object[] , Boolean& ) at [Microsoft.Dynamics.AX.Xpp.Support.dll]Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeInstanceCall(Object instance, String MethodName, Object[] parameters) at callILClassMethod(interpret* ip, Char* method, UInt32 chdl, cqlClass* c) at [aoskernel.dll]Microsoft.Dynamics.Client.ServerForm.Interactions.InteractionHandler.InvokeCommand(CommandInteraction interaction, CommandCallbackInteraction& result) at [aoskernel.dll]Microsoft.Dynamics.Client.ServerForm.Interactions.InteractionHandler.HandleCommandInteraction(CommandInteraction interaction, List`1 outboundInteractions) at [aoskernel.dll]Microsoft.Dynamics.Client.ServerForm.Interactions.InteractionHandler.HandleInteractions(IInteractionChannel interactionChannel) at [aoskernel.dll]Microsoft.Dynamics.Client.ServerForm.Interactions.InteractionManager.ProcessMessages(Object stateinfo) at [mscorlib.dll]System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at [mscorlib.dll]System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at [mscorlib.dll]System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at [mscorlib.dll]System.Threading.ThreadPoolWorkQueue.Dispatch()</wchar_t\,std::char_traits</wchar_t\,std::char_traits</wchar_t\,std::char_traits

So I started to look around a little and found the System administration – Setup – Server Configuration and noticed that there were 2 servers… in a OneBox Environment…

                     SNAGHTMLa4c1c3d

The migration server was still there and it seemed that it was trying to have that one generate the report. When I removed the extra server it started working

/Johan