Automated D365 F&O update package installation instructions (for D365FO Platform Updates as well as regular/incremental D365FO updates):

 

Standard D365FO update package installation instructions:

Below is a link to the standard D365FO deployable package installation instructions: https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/deployment/install-deployable-package

However, we are following the automated steps below to update a non-LCS OneBox D365FO environment (e.g. a Dev machine), so please complete the steps below (as opposed to the standard steps in the link above).

 

Automated D365FO update package installation instructions (for D365FO Platform Updates as well as regular/incremental D365FO updates):

Please complete the following steps to manually complete a D365FO Update.

1.       Clean-up of old D365FO update files, folder and scripts

·         IMPORTANT: Please delete any old D365 update zip files, folders and PowerShell scripts from C:\Temp folder on your Dev Machine before continuing with the rest of this guide (especially the D365FO_UPD.zip file, D365FO_UPD folder and the D365FO_AutomateInstall.ps1 PowerShell script file).

 

2.       Copy the latest D365FO update file to your Dev machine and rename it

·         Open a command prompt window on your Dev machine and execute the following command:

net use X: \\dyna51dd6a4fc213cab.file.core.windows.net\bacpacs /u:dyna51dd6a4fc213cab TpnhtLuAY9VwA3di7IJ7wLXeZkAF0yW+Djsukrg3Oxry/Ppr9+v+LhSjyylIzcgTbvvtJyWXikurIbi+xXhvZQ==

 

·         Then open Windows Explorer and copy the following file (the latest D365FO update file) to C:\Temp on your Dev Machine:

X:\Packages\KBs_up_to_20190715.zip

 

·         Finally, rename the C:\Temp\KBs_up_to_20190715.zip file (that you’ve just copied) to C:\Temp\D365FO_UPD.zip

 

*Note: “UPD" in the zip file name above stands for Update.

 

3.      Truncate the RetailStoreLocatorGroupMemberStaging

·         Open SQL Server Management Studio and execute the following SQL query to truncate the problematic RetailStoreLocatorGroupMemberStaging table (you can truncate this table on your Dev machine without causing any issues, since it is just a staging table):

 

USE AxDB

TRUNCATE TABLE dbo.RETAILSTORELOCATORGROUPMEMBERSTAGING

GO

 

·         You are performing this step to avoid the “Duplicate Key Error on RetailStoreLocatorGroupMemberStaging table during Sync AX database step (usually occurs during step 24 of the runbook execution)” detailed in the Troubleshooting section at the end of this document.

 

4.      Copy and execute the D365FO Update Automated Installation PowerShell Script to your Dev machine

·         Copy the “D365FO_AutomateInstall.ps1” PowerShell script from X:\Scripts to C:\Temp on your Dev machine.

 

·         Open a PowerShell window as an administrator on your Dev machine.

 

·         Enter the following commands to launch the Automated Installation PowerShell script:

PS C:\windows\system32> cd\

PS C:\> cd Temp

PS C:\Temp> .\D365FO_AutomateInstall.ps1

 

5.      Run the D365FO Update Automated Installation steps

·         You should now see the following screen:

 

·         Select “9. Run all (recommended)…” to complete the automated D365FO update.

 

·         Wait for all the steps in the update/runbook execution to complete. Note, this can take up to 6 hours to complete (the runbook execution step 41 takes about 3-4 hours to complete by itself). Please be patient and ensure that the entire update completes successfully before you continue working on your Dev machine.

 

·         If you run into any errors during the update/runbook execution, please see the troubleshooting section on the next page.

Troubleshooting

Duplicate Key Error on RetailStoreLocatorGroupMemberStaging table during the Sync AX database step (usually occurs during step 24 of the runbook execution)

·         You might run into a D365 Database Synchronization error during the runbook execution. This usually happens during step 24 of the runbook execution. The error you receive will be as follows.

·         And after clicking on Close program, the PowerShell error you receive will look like the one highlighted below.


Executing step: 24

GlobalUpdate script for service model: AOSService on machine: AX81PL20_185_BV

Sync AX database

