Invoke-NAVCodeunit - The server has rejected the client credentials

Bartho
Member Posts: 6
Hi,
I am in the process of creating a NAV test enviroment using PowerShell and need to run several codeunits with PowerShell.
However when I run Invoke-NAVCodeunit I get an error message saying "The server has rejected the client credentials". As far as I can see Invoke-NAVCodeunit doesn't accept any credential parameters.
The ClientServicesCredentialType on the server instance is set to NavUserPassword. If I delete all users in the database then I am able to run Invoke-NAVCodeunit without any errors however I cannot delete the users as the codeunits I am running requires users to be present.
Any ideas how to solve this?
Thanks,
Morten
I am in the process of creating a NAV test enviroment using PowerShell and need to run several codeunits with PowerShell.
However when I run Invoke-NAVCodeunit I get an error message saying "The server has rejected the client credentials". As far as I can see Invoke-NAVCodeunit doesn't accept any credential parameters.
The ClientServicesCredentialType on the server instance is set to NavUserPassword. If I delete all users in the database then I am able to run Invoke-NAVCodeunit without any errors however I cannot delete the users as the codeunits I am running requires users to be present.
Any ideas how to solve this?
Thanks,
Morten
0
Answers
-
Hi,
First, you need to make sure you can login RTC use that user(with user created in NAV), if so, then I think the way you pass user id and password to NAV through powershell is not correct.
You can paste the command here, someone else can help you with that.0 -
allenyyzhou wrote: »Hi,
First, you need to make sure you can login RTC use that user(with user created in NAV), if so, then I think the way you pass user id and password to NAV through powershell is not correct.
You can paste the command here, someone else can help you with that.
I can logon with RTC without any problems.
To run the codeunit from PowerShell I use the command below.
Invoke-NAVCodeunit -CompanyName "CRONUS International Ltd." -CodeunitId 50000 -ServerInstance NAV0 -
How exacly do you pass your credentials in Invoke-NAVCodeunit call? I haven't seen anyting in the documentation saying that you can do it.
If you do not pass anyting explicitely then I'd assume that Invoke-NAVCodeunit uses your windows credentials to log in, an in order to make it work you need to have a separate NST handling Windows authentication, as NST does not support mixed authentication types.Slawek Guzek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-030 -
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.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions