Mastering Microsoft Dynamics NAV 2016
上QQ阅读APP看书,第一时间看更新

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:

  1. Link to the application:
    • File Share
    • Website
  2. Open the dialog box.
  3. ClickOnce downloads all the installation files (implicit).
  4. Run Windows client.
  5. Install shortcut.
  6. Check if a newer version is available.
Detailed steps

The steps mentioned in the preceding section can be understood in detail as follows:

  1. Install all the prerequisites as mentioned in the preceding prerequisite list.
  2. Install the ClickOnce Installer tools.
  3. Run setup.exe, and install the ClickOnce Installer tools. The files will be installed in C: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:

  1. Install the prerequisites Microsoft Windows SDK and .NET Framework.
  2. 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
  3. Update the settings in ClientUserSetting.Config.
  4. Copy the template files.
  5. 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:

  1. Copy the ClickOnce Toolkit from C:Program Files (x86)Microsoft Dynamics NAV70ClickOnce Installer Tools or from your installation DVD.
  2. Create a folder called Fileshare in your system, preferably in the C:/ drive.
  3. Copy all the content from the C:Program Files (x86)Microsoft Dynamics NAV90RoleTailored Client folder and paste it into the Fileshare folder:

    Detailed steps

  4. 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:

  1. Create a new folder, ApplicationFiles.
  2. Update the application manifest.
  3. Update the deployment manifest.
  4. The deployment manifest's version is as shown in the following screenshot:

    Upgrading the Windows client using ClickOnce

    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:

    Upgrading the Windows client using ClickOnce

  5. 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:

  1. Prepare the Microsoft Azure subscription.
  2. 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:

  1. 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:

    Detailed steps

  2. Create a Microsoft Azure Storage account, which can be used for the later part of provisioning the computer.
  3. 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.

  4. Plan for NAV deployment.
  5. 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:

    Detailed steps

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:

Detailed steps

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:

  1. Run PowerShell ISE as an administrator.
  2. Change the CloudHowTo folder:
    • Set-PartnerSetting.ps1
  3. Delete the #TODO (as explained in the following screenshot, highlighted in yellow):

    Steps needed to prepare PowerShell commands

    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.

  4. Get ready for deployment (a single Azure VM):
    • Use Example-1VM.ps1 using the PowerShell command present in WindowsPowerShellScriptsCloudHowTo
    • Example-2VM.ps1 is used to deploy the system on two VMs, whereas Example-1VM.ps1 is for a single VM

Steps needed to prepare PowerShell commands

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:

  1. Create a new virtual network if it does not already exist.
  2. 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.
  3. Upload the following files to the VM:
    • The NAV DVD
    • The .bak file that should be used when creating instances
  4. 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.
  5. Install NAV on the VM.
  6. Add a tenant (instance) on the VM.
  7. 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:

  1. 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:

    Creating a database in Azure

    Note

    We can manage Windows Azure at the following link: https://manage.windowsazure.com/.

  2. 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:

    Creating a database in Azure

  3. 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:

Creating a database in Azure

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:

Creating a database in Azure

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:

  1. Right-click on the database you want to replicate.
  2. Select the Tasks option.
  3. Now select  Deploy Database to SQL Azure...:

Creating a database in 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:

Creating a database in Azure

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:

Creating a database in Azure

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):

Creating a database in Azure

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:

  1. From the VIRTUAL MACHINE icon, Create a new virtual machine from the FROM GALLERY option.
  2. 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:

    Creating a virtual machine

  3. Select the appropriate Microsoft Dynamics NAV option from the list.
  4. Select Microsoft Dynamics NAV 2016 for this example, as shown in the next screenshot:

    Creating a virtual machine

    Generate the credentials for the login, and note down the password and user name, as this will be needed while connecting to this VM:

    Creating a virtual machine

  5. 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:

    Creating a virtual machine

    Just follow the steps and finish the process of creation of virtual machine with Microsoft Dynamics NAV installed in it.

  6. 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:

    Creating a virtual machine

  7. Now let the Azure System provision our virtual machine. These are straight-forward steps and should not be confusing.
  8. 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:

    Creating a virtual machine

    It is very fast and reliable.

  9. Use the log-in credentials we used while creating the virtual machine:

    Creating a 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:

    Creating a virtual machine

  10. Go to the Apps section, and verify the presence of Microsoft Dynamics NAV, as shown in the following screenshot:

    Creating a virtual machine

    The NAV System should run its local database quite easily, since it is internally configured by the Azure Server while creating a virtual machine.

  11. Let's connect the SQL Azure database which we created by replicating our local database, as explained in the following screenshot:

    Creating a virtual machine

  12. 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:

Creating a virtual machine

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:

  1. Prepare PowerShell for the operation.
  2. Export the application database.
  3. Remove the application database from the initial database.
  4. Split the business data for each company.
  5. 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:

  1. Stop all Microsoft Dynamics NAV Server services.
  2. Open the Microsoft Dynamics NAV Administration shell.
  3. 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:

Detailed steps

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:

Detailed steps

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.

Detailed steps