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

2 thoughts on “Error in Environment Reprovisioning tool”

  1. I am trying to run the retail targeting tool after moving a database from azure to sql server and getting the following error: “‘Scheduler job has failed with error message”

    PSMessageDetails : Exception : System.Management.Automation.RemoteException: 10/01/2017 17:01:55: Infolog diagnostic message: ‘Scheduler job has failed with error message: ‘ on category ‘Error’. TargetObject : 10/01/2017 17:01:55: Infolog diagnostic message: ‘Scheduler job has failed with error message: ‘ on category ‘Error’. CategoryInfo : NotSpecified: (10/01/2017 17:0…tegory ‘Error’.:String) [], RemoteException FullyQualifiedErrorId : NativeCommandError ErrorDetails : InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : at Call-AXDeploymentSetupUtility, J:\DeployablePackages\7a5f49ea-73d5-4aff-9087-433bef4dbd07\Ret ailServer\scripts\SelfServiceConfiguration.psm1: line 252 at , J:\DeployablePackages\7a5f49ea-73d5-4aff-9087-433bef4dbd07\RetailServer\script s\RetargetRetailServer.ps1: line 546 PipelineIterationInfo : {}

    Have you encountered that before? Any idea how to proceed past that one?

    1. Hi…

      I have not encountered your error but I have two tips for troubleshooting. Check the logs in the RunbookWorkingFolder and also try to run the script (RetargetRetailServer.ps1) manually from an elevated Powershell prompt

      /Johan

Leave a Reply