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