Skip to main content

Notifications

Business Central forum

How to use basic authentication to access web service in D365BC server in a VM

Posted on by Microsoft Employee

Hi everyone,

We have install a D365 server environment in a local VM. We used to publish our extension and add these expose these pages to web service. Using  basic authentication(UserName and Web Access Key) to get the Json data. (Document Link) It all works well for online trail D365BC and online sandbox. However, when we try to use D365 server environment in a local VM, it always return a 401 unauthorize error if I choose basic authentication and still use the username and web access key. I have enable the Odata service. It works if I enable NTLM Authentication and use NTLM to do the Authentication. But I want to use the basic authentication(UserName and Web Access Key) and not use the basic API URL to do the integration. What should I do. Thanks in advance!!

ED47FE39.PNG

WeChat-Screenshot_5F00_20181205161354.png

WeChat-Screenshot_5F00_20181206095035.pngWeChat-Screenshot_5F00_20181206095117.pngWeChat-Screenshot_5F00_20181206095130.pngWeChat-Screenshot_5F00_20181206095219.pngWeChat-Screenshot_5F00_20181206095339.png

Categories:
  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to use basic authentication to access web service in D365BC server in a VM

    Thank you very much Ari,

    It is working now.

    Just to recap what you mentioned :

    • The option "Use NTLM Authentication" should be enabled in the D365BC Administration config page when the Credential Type is Windows --> Use your Windows Credentials as Username and Password with domain name in SOAP UI or POSTMAN:

    forum2.png

    • When you have any other Credential type in the D365BC Administration config page (ex: NavUserPassword, ...) --> Use your Username and Web Access Key from your User Card in POSTMAN (or SOAP UI) and use the Basic Authentication as authentication type :

    forum2.png

    Thanks again,

  • I Gusti Made Ari Profile Picture
    I Gusti Made Ari 3,594 on at
    RE: How to use basic authentication to access web service in D365BC server in a VM

    Hi Nissay, for your case, have  you tried following :

    - Enable "Use NTLM Authentication" in the service configuration

    - Then in your postman you need to use ntlm authentication as the authentication method (use the windows username and password to connect).

    Using username and Web Access key is being used  only if  you are using NavUserPassword as the credential type .

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to use basic authentication to access web service in D365BC server in a VM

    Hi,

    Please we have the same issue and we cannot access the web service through SOAP UI or POSTMAN with the username and the web access key. we always have the 401 Unauthorized error (our D365BC is hosted locally and we use Windows Credentials as Credentials Type for D365BC).

    Have you any idea or have you tried anything else except the one you marked as a solution?

    Thanks in advance,

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to use basic authentication to access web service in D365BC server in a VM

    I found the solutin for my issue.   docs.microsoft.com/.../how-to--configure-authentication-of-microsoft-dynamics-nav-web-client-users

    To enable an authentication method on the Microsoft Dynamics NAV Web client site

    On the computer that is running Microsoft Dynamics NAV Web Server components, open Internet Information Services (IIS) Manager.

    On the Start menu, in the Search programs and files box, type inetmgr, and then press Enter.

    In the Connections pane, under Sites, choose Microsoft Dynamics NAV 2018 Web Client.

    Under IIS, double-click Authentication.

    In the Authentication pane, enable the appropriate authentication based on the credential type.

    For the Windows credential type, enable Windows authentication. If you are using Dynamics NAV apps, you must also enable Anonymous authentication.

    For the UserName, NavUserPassword, and AccessControlService credential types, enable both Forms authentication and Anonymous authentication.

    To enable an authentication method, choose the authentication method from the list, and then choose Enable in the Actions pane.

    For Windows authentication, you must set up an authentication provider. By default, Windows authentication is configured to use the Negotiate and NTML providers, which is sufficient for most installations and no action is required. If the computer that is running Microsoft Dynamics NAV Web Server components and Microsoft Dynamics NAV Server are on different computers, and delegation with Kerberos is configured between the two computers, then the Negotiate provider must be first in the list of providers.

    To set up the providers, do the following:

    Choose Window Authentication, and then under Actions, choose Providers.

    To add a provider, select the provider from the Available Providers list, and then choose Add.

    To move a provider in the Enables Providers list, select the provider, and then choose the Move Up or Move Up button.

    Choose the OK button.

    Restart the web server.

    In the Connections pane of IIS Manager, choose the root node for your computer, and then in the Actions pane, choose Restart.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to use basic authentication to access web service in D365BC server in a VM

    I have updated my post. I could access the data via browser and use VM login. I would like to access use 365 user name and web access key. Thank you so much.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to use basic authentication to access web service in D365BC server in a VM

    I have update the post and I was able to get the data via browser and use VM login as username and password. I'm not sure how to switch to use 365 username and web access key. Is that because I didn't enable SSL?

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: How to use basic authentication to access web service in D365BC server in a VM

    VMADMIN is the right username you have in your D365BC sandbox (User Page)?

    Are you sure? Or it’s the user that you have to access the VM while BC is configured with NavUserPassword authentication?

    Open D365BC, check your user in User page, then use the username without domain and the access key.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to use basic authentication to access web service in D365BC server in a VM

    Hi Ruinning,

    1) Have you tried the username without using the Domain name (Without EDISRV12).

    2) If it is not working, check the header response for. it gives sometimes more details on the error.

    2018_2D00_12_2D00_05-12_5F00_38_5F00_18_2D00_Action-center.png

    --

    Best Regards,

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to use basic authentication to access web service in D365BC server in a VM

    Thank you for replying. I copied the endpoint from "Web Service" page. It should be no issue. I could successfully get the data by NTLM Authentication. But I want to know whether I could use Basic auth(username and web access key)? Username and Web Access Key works in cloud environment. But 401 unauthorize error in a local VM.

  • Suggested answer
    Stefano Demiliani Profile Picture
    Stefano Demiliani 37,162 Most Valuable Professional on at
    RE: How to use basic authentication to access web service in D365BC server in a VM

    Are you using a correct endpoint? You can use basic auth also in a local VM.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans