In the past months, I have learned a lot about Dynamics NAV 2018. There are some examples available on the net, but not enough. So I will provide some examples on my blog.
Let’s start with setting up the free Docker container on Windows of Dynamics NAV for testing and development purposes.
My first obstacle was the requirements to the CPU.
First, you need a CPU with SLAT for running Hyper-V on Windows 10. See also https://social.technet.microsoft.com/wiki/contents/articles/1401.hyper-v-list-of-slat-capable-cpus-for-hosts.aspx which states: “Every Core i3, i5 and i7 supports SLAT. You can look up the supported AMD versions at KB article on AMD“.
So I bought a refurbished HP ProBook 6560b with a Intel Core i5-2520M CPU, but that did not work. It does not support docker images with more than 2 GB of RAM. But you need 4 GB to run Dynamics NAV 2018 in a container. See this bug for more details: https://github.com/docker/for-win/issues/1094.
With the coreinfo tool (download here for free: https://docs.microsoft.com/en-us/sysinternals/downloads/coreinfo), you can test if your CPU is supported:
If you see a star, then you should be fine.
PAGE1GB * Supports 1 GB large pages
If you see a hyphen, then you cannot use that computer:
PAGE1GB - Supports 1 GB large pages
You can install Docker for Windows from https://www.docker.com/docker-windows. You need to register in the Docker Hub for free. You install it, and it will ask you to restart the computer, the latest version enables Hyper-V, and it asks if you want to use Linux or Windows containers. Let the installer prepare your computer for Windows containers.
When you start Docker, and right click on the symbol, you see Kitematic. That is a useful tool to manage your containers graphically. Click on it, and it will download a zip file. Extract the contents to C:\Program Files\Docker\Kitematic.
The docker images from Microsoft are listed here: https://hub.docker.com/r/microsoft/dynamics-nav/
As administrator you open a PowerShell, and run these commands:
# this should pull the latest dynamics-nav, 2018 at the moment docker pull microsoft/dynamics-nav # now start a container docker run -e accept_eula=Y -e ClickOnce=Y -e UseSSL=N -m 4G microsoft/dynamics-nav
I chose the setting ClickOnce=Y because I wanted to test not only the web client, but also the Windows Client.
I chose the UseSSL=N setting because I had issues with Visual Studio Code to download the symbols or to upload my extension if it Dynamics NAV was installed with a self-signed certificate. I got the message:
Die zugrunde liegende Verbindung wurde geschlossen: Für den geschützten SSL/TLS-Kanal konnte keine Vertrauensstellung hergestellt werden.. Das Remotezertifikat ist laut Validierungsverfahren ungültig.
You probably could download the certificate from http://YOURCONTAINERIP:8080/certificate.cer and install it into your “Trusted Root Certification Authorities” but I did not want to do that just for testing purposes.
This is the output of the docker run command:
PS C:\WINDOWS\system32> docker run -e accept_eula=Y -e ClickOnce=Y -e UseSSL=N -m 4G microsoft/dynamics-nav Initializing... Starting Container Hostname is c63405985172 PublicDnsName is c63405985172 Using NavUserPassword Authentication Starting Local SQL Server Starting Internet Information Server Creating Self Signed Certificate Self Signed Certificate Thumbprint 5D0E6813F13AA90A59328F196F9594CCEF3F1DF9 Modifying Service Tier Config File with Instance Specific Settings Starting NAV Service Tier Creating DotNetCore Web Server Instance Creating http download site Creating Windows user admin Setting SA Password and enabling SA Creating admin as SQL User and add to sysadmin Creating SUPER user Creating ClickOnce Manifest Container IP Address: 172.17.43.185 Container Hostname : c63405985172 Container Dns Name : c63405985172 Web Client : http://c63405985172/NAV/ NAV Admin Username : admin NAV Admin Password : Qake5494 Dev. Server : http://c63405985172 Dev. ServerInstance : NAV ClickOnce Manifest : http://c63405985172:8080/NAV Files: http://c63405985172:8080/al-0.12.25327.vsix Initialization took 114 seconds Ready for connections!
Now how to test your Dynamics NAV instance:
- Web Client: you see the URL in the output above. It will be different in your installation…
- Windows Client: it does not work in Firefox, to download the ClickOnce manifest from the URL mentioned above, installing it gives the error: System.Deployment.Application.InvalidDeploymentException (Zone)
– Die Bereitstellung und die Anwendung haben keine übereinstimmenden Sicherheitszonen.
But it works in Edge or Internet Explorer just fine. You use the NAV Admin Username and Password as specified in the docker output.
- With Visual Studio Code: Install the AL Language extension from http://c63405985172:8080/, the file is called like al-0.12.25327.vsix. In Visual Studio Code, go to Extension, select the hamburger menu at the top, and choose “Install from VSIX file”. Installing the AL Language extension from the Marketplace would install a newer version of the extension, but it probably causes issues with your server because it is not compatible.
First steps with Visual Studio Code: Create a sample application: Ctrl-Shift-P, search for AL:Go!, and run it. This will ask you where you want the project stored, and then create a hello world example.
You need to modify the file launch.json, and enter for server the URL which was in the docker output labelled as “Dev. Server”, in my case “http://c63405985172”
Then you can press Ctrl-Shift-P, search for AL: Download Symbols, and run that.
After the symbols have been downloaded, run AL: Publish, which should first ask your for your username and password (use admin and the password from the docker output), then it will upload your extension to the NAV server, and VS Code will start the Web client with the page Contacts, because that page is the Object ID 22, which is defined in startupObjectId in launch.json. You will see the message box.
I have submitted this basic extension on Github: https://github.com/TBits/Al-examples/tree/master/HelloWorld
In the next post in this series, we will discover the AL language in more detail: Getting used to the AL language for Dynamics NAV 2018