07/04/2019 12:54:01: Managed Sync Table Worker encountered an exception, but is continuing because ContinueOnError is true. Table Sync Failed for Table: RetailStoreLocatorGroupMemberStaging. Exception: System.InvalidOperationException: Database execution failed: The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.RETAILSTORELOCATORGROUPMEMBERSTAGING' and the index name 'I_2674STAGINGIDX'. The duplicate key value is (5637144576, GOLD - 242 - Retail, GOLD - 242 - Retail-2018-01-12T11:46:45-5D1E8BC1DC2B43E0A8165DC647030CA8, BEL, , ). Could not create constraint or index. See previous errors. The statement has been terminated. ALTER TABLE DBO.RETAILSTORELOCATORGROUPMEMBERSTAGING ADD CONSTRAINT I_2674STAGINGIDX PRIMARY KEY NONCLUSTERED(PARTITION,DEFINITIONGROUP,EXECUTIONID,STORELOCATORGROUPNAME,INVENTLOCATIONID,INVENTLOCATIONDATAAREAID); ---> System.Data.SqlClient.SqlException: The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.RETAILSTORELOCATORGROUPMEMBERSTAGING' and the index name 'I_2674STAGINGIDX'. The duplicate key value is (5637144576, GOLD - 242 - Retail, GOLD - 242 - Retail-2018-01-12T11:46:45-5D1E8BC1DC2B43E0A8165DC647030CA8, BEL, , )...

·         To resume/recover from this error, open SQL Server Management Studio and execute the following SQL query to truncate the problematic RetailStoreLocatorGroupMemberStaging table (you can truncate this table on your Dev machine without causing any issues, since it is just a staging table):

USE AxDB

TRUNCATE TABLE dbo.RETAILSTORELOCATORGROUPMEMBERSTAGING

GO

 

·         Back at your AutomateInstall script steps, select “7. Set step complete (Only if an error occurred)”.

·         Enter 24 to restart your runbook execution from step 24.

·         Your update/runbook execution should now continue and execute without this error occurring again.

 

SSRS error during the Sync AX database step (usually occurs during step 24 of the runbook execution)

·         You might run into a SSRS related http request error during the runbook execution. This usually happens during step 24 of the runbook execution. The error you receive will look like the one highlighted below.

 

Executing step: 24

GlobalUpdate script for service model: AOSService on machine: localhost

Sync AX database

The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: System.Management.Automation.RuntimeException: An exception of type System.Net.WebException occurred when making an http request to: http://127.0.0.1/ReportServer. Refer to the log file for more details.

The step failed

The step: 24 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, Parameters parameters)

   at Microsoft.Dynamics.AX.AXUpdateInstallerBase.RunbookExecutor.executeRunbook(RunbookData runbookData, String updatePackageFilePath, Boolean silent, String stepID, ExecuteStepMode executeStepMode, Boolean versionCheck, Parameters parameters)

   at Microsoft.Dynamics.AX.AXUpdateInstallerBase.AXUpdateInstallerBase.execute(String runbookID, Boolean silent, String updatePackageFilePath, IRunbookExecutor runbookExecutor, Boolean versionCheck, Parameters param)

   at Microsoft.Dynamics.AX.AXUpdateInstaller.Program.InstallUpdate(String[] args)

   at Microsoft.Dynamics.AX.AXUpdateInstaller.Program.Main(String[] args)

 

·         This can be one of two issues:

o    Configuration issue – SSRS

§  Server name is incorrect

§  Use change database to correct the server name

 

 

o   SSRS services issues

§  To resume/recover from this error, open the Windows Service Manager and start (or restart if it already running) the “SQL Server Reporting Services (MSSQLSERVER)” service.

§  Back at your AutomateInstall script steps, select “7. Rerun runbook step (only if and error occurred)”.

§  Enter 24 to restart your runbook execution from step 24.

§  Your update/runbook execution should now continue and execute without this error occurring again.

 

Miscellaneous AX Database Synchronization errors during the Sync AX database step (usually occurs during step 24 of the runbook execution)

You might run into various errors during the Sync AX database step of the runbook execution (step 24). This usually occurs if your AX database was not synced/had problems before you kicked off the automated update installation procedure. You might see errors like the following:

 

Executing step: 24

GlobalUpdate script for service model: AOSService on machine: localhost

Sync AX database

07/17/2019 12:49:02: Loader exceptions detected: Could not load type 'Dynamics.AX.Application.Forms.ImResvSalesLine' from assembly 'Dynamics.AX.SmartReservation, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' because it attempts toimplement a class as an interface.   07/17/2019 12:49:06: Application configuration sync failed.        Microsoft.Dynamics.AX.Framework.Database.TableSyncException: Custom action threw exception(s), please investigate before synchronizing again: 'ReflectionTypeLoadException:Unable to load one or more of the requested type...

The step failed

The step: 24 is in failed state, you can use rerunstep command to debug the step explicitly

 

or

 

 

Executing step: 24

GlobalUpdate script for service model: AOSService on machine: localhost

Sync AX database

07/17/2019 15:33:06: Infolog diagnostic message: 'Error executing code: ImResvOnhandReplication table does not have method 'TransDate'.' on category 'Error'. 07/17/2019 15:33:06: Unexpected error occurred while execute computed column method: TransDate on view/ data entity ImResvOpenLineSales Microsoft.Dynamics.Ax.Xpp.MethodNotFoundException    at Microsoft.Dynamics.Ax.MSIL.Interop.throwException(Int32 ExceptionValue, interpret* ip)...

The step failed

The step: 24 is in failed state, you can use rerunstep command to debug the step explicitly

 

… or any number of AX database synchronization related errors. If this is the case, please resolve these sync errors manually first before continuing with your upgrade. Most of these sync errors can be resolved by completing the following actions in Visual Studio (running as an Administrator) on you Dev machine:

·         Perform a “Get latest version” for you code branch in Visual Studio.

·         Then, run a Full Build (i.e. selecting all packages/models to be build) of your D365 code in Visual Studio.

·         And finally, manually run a Database Synchronize in Visual Studio.

If the above still hasn’t solved your AX database synchronization errors, you have two options:

·         Manually fix the synchronization errors for each problematic table using the following method:

o    Export/Backup the data in the problematic tables using a SQL SELECT * INTO statement.

o    Drop the problematic tables using a SQL DROP TABLE statement.

o    Run a Database synchronise in Visual Studio to recreate the problematic tables.

o    Import/Restore the data back to your recreated tables using a SQL INSERT INTO statement.

·         Or alternatively, you can backup a working D365 AXDB SQL database from another development machine and restore it to your development machine.

Once you’ve manually resolved your AX database synchronization errors continue with the automated update installation:

·         Back at your AutomateInstall script steps, select “7. Rerun runbook step (only if and error occurred)”.

·         Enter 24 to restart your runbook execution from step 24.

·         Your update/runbook execution should now continue and execute without the sync error occurring again.

 

Timeout errors (usually occurs during step 41 of the runbook execution)

·         You might run into timeout errors during the runbook execution. This usually happens on slower development/OneBox machines and usually during step 41 of the runbook execution. The timeout error you receive will look like the one highlighted below.

 

Executing step: 41

GlobalUpdate script for service model: MROneBox on machine: AX10PL24_8_19

Update the financial reporting database

The step execution time exceed the timeout value specified: 110min

The step failed

The step: 41 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, Parameters parameters)

   at Microsoft.Dynamics.AX.AXUpdateInstallerBase.RunbookExecutor.executeRunbook(RunbookData runbookData, String updatePackageFilePath, Boolean silent, String stepID, ExecuteStepMode executeS

tepMode, Boolean versionCheck, Parameters parameters)

   at Microsoft.Dynamics.AX.AXUpdateInstallerBase.AXUpdateInstallerBase.execute(String runbookID, Boolean silent, String updatePackageFilePath, IRunbookExecutor runbookExecutor, Boolean versi

onCheck, Parameters param)

   at Microsoft.Dynamics.AX.AXUpdateInstaller.Program.InstallUpdate(String[] args)

   at Microsoft.Dynamics.AX.AXUpdateInstaller.Program.Main(String[] args)

 

·         To resume/recover from this error, back at your AutomateInstall script steps, select “8. Set step complete (Only if an error occurred)”.

·         Enter 41 to restart your runbook execution from step 42, skipping the problematic step 41.

·         This will mark step 41 in the runbook as complete and continue running the runbook from step 42. Step 41 is related to the updating the financial reporting database and is not a crucial part of your update, hence us skipping this step to avoid the timeout error we received previously.

·         Your update/runbook execution should now continue and execute without this error occurring again.

 

Zip File Blocking Issues

·         If you experience any issues related to Zip file blocking when downloading the latest D365FO Update (for platform- or regular/incremental updates) from LCS or copying it from the network to C:\Temp on your Dev machine, please follow the steps below to unblock the Zip file.

·         Ensure that the update zip file does not show as blocked under C:\Temp in Windows Explorer. If it does, right click the zip file and open its Properties and ensure the properties on the zip file looks like the properties in the screenshot below (i.e. that the zip file is unblocked).

 

Electronic Reporting build errors

·         If you run into any Electronic Reporting related build errors during the D365FO update process or when manually building your applications in Visual Studio (e.g. after an update or a code branch change etc.), please try the following to resolve your problem:

·         Try to find a development machine that has already been updated to the D365FO version that you are trying to upgrade your D365FO development machine to (ask your colleagues or contact John Shine to get the name of an already updated dev machine if you’re not sure).

·         Backup your Electronic Reporting folder ([Drive]:\AOSService\PackagesLocalDirectory\ElectronicReporting) on your Dev machine (just copy this folder to a another folder on your Dev machine for safe keeping in case something goes wrong).

·         Then, delete the Electronic Reporting folder on your Dev machine (delete it to the Windows Recycle Bin to be safe).

·         Next, copy the entire Electronic Reporting folder, from the already updated dev machine, to your dev machine.

·         Run your update / a full build again and the build errors should be resolved.


Comments

Popular posts from this blog

Restore Database User Guide