Today I tried to import the database of our productive environment into our test-environment, to check a few things and test some features, without interrupting the productive environment.
Using the Deployment Manager I run the wizard of importing an organization, but at the step of mapping the users, I was getting the following error message:
You must map your Active Directory user account to at least one enabled Microsoft Dynamics CRM User who has the System Administrator security role before the organization can be imported.
I checked the users and found two important steps:
- The current logged in user was disabled in the crm database.
- This is caused by our architecture, as the “System Administrator” of the productive environment is different from the user on the test environment.
- The system administration-user of the test environment was missing the “System Administrator” rights in the new database.
The first thing I did was to get the userid of the administration-user of the test environment:
1 2 3 |
SELECT TOP (1000) [SystemUserId] FROM [ORG].[dbo].[SystemUserBase] where DomainName = 'MIKE\TestAdmin’; |
With the id of the user, I enabled the user
1 2 3 |
update SystemUser set IsDisabled = 0 where SystemUserId ='846D70EB-EA54-E811-9106-005056A247DC' |
The next step was to add the “system administrator”-Role to the user. Therefore I had to find the id of the role:
1 2 3 |
select RoleId from Role r left join BusinessUnit b on r.BusinessUnitId = b.BusinessUnitId where r.name ='System Administrator' and b.ParentBusinessUnitId is null |
And at the end, I added the role to the user
1 2 3 4 5 6 |
INSERT INTO [dbo].[SystemUserRoles] ([SystemUserId], [RoleId]) VALUES ('846D70EB-EA54-E811-9106-005056A247DC', 'F4A95CE2-612E-E811-90FE-005056A247DC') GO |