- Mastering Microsoft Dynamics NAV 2016
- Rabindra Sah
- 2744字
- 2021-07-09 19:19:56
Installation scenarios
There are various ways of installing Microsoft Dynamics NAV 2016 on different platforms. We still use the conventional ways, which are optimized for a better experience. Installation of Microsoft Dynamics NAV 2016 On Premise is not in the scope of this book, as it is similar to the older version and the readers are supposed to have had that experience prior to starting this book. I have pointed out the most popular and most on-demand installation scenarios.
ClickOnce installation
ClickOnce is a component of the Microsoft .NET Framework. It helps to deploy a web application with just a link. The end user chooses a link to the Microsoft Dynamics NAV application installation. The link points to a shared file or a website. We can also deploy a mass installation if we want to carry out the process on multiple client systems.
Prerequisite list
The following is a list of prerequisites for this installation process:
- Microsoft .NET Framework
- Access to the Microsoft Dynamics NAV installation media (DVD)
High-level steps
The entire process can be understood in just a few steps, which are as follows:
- Link to the application:
- File Share
- Website
- Open the dialog box.
- ClickOnce downloads all the installation files (implicit).
- Run Windows client.
- Install shortcut.
- Check if a newer version is available.
Detailed steps
The steps mentioned in the preceding section can be understood in detail as follows:
- Install all the prerequisites as mentioned in the preceding prerequisite list.
- Install the ClickOnce Installer tools.
- Run
setup.exe
, and install the ClickOnce Installer tools. The files will be installed inC:Program Files (x86)Microsoft Dynamics NAV70ClickOnce Installer Tools
.
Or find the folder in the NAV Installation DVD in NAV.Installation.DVDClickOnceInstallerToolsProgram FilesMicrosoft Dynamics NAV90ClickOnce Installer ToolsTemplateFilesNAVClientInstallation.html
.
ClickOnce installation using File Share
You can also use File Share in order to install ClickOnce. You can follow the steps mentioned in the following section.
Prerequisite list
Following is the list of prerequisites for this installation process:
- Microsoft Windows SDK and .NET Framework
- Access to the Microsoft Dynamics NAV installation media (DVD)
High level steps
The entire process can be briefly understood in just a few steps, which are as follows:
- Install the prerequisites Microsoft Windows SDK and .NET Framework.
- Click on Installer Tools, as mentioned in the previous step:
Setup.exe
C:Program Files (x86)Microsoft Dynamics NAV70ClickOnce Installer Tools. Or NAV.Installation.DVDClickOnceInstallerToolsProgram FilesMicrosoft Dynamics NAV90ClickOnce Installer Tools
- Update the settings in
ClientUserSetting.Config
. - Copy the template files.
- Update the application, and deploy the manifest file:
fileshareclickonceDeploymentMicrosoft.Dynamics.NAV.Client.application
Detailed steps
The steps mentioned in the preceding section can be understood in detail as follows:
- Copy the ClickOnce Toolkit from
C:Program Files (x86)Microsoft Dynamics NAV70ClickOnce Installer Tools
or from your installation DVD. - Create a folder called
Fileshare
in your system, preferably in theC:/
drive. - Copy all the content from the
C:Program Files (x86)Microsoft Dynamics NAV90RoleTailored Client
folder and paste it into theFileshare
folder: - Share the folder over the network so that every user can access it and perform the installation process.
Tip
We can also use a website to host these files, for example, http://Yourdomain/ClickOnceInstallFolder
.
Upgrading the Windows client using ClickOnce
The same process can be used to upgrade, using the setup file shared over the network of Windows machines:
- Create a new folder,
ApplicationFiles
. - Update the application manifest.
- Update the deployment manifest.
- The deployment manifest's version is as shown in the following screenshot:
Note
Manifest files are XML files, which are used to control all kinds of add-ins to work on all display targets.
Now the user can install the file at their end. Since the file is shared on the network, it's easy to follow the simple setup instructions, as shown in the following screenshot:
- Accept the license terms, and install the Windows client.
And that's it! The installation process is simplified and distributed over the network. If the process implements an Internet protocol, then it's even easier to distribute the system.
Installing NAV on Azure VM using PowerShell
This is one of the most talked about topic in the Microsoft Dynamics Community. Most of the clients are looking forward to implement Azure machines as their System Server. We will try to explore how PowerShell can come in handy here.
Prerequisite list
Following is the list of prerequisites for this installation process:
- A Microsoft Azure subscription, and access to the Azure Management Portal
- Access to the Microsoft Dynamics NAV installation media (DVD)
High level steps
The entire process can be understood briefly in just few steps, which are as follows:
- Prepare the Microsoft Azure subscription.
- Prepare the provisioning computer:
- Create a SQL database
- Create a virtual machine
Detailed steps
The steps mentioned in the preceding section can be understood in detail with the following detailed steps. I have tried the Classic Portal. You can also try the new Portal; the steps will remain the same:
- First get the Microsoft Azure subscription. We can easily subscribe for the free trial, and later upgrade to the full Azure subscription as per requirement. I will not go into details on how to subscribe for Azure, as this is not in the scope of this book. Subscription is the easiest process, where you just fill in the online form of subscription and log in. After logging in, you would be directed to a page, which is similar to the following screenshot:
- Create a Microsoft Azure Storage account, which can be used for the later part of provisioning the computer.
- Prepare the prerequisite for the provisioning as follows:
Copy this folder from the Installation DVD into the cloud storage:
NAV.9.0.Installation.DVDWindowsPowerShellScriptsCloud
.Note
These files contains all the PowerShell commands which can be used for the provisioning process.
- Plan for NAV deployment.
- The first model uses a single virtual machine to be created on Microsoft Azure, which hosts all the three servers. A firewall is configured for all the different client services for the clients using unique ports:
The second model uses two virtual machines, the NAV web server and service tier, and another VM for the NAV database. This is better for a system using huge databases:
Note
From the client's perspective, both the models are same as they work in an exactly same manner on the client side.
Steps needed to prepare PowerShell commands
In these steps, I will explain how we can utilize the readymade command file, which is nothing but PowerShell Scripts prepared by Microsoft for administrative purposes:
- Run PowerShell ISE as an administrator.
- Change the
CloudHowTo
folder:Set-PartnerSetting.ps1
- Delete the #TODO (as explained in the following screenshot, highlighted in yellow):
Tip
Update the values with the name of your subscription; here, replace
MyAzureSubription
with your Azure subscription.Provide a value for the parameter as required, and save the file.
Now we can proceed with two types of deployment, deployment on single Azure VM and deployment on two Azure VMs. I will only elaborate on the first, since both deployments have similar steps.
- Get ready for deployment (a single Azure VM):
- Use
Example-1VM.ps1
using the PowerShell command present inWindowsPowerShellScriptsCloudHowTo
Example-2VM.ps1
is used to deploy the system on two VMs, whereasExample-1VM.ps1
is for a single VM
- Use
Note
Note that the cmdlets are to be run on a virtual machine, so copy the saved file onto your VM first.
The steps in this example file are explained as follows:
- Create a new virtual network if it does not already exist.
- Create a Azure VM, if it doesn't already exist, and wait until it is ready to use. Now create an SQL Server data disk.
- Upload the following files to the VM:
- The NAV DVD
- The
.bak
file that should be used when creating instances
- Install the SSL certificate that is used for HTTPS on the NAV Web Client as well as on the NAV server's OData and SOAP web services.
- Install NAV on the VM.
- Add a tenant (instance) on the VM.
- Just select the code section, press F8 or right-click on the code, and click on Run Selection under Options.
Note
Since all the cmdlets are already present in the file, CM on two machines also can be done similarly. The best part of the example file is that it is well documented and clear to read.
Deploying Microsoft Dynamics NAV 2016 database on Azure SQL database
Microsoft Dynamics NAV on Azure VM is more like an on-premise installation. Here we can create a SQL Server for hosting the NAV Database.
Prerequisite list
Following is a list of prerequisites for this deployment process:
- A Microsoft Azure subscription and access to the Azure Management Portal.
- Microsoft Dynamics NAV database is installed on an SQL Server Database Engine instance. SQL Server Manager is also installed on the same computer.
- Access to the Microsoft Dynamics NAV installation media (DVD).
To deploy a Microsoft Dynamics NAV database to an Azure SQL Database, the database must be exported as a data-tier application (DAC) file, which is known as a .bacpac
file. This can be done using SQL Server Manager.
Creating a database in Azure
Creating a new database in the Microsoft Azure online portal includes some easy steps, which are explained as follows:
- Click on the database link form on the left side of the page, fill in the information, and select an appropriate size of the SQL database:
Note
We can manage Windows Azure at the following link: https://manage.windowsazure.com/.
- After you have entered the required values and created the database, you will be presented with a page displaying a list of SQL databases. In the following screenshot, you can see that both the databases are created under the same server:
- Click on the server, and then go to the CONFIGURE tab. Click on the ADD TO THE ALLOWED IP ADDRESSES arrow, and save the changes. Now only the IP is published on the Web, and we can access the database from any supporting management studio:
Let's test the connection from our local Microsoft SQL Management Studio. Before we start the connection, let's note down the information that will be needed for the connection. Go to the DASHBOARD tab of the server (similar to the CONFIGURE tab in the last step), and note down the administrator login information; this is the user name. From the dashboard of the database, note down the server name. In this case, the server name is j498jdtrqf.database.windows.net. Now let's use this information for the connection of the database engine. Use the password that we used while creating the database:
After successful connection, you can see the Azure SQL database on your SQL Management Studio Object Explorer. Now we can treat this database as any local database. But if we want to add any database to this server, then we will have to follow the steps which will satisfy certain criteria set by Azure Server.
Now, let's see how to replicate a database to the Azure SQL database:
- Right-click on the database you want to replicate.
- Select the Tasks option.
- Now select Deploy Database to SQL Azure...:
This will deploy a local database to SQL Azure and a connection is established between the local DB and the SQL Azure Database Server:
Now you just need to click the Next button, and you will be presented with the Deployment Settings page, which is an important one, because here you will have to connect to the Azure SQL database with your credentials, as shown in the following screenshot:
It takes a while depending on the size of the database.
After the process is sucessfully completed, we can see the same database in the SQL Azure database, as can be seen in the next screenshot.
Here, we have successfully connected an Azure SQL database using our SQL Server Management Studio, which is a local entity. You can see a database named Demo Database NAV (9-0) inside the database server, j498jdtrqqf.database.windows.net(SQL Server 13.0.81 - rabins):
In case of an error, try to find the error, resolve it, and repeat the same process.
Creating a virtual machine
We will now create a virtual machine which will be used to host the Microsoft Dynamics NAV system. Follow the following steps:
- From the VIRTUAL MACHINE icon, Create a new virtual machine from the FROM GALLERY option.
- There are two options, QUICK CREATE and FROM GALLERY; use FROM GALLERY if you want to create a VM with the inbuilt Microsoft Dynamics NAV:
- Select the appropriate Microsoft Dynamics NAV option from the list.
- Select Microsoft Dynamics NAV 2016 for this example, as shown in the next screenshot:
Generate the credentials for the login, and note down the password and user name, as this will be needed while connecting to this VM:
- In the third step, we can change the port numbers if we want to. Also, we have to define the name of the Cloud Service DNS. Choose the best one that is available, as shown in the following screenshot:
Just follow the steps and finish the process of creation of virtual machine with Microsoft Dynamics NAV installed in it.
- In the following screenshot, I have created two virtual machines: one for testing purpose, which is just a plain VM without Microsoft Dynamics NAV, and one for using the gallery. We will be restricted as per the permission granted per subscription:
- Now let the Azure System provision our virtual machine. These are straight-forward steps and should not be confusing.
- After the virtual machine is running, click on the Connect option on the bottom tab, and it will get downloaded with an RDP, which can be used to log in to the virtual machine just like any remote server:
It is very fast and reliable.
- Use the log-in credentials we used while creating the virtual machine:
And that's it. We have a brand new virtual machine up and running. Explore the properties and Firewall settings to ensure everything is perfect:
- Go to the Apps section, and verify the presence of Microsoft Dynamics NAV, as shown in the following screenshot:
The NAV System should run its local database quite easily, since it is internally configured by the Azure Server while creating a virtual machine.
- Let's connect the SQL Azure database which we created by replicating our local database, as explained in the following screenshot:
- Use the credentials as shown earlier, and we should be good to go with the connection.
Now we can configure the instance setting in the Microsoft Dynamics NAV Administration tool, as shown in this screenshot:
We can easily connect to the Role Tailored Client after the services are restarted.
Installing NAV on a multitenant environment
Here we will discuss the Installation process of Microsoft Dynamics NAV 2016 on a multitenant environment.
Prerequisite list
Following is the list of prerequisites for this installation process:
- The Microsoft Dynamics NAV database is installed on an SQL Server Database Engine instance. SQL Server Manager is also installed on the same computer.
- Access to the Microsoft Dynamics NAV installation media (DVD).
High-level steps
The entire process can be understood in just a few steps, which are as follows:
- Prepare PowerShell for the operation.
- Export the application database.
- Remove the application database from the initial database.
- Split the business data for each company.
- Mount the application and business databases.
Detailed steps
We are first going to separate the application data from the business data.
The following are the steps for separating the application data:
- Stop all Microsoft Dynamics NAV Server services.
- Open the Microsoft Dynamics NAV Administration shell.
- Then use the PowerShell cmdlets as follows:
Export-NAVApplication
Remove-NAVApplication
#cmdlet for removing Application Remove-NAVApplication -DatabaseServer <Server name> -DatabaseInstance <Instance name> -DatabaseName <name of the original DATABASE> #cmdlet for mounting Tenants Mount-NAVTenant -DatabaseName <NAVDatabase> -Id <TenantID> -ServerInstance <NAVServerInstance> -OverwriteTenantIdInDatabase ----------
It is quite easy to get going with the PowerShell commands by just working around the codes.
For example, we can just write these commands and compile them as follows:
Set-ExecutionPolicy RemoteSigned -Force Import-Module 'C:BackUpProgramFilesNAV.9.0.44974.NA.DVDWindowsPowerShellScriptsMultitenancyHowTo-MoveCompanyToTenant.ps1'
This will give you access to all the functions of the PowerShell file:
It is again the PowerShell cmdlet that makes like easier; just locate the folder WindowsPowerShellScripts/Multitenancy
in your installation DVD, and you are just one step away from all the possible stuff you need in the multitenancy world.
Just import the file in Windows PowerShell ISE (run as administrator), and execute it to get the result as follows:
Tip
Some tips if you want to try your own customized code. Activate Intellisense, and import the PowerShell file you want to work with. Run the line, and you are good to go. You can now use all the functionalities of that file. It is the same like C# coding.