Setting Up Administrator Account in NAV when Administrator accidentally deletes his own permission 😂
Introduction:
Even using the Administrators account I cannot get access to a different company.
The condition here was that I cannot simply clear all User Access as per the blog below.
https://www.sauravdhyani.com/2012/12/you-are-not-authorized-to-sign-in.html
Pre-requisites:
Microsoft Dynamics NAV / Business Central On-Premise
Demonstration:
1. Modifying User using SQL Database:
If observed it evident that whenever the Administrator account is added there should always be a Windows User associated with it.
To remove this constraint, modify the Username in User Table and Windows Security ID using SSMS in SQL Tables.
Changed the User Name to ADMINISTRATOR-1 and one character in User Security ID |
At this point, I wasn't sure if I could run any code in NAV to Add the User correctly. Then I remembered using the code from 'Add me as Administrator'.
2. Modifying 'Add me as Administrator' for the first user in NAVISION:
In NAV / Business Central if there are no users present, the button 'Add me as Administrator' is enabled.
This button will help you create a SUPER User.
I checked the code behind the button and found there is a codeunit 9000 - Users Create Super User that has a check that if Users are EMPTY then only User is created.
I had to disable the check and run the codeunit.
Code commented to disable User Check |
This will create the Windows User with SUPER Permission.
A new Administrator user created with SUPER Permission |
Why didn't you use powershell? New-NavServerUserPermissionSet Command works fine.
ReplyDeleteNo fiddeling in C/AL and no T-SQL necessary.
Make sense!
ReplyDeleteI will definitely try your approach.