Friday, 26 May 2017

Failed to create a session;confirm that the user has the proper privileges to log on to Microsoft Dynamics


Solution 1: Delete Partitions & Check User Info Table


UPDATE USERINFO
SET SID='S-1-5-21-916693446-2822637979-541647007-1001', NETWORKALIAS='administrator', NETWORKDOMAIN='contoso', NAME='Vijay'
WHERE ID = 'Admin'
— This will replace the AX Admin user to your user – you can modify this query to replace other
— users as well, or you can later add new users from the AX GUI.
If  setup a new environment for you and imported the demo data using the “Test Data Transfer Tool” you can run into this error upon sync.  
The reason you get this error is that there are 3 partitions:   Ext, Initial and PS and user Info was only given to the initial partition,you need to do to resolve this issue is:

a. First in SQL review the userinfo table and checkout how many times you see the Admin ID in the table:  select * from userinfo where id = ‘admin’


b. I’m guessing you only see the admin record one time and this would be the problem.  When you have multiple partitions you should see the record in there for as many partitions as you have.  So, in our instance there should be 3 admin records in the userinfo table.


c. In SQL I usually run this command:  delete PARTITIONS where PARTITIONKEY in (‘ext’, ‘ps’)


d. Next open the AX client and navigate to:  System Administration > Setup > Partitions.


e. You should only see one partition called “Initial”.  We need to recreate the two we delete via our SQL script.  So create two new partitions called:  Ext and PS as seen below.


Partitions


f. Go review the userinfo table in SQL you should see that two new records have been automatically added for the administrator account.


g. Now try to sync the database in AX and you should have success!



Solution 2: Run Business Logic


The second thing you can try which occasionally works is to run the business logic not using IL.  You can disable this by:



a. In the AX client navigate to:  File > Tools > Options > Development hyperlink.

b. Unmark “Execute Business Operations in CIL”.


c.  Close the AX app and restart your AOS.


d. Open AX and try to Sync.



Solution3. Run a Full CIL.


a. To do this restart your AOS 1st and then from the AX Development Environment go to:


i. Build > Generate Full CIL.


Generate Full CIL in AX 2012


b. Now try to Sync.




Solution 4: Delete your AUC Files.


NOTE:  The AUC file is a cache of objects from the AOT.


a. Close out of AX.


b. Navigate to one of the following:


i. Windows XP and Windows 2003


C:\Documents and Settings\%username%\Local Settings\Application Data


ii. Windows Vista, Windows 7 and Windows 2008


C:\Users\%username%\AppData\Local


c. Delete the file or files with the extension .auc.


d. Open AX and try to Sync.




Solution 5: Improper Privileges


The user actually doesn’t have the proper privileges in SQL to run a sync which means they aren’t in the db.reader and db.datawrite roles check your SQL User Mapping.



Grant the AX AOS account permissions over the databases as follows:
AXProdNEW:
db_datareader
db_datawriter
db_ddladmin
public
axpermissions1
AXProdNEW_model:
public
axpermissions2
You can identify the AOS account by going to the services on the application server (start->
services.msc) and check the Log On tab:
axservices1
If you are using NETWORK SERVICES as the service account you will need to grant permissions to the machine$ account – Use the following query to do it: