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
723 stars 241 forks source link

[Solved] Can't publish with "authentication": "UserPassword" from a second machine out of Domain #4561

Closed JavierFuentes closed 4 years ago

JavierFuentes commented 5 years ago

Describe the bug We have a Development Business Central OnPremise server joined to our Active Directory Domain.

We can deploy our project from a laptop with Windows 10 (October 2018) joined to the same Domain using domain credentials.

Now we have setting up all the development environment cloning the Git repository in a different laptop with Windows 10 (October 2018) but not-joined to the Domain...

We have changed our launch.json file to "authentication": "UserPassword" but after input our domain-user credentials when try to publish, VSCode throws this Error in console:

[2019-02-03 21:43:22.41] The request for path /bcentral/dev/metadata failed with code Unauthorized. Reason: Unauthorized
[2019-02-03 21:43:22.44] Error: An internal error has occurred

We have tried to deploy with F5 and with Ctrl+F5 and clearing cache credentials several times with the same results.

With these credentials we can log in at web client without any problem in the second laptop and of course can publish from the first laptop joined to the Domain.

Expected behavior Can deploy from a laptop out of Domain using domain-credentials.

Versions: AL Language: 2.0.48254 Business Central: ES Dynamics NAV 13.0 (24630) OnPremise

atoader commented 5 years ago

Hi @JavierFuentes ! UserPassword does not mean that you can now enter your domain credentials in VSCode. That setting refers to the types of credentials defined here: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/administration/users-credential-types . Your server must be configured to accept credentials in this manner before you can publish.

Please use one of the following resources to get more help: Business Central Community mibuso forum Dynamics User Group

JavierFuentes commented 5 years ago

OK, for all those who, like us, it is not an option to change the value of the Credential types property of the server instance so that your users don't lose the Single Sign On feature or because you are publishing on a Development machine without a valid Certificate...

This problem with development environments can be solved by using the runas /netonly command in a .BAT file

For example:

runas /netonly /user:domain\username "%LOCALAPPDATA%\Programs\Microsoft VS Code\code.exe C:\YourProjectPath\YourExtensionProject.code-workspace"

You will need to type manually your domain-user password, but you will be able to publish extension updates from an out-of-domain machine.

atoader commented 4 years ago

Thank you for sharing the solution with everybody! I will close this issue.