If you have access to an account with local administrator privileges to a Windows box hosting the Dynamics NAV or Business Central service, you can add your own user very easily with Powershell.
Note: This post is about the on-premise version of Business Central (formerly Dynamics NAV), to add a user to Business Central Cloud/SaaS see here: Add User in Business Central Cloud / SaaS
This functionality has been available for quite sometime in Dynamics NAV and continues to be applicable to Business Central On-premise… so it surprises me how often I get asked for a NAV user by technical staff. I’ll now be forwarding this blog post when asked!
Another use for this of course (amongst other things) is when you need to restore a database which doesn’t contain a login you have access to. In the past we had to clear out the User related tables in SQL so NAV would give us access on first log on.
There are two Cmdlets we need:
New-NAVServerUser – Used to create the NAV user
New-NAVServerUserPermissionSet – Used to assign a Permission Set to the user.
As of Business Central CU03, the Cmdlets still have “NAV” in their name.
So for example, using the Business Central or Dynamics NAV Administration Shell (run as administrator) we can add a new Windows user to NAV/BC and assign the SUPER Permission Set as follows:
> New-NAVServerUser ServiceInstanceName -WindowsAccount DOMAIN\User.Name
ServiceInstanceName -WindowsAccount DOMAIN\User.Name -PermissionSetId SUPER
If you want to add your currently logged on Windows user you can use the whoami command:
> New-NAVServerUser ServiceInstanceName -WindowsAccount $(whoami)
ServiceInstanceName -WindowsAccount $(whoami) -PermissionSetId SUPER