Friday, December 11, 2015

Add User to Microsoft Dynamics NAV 2016 Database.

Hi All,

As New Version Release there are some changes in System Tables and the way how we resolve our issues that we found solution in Previous Versions.

With Release of Microsoft Dynamics NAV 2016, our famous issue Get Access to Database Need to be resolved.

If You Don't know the issue, here is a simple details -

You Receive a Database From Customer or you have a database on your server but you are not part of the Users in the database. When you try to access the Client (Windows / Web / Tablet / Phone) System generates Below Error Message.

You do not have access to Microsoft Dynamics NAV. Verify that you have been set up as a valid user in Microsoft Dynamics NAV.




IN Nav 2013, if you remember we discussed Two Ways to get access to the database - 

 > Delete All Users  (Can be Used with NAV 2016)

 > Add Your User From SQL (Will not work with NAV 2016)

But with Release of NAV 2013 R2 and Later, the Great Power Came with Powershell.
In This article we will see how we can use powershell cmdlet to Add Our User with Certain Permission in the database.

** Article Applies to NAV 2013 R2 and Later.

How to Open PowerShell, refer Here !!
--------------------------------------------------------------------------------------------------------------------------
1. Open Powershell as Administrator.

2. Import Navision Cmdlet, if you are using the ISE (I love to use this).

  •    import-module "C:\Program Files\Microsoft Dynamics NAV\90\Service\NavAdminTool.ps1"

   ** Change 90 TO 80 or 71 for NAV 2015 or NAV 2013 R2 respectively.


3. Refresh the commands Panel and search for NAVServerUser, The result will be something like Shown Below..



4. Let's discuss in Brief about Search Results first -

Get-NavServerUser - Returns information about all users created in the current Microsoft Dynamics NAV database.
Get-NAVServerUserPermissionSet - Returns permission set information for Microsoft Dynamics NAV users.

New-NAVServerUser - Creates a new Microsoft Dynamics NAV user.
New-NAVServerUserPermissionSet - Assigns a permission set to a Microsoft Dynamics NAV user.

Remove-NAVServerUser - Deletes a Microsoft Dynamics NAV user.
Remove-NAVServerUserPermissionSet - Removes a permission set from the list of permission sets that are assigned to a Microsoft Dynamics NAV user.

 Set-NAVServerUser - Changes the configuration settings of an existing Microsoft Dynamics NAV user.

5. For the Purpose of this Article, we need to use only New-NavServerUser and New-NAVServerUserPermissionSet.
For others you can just select and specify the mandatory parameter to see how it works.

6. Select New-NAVServerUser and Specify the Required Parameter as shown below -



7. Now User is created, we need to assign Permission to user, select New-Select NAVServerUserPermissionSet and specify the required Parameter as shown Below -



All Done and we should be able to login to database now...

In This Article we used two cmdlet as below -

#Add User - 
New-NAVServerUser -ServerInstance <<Service Name>> -WindowsAccount <<Domain\USerName>> -LicenseType Full -State Enabled

#Add User Permission - 
New-NAVServerUserPermissionSet -PermissionSetId SUPER -ServerInstance <<Service Name>> -WindowsAccount "Domain\USerName"


Hope you find the information useful. Let me know your feedback as comment to article.

Regards,
Saurav Dhyani

No comments:

Post a Comment