Try Microsoft Edge
A fast and secure browser that's designed for Windows 10
I am using powershell to run a few navcodeunits but I am getting credential errors because my environment has been setup with navuserpassword authentication. Is there a way to handle this without switching to windows credientials.
Here is the error:
Invoke-NAVCodeunit NAV -CodeunitId 37044411 -MethodName rdSetupWarehouseEmployeesForAllLocationsWithDefaultLocationFromPowershell -Argument "TESTFORLONGNAME,Detroit"
Invoke-NAVCodeunit : The server has rejected the client credentials.
+ CategoryInfo : NotSpecified: (0:Int32) [Invoke-NAVCodeunit], FaultException`1
+ FullyQualifiedErrorId : MicrosoftDynamicsNavServer$NAV,Microsoft.Dynamics.Nav.Management.Cmdlets.InvokeNavCodeunit
I don’t think it’s possible. You need to have the user under which you’re running the PowerShell script on NAV. You don’t need to switch to Windows authentication:
In your PowerShell script, first create the user in NAV with your Windows credentials (using New-NavServerUser) with the appropriate permissions. In this way you’ve A Windows user with the correct permissions in NAV. Then, run Invoke-NAVCodeunit.
Check this link
The suggestion on the link says: The solution was simply to create a new user (Windows authentication) and permission set for the Windows user running PowerShell. After creating this user I was able to run the codeunit. There is no need to create a separate NST handling Windows authentication.
Unfortunately in Dynamics 365, I am not seeing a way to create a windows user.
In my previous comment I’ve showed the solution that works for NAV 2018. What are you talking about?