microsoft / AL

Home of the Dynamics 365 Business Central AL Language extension for Visual Studio Code. Used to track issues regarding the latest version of the AL compiler and developer tools available in the Visual Studio Code Marketplace or as part of the AL Developer Preview builds for Dynamics 365 Business Central.
MIT License
739 stars 243 forks source link

Issue publishing with Entra authentication #7864

Open KoenvdLouw opened 2 days ago

KoenvdLouw commented 2 days ago

I have setup on-prem BC with Entra authentication and it is working perfectly to log in to BC with Entra. However from within VScode I can't get it to work. Downloading symbols or publishing get's me an error which I can't seem to find what I am doing wrong.

Launch.json image

When downloading symbols I am being redirect to the MS site to log in with my Entra user and allow me for Dynamics 365 Business Central Developer. I do that, allow it and in VScode it then gives this error:

image

ClientServicesCredentialType is set to AccessControlService to prevent normal username/password login. When I have it on NavUserPassword and log in with my username/password I can download the symbols. So to me the only logical thing is something is wrong with the Entra authentication from within VScode or some setting. I'm however struggling to find the issue and google is not my friend this time.

BC version 2024 wave 1 VScode version 1.94.0 Al language extension v14.0.1161190

Should this be able to work correctly? Is there anything obvious I am missing or something I need to check ? Any help would be appreciated.

BazookaMusic commented 2 days ago

Did you follow this? https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-aad-auth-onprem

I see the primary tenant domain commented out

KoenvdLouw commented 2 days ago

I did follow that and allready tried with PrimaryTenantDomain. I was trying a lot of things after that, hence it being commented out at the moment.

I have rechecked with xxxxx.onmicrosoft.com as primaryTenantDomain, but no luck..

BazookaMusic commented 15 hours ago

Can you check the event viewer when you try to login for errors? Also did you setup the audiences as described in the documentation?

Using Visual Studio Code If you are connecting to your solution from Visual Studio Code, then you must also specify the Business Central server config parameter ValidAudiences and set it to https://api.businesscentral.dynamics.com. If you do not do this, you will get the error securitytokeninvalidaudienceexception in the application log when trying to download symbols