Min blogg är både en privat blogg och en plats där jag sparar intressanta teknikartiklar. På förstasidan hamnar alla artiklar men om man bara är intresserad av min tekniska information så kan man välja rubriken/kategorin Tech. För att prenumerera på Tech, använd denna feed.
In working with Dynamics 365 for operations one is exposed to Azure SQL. Azur SAL works a bit differently than the “regular old” SQL and one of those areas is backup.
To backup a database in Azure SQL I use one of two methods:
1. Create a copy of the table in the same SQL Server
CREATE DATABASE [sourcedb] AS COPY OF [destinationdb]
This operation is performed asynchronously and you will need to verify that the job is done before you continue. This can be done with this command:
SELECT * FROM sys.dm_database_copies
Note: you need to have selected the master database when you run the backup. Otherwise you will not be able get an exclusive lock on the database and you will get the following error: Msg 42019
To find what is locking the database you can use:
SELECT * FROM sys.dm_exec_sessions
KILL [session ID]
2. Use SqlPackage to create an export in the form of a BacPac file
cd C:\Program Files (x86)\Microsoft SQL Server\130\DAC\bin
SqlPackage.exe /a:export /ssn:<server>.database.windows.net /sdn:<SourceDB> /tf:<filedestination> /p:CommandTimeout=1200 /p:VerifyFullTextDocumentTypesSupported=false /sp:<sql password> /su:<sql user>
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:
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:
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)
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
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”
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”
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.
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…
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
Today we are doing a DB upgrade in Dynamics 365 for Operations. One of the steps in the process includes installing a hotfix which in turn triggers a database sync. The Sync failed so I tried to find a way to run it manually and since the environment is a TEST environment it does not have Visual Studio. Powershell to the rescue:
I:\AosService\WebRoot\bin\Microsoft.Dynamics.AX.Deployment.Setup.exe -bindir "I:\AosService\PackagesLocalDirectory" -metadatadir "I:\AosService\PackagesLocalDirectory" -sqluser "axdbadmin" -sqlserver "Demo-00000000" -sql database "AxDB" -setupmode "sync" -syncmode "fullall" -isazuresql "true"
One of my colleagues contacted me today about an issue. When he was logged into the Dynamics 365 for Operations Cloud POS and he tried to perform a “Real-Time Operation” such as resetting a password he got this error:
To reproduce it I tried to do the same, and low and behold it worked… we used the same PoS worker and we had the same Roles in Dynamics…
While he was doing some more testing i logged in to the Dynamics Server using RDP to see if there was anything in the Event viewer… Found something!
Real-time Service client library call for API ‘InvokeMethod’ method ‘UpdateStaffPassword’, language ‘sv-SE’, and company ‘usrt’ failed. Exception: ‘System.ServiceModel.FaultException`1[Microsoft.Dynamics.Retail.TransactionServices.ClientProxy.Fault]: Fault was thrown by the service for request c7f48632-52a9-447e-ba42-9d7cb4c800ba. Exception details:
Message: The language sv-SE is not supported by Microsoft Dynamics 365 for Operations. For a list of supported languages, see Microsoft Dynamics 365 for Operations Online. (Fault Detail is equal to Microsoft.Dynamics.Retail.TransactionServices.ClientProxy.Fault).’.
The language sv-SE is not supported by Dynamics 365 for Operations… that’s better… now I know where to look. My browser was using english and my colleague was using swedish. We changed it to look like this by switching the order and moving English to the top…
… it worked !!!
That is all for today
Our company has retired all of our lab hosts which we used to have internally which means thet we need to have our lab servers on Microsoft Azure. To install the servers we use LCS (Lice Cycle Services) which deploys a VM in our Azure Subscription. The problem is that the VM is not activated, which on an internal server would require a product key and a Windows Server License… When running VMs internally we used to handle this by rearming the VMs 3 times which gives us a total of 180 days and then set up a new one which was a little hassle but it worked. But since we now have deployed VMs on Azure there is actually a license included in the Azure VM which means that there is no need to run a server which is not activated. Here is a short description on how to activate the AX VM…
- Install the new VM on Microsoft Azure using LCS
- Log into the the server using RDP (the logon info is in LCS)
- Start an elevated command prompt
- Find the edition of the VM by running this command:
DISM /online /Get-CurrentEdition
We get: Current Edition : ServerDatacenterEval
- Find out which edition you can upgrade to by running:
DISM /online /Get-TargetEditions
We get: Target Edition : ServerDatacenter
This means that you can upgrade from the evaluation edition of datacenter edition to the full version of datacenter edition. Now we need a license key… Microsoft uses Automatic Virtual Machine Activation to license the VMs in Azure… This means that if the host is activated (which it hopefully is ) the guest gets activated but to use this feature the guest VM still need a product key. The keys are available on Technet.
- Use the correct key to activate the VM by running this:
DISM /online /Set-Edition:ServerDatacenter /ProductKey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX /AcceptEULA
- Restart the VM and verify that is is not using Evaluation Edition anymore
That’s all for today
One of my colleagues had an issue accessing the Screen Layout designer in the AX Client and I was a bit confused… it worked for me… This turned out to be two separate issues.
The first one was that he and I was logged into two different AOSes and the Retail Headquarter was not installed on the one he was logged on to… simple enough to fix… I simply installed it. The Retail Headquarter component includes some DLLS that are required. If you want to be able to run the Retail Layout Designer on a client or terminal server you will need to install the retail components on the client/terminal server as well.
When we installed the Headquarter components we unfortunately missed the fact the we “probably should” install Expression Blend (note to self… read all the instructions)
When we tried to start the Designer it crashed with this error.
I found information on this issue on LCS Issue Search (Link below). The trick is to install Expression Blend Dev Kit for .NET and then copy Microsoft.Expression.Interactions.dll and System.Windows.Interactivity.dll from “C:\Program Files (x86)\Microsoft SDKs\Expression\Blend\.NETFramework\v4.0\Libraries” to “C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin”
When these issues was fixed and my colleague tried to start the Button Grid Layout he gets this error:
Normally the AX AOS Service user is used to access the AX database but in some cases the individual user needs to have specific access… below is a link to an article that describes steps involved
One of my customers have migrated to new servers for their AOSes, these are brand new Windoews Server 2012 R2 servers… nice. We hade one issue though… When trying to send emails using batch from a batch jog we got the following error:
Microsoft.Dynamics.Ax.Xpp.ClrErrorException: Exception of type ‘Microsoft.Dynamics.Ax.Xpp.ClrErrorException’ was thrown.
at Microsoft.Dynamics.Ax.Xpp.CLRInterop.staticInvoke(String typeName, String methodName, Object parameters, Type type)
at Dynamics.Ax.Application.WinAPIServer.cryptUnProtectData(Object _encryptedDataBlob) in WinAPIServer.cryptUnProtectData.xpp:line 39
at Dynamics.Ax.Application.SysEmailParameters.password() in SysEmailParameters.password.xpp:line 18
at Dynamics.Ax.Application.SysEmailDistributor.Processemails(Guid _emailProcessorId) in SysEmailDistributor.processEmails.xpp:line 39
at Dynamics.Ax.Application.SysEmailDistributor.Run() in SysEmailDistributor.run.xpp:line 78
at Dynamics.Ax.Application.BatchRun.runJobStaticCode(Int64 batchId) in BatchRun.runJobStaticCode.xpp:line 54
at Dynamics.Ax.Application.BatchRun.runJobStatic(Int64 batchId) in BatchRun.runJobStatic.xpp:line 13
at BatchRun::runJobStatic(Object )
at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object parameters)
at BatchIL.taskThreadEntry(Object threadArg)
It took me some time to figure it out… Apparently the password for the SMTP account is saved in the AX database, but using an encryption key from the computer which saved it (a.k.a. the server that was retired) so when moving to the new server it was not able to read it. To fix it I simply entered the password again from the new server and Presto!
One of our customer are going to use the AX 2012 R3 Retail solution and the setup of the Async Server – Client in the TEST environment was setup and tested. The application consultants started importing the product data to AX and suddenly the sync stopped with this error:
Microsoft.Dynamics.Retail.StoreConnect.Request.SQLHandler.ProcessSourceRequestHeaderException: ProcessTargetRequestHeader failed due to an InvalidOperationException.connectionString: Data Source=XXXXXX;Initial Catalog=ClientChannelDB;Integrated Security=True;Connect Timeout=60;Application Name=”Commerce Data Exchange Async Client” —> System.InvalidOperationException: The given value of type String from the data source cannot be converted to type nvarchar of the specified target column. —> System.InvalidOperationException: String or binary data would be truncated.
After having a look online I found that there is no sync of the schema between the AX database and the Channel Database (!!!). This meant that when we imported data to AX everything worked but when we did the sync jobs it failed. The reason being that some field types did not match.
After talking to MS support I got a script to try to figure out which fields were wrong
select t1.table_name, t1.column_name, t1.character_maximum_length, t2.character_maximum_length
from MicrosoftDynamicsAX.INFORMATION_SCHEMA.columns t1
inner join RetailHoustonStore.INFORMATION_SCHEMA.columns t2
on t1.table_name = t2.table_name
and t1.column_name = t2.column_name
and t1.character_maximum_length != t2.character_maximum_length order by TABLE_NAME
this query finds all of the fields which are not matched between the AX database and the Channel Database. With some help we found that the issue probably was the field called RETAILVARIANTID which was present in INVENTDIMCOMBINATION and INVENTITEMBARCODE
We ran these SQL queries:
ALTER TABLE [ClientChannelDB].ax.INVENTDIMCOMBINATION ALTER COLUMN RETAILVARIANTID nvarchar(25) NOT NULL;
ALTER TABLE [ClientChannelDB].ax.INVENTITEMBARCODE ALTER COLUMN RETAILVARIANTID nvarchar(25) NOT NULL;
And there was also a view called INVENTDIMCOMBINATION which we scripted out to a query windows, deleted and recreated again. This solved the issue.