While testing some system configuration switches I had to re-synchronize the database a number of times. When I first synchronized the system I received the following error:
Failed to create a session; Confirm that the user has the proper privileges to log on to Microsoft Dynamics.
This issue occurred on a demo database and was caused because there was multiple partitions on the environment. Each partition has it’s own admin user, but only the primary partition admin account was pointing correctly to the correct domain and SID.
Using the following SQL I was able to change the admin accounts for the other partitions to bring them into alignment with primary partition.
DECLARE @Domain nvarchar(255);
DECLARE @Alias nvarchar(80);
DECLARE @SID nvarchar(124);
DECLARE @Partition BIGINT;
SELECT @Partition = Recid FROM PARTITIONS
WHERE PARTITIONKEY = N’Initial’
SELECT @Alias = NETWORKALIAS, @Domain = NETWORKDOMAIN, @SID = SID FROM USERINFO
WHERE PARTITION = @Partition AND ID = N’Admin’
UPDATE USERINFO SET NETWORKDOMAIN=@Domain, NETWORKALIAS=@Alias,SID = @SID
WHERE PARTITION != @Partition AND ID = N’Admin’
This issue should only occur if you are running multiple partitions in your environment.