Home Business & Other Mastering Microsoft Dynamics NAV 2016

Mastering Microsoft Dynamics NAV 2016

By Rabindra Sah
books-svg-icon Book
eBook $47.99 $32.99
Print $60.99
Subscription $15.99 $10 p/m for three months
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
eBook $47.99 $32.99
Print $60.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Microsoft Dynamics NAV Installation
About this book
The book begins by giving you a brief introduction to setting up your NAV environment and shows you how to install and configure it according to your requirements. You will then dive deep into the latest design patterns, network architecture, and topologies. We will show you how you can integrate NAV with the Microsoft platform, and secure your deployment by managing roles and permissions. Moving on, we will explain how to monitor and manage server instances using the Administration tool. We’ll discuss how you can take advantage of the expanded extensibility and connectivity capabilities for a tighter integration with the cloud as well as handheld devices. Then, we’ll show you how you can make use of the PowerBI capabilities that have been built into Dynamics NAV. By the end of the book, you will be confident in developing and administering a Dynamics NAV implementation that will leverage all of the new features.
Publication date:
March 2017
Publisher
Packt
Pages
450
ISBN
9781786464309

 

Chapter 1. Microsoft Dynamics NAV Installation

Have you ever had the chance to spend a night at a sea-side cottage, where you can appreciate the vast endlessness of nature from a window? It captivates our imaginations and instills a desire to understand the vastness of this creation.

Let's change the perspective and visualize the same sea from a height (let's say, from a space station), and you can see all its boundaries, its size, and its color and understand its significance. Similarly, if you want to understand a software, then you have to see it within a broader context. It allows us to intake the most out of it in an optimum way.

Now, returning to the ground, instead of the sea-side, here we will discuss C/SIDE, and instead of an ocean, we will discuss the vastness of Microsoft Dynamics NAV 2016.

Here, in this chapter, we will learn about the different new technologies that have been implemented in the installation process of Microsoft Dynamics NAV 2016. The chapter will also guide you through the step-wise installation process with detailed diagrams and screenshots.

The chapter intends to clear the confusion about PowerShell, which is an essential component of the Administration section in the Microsoft Dynamics NAV world. Microsoft has made PowerShell compulsory in some sections. The chapter requires a basic-to-medium level knowledge of the installation process. We will not include the basic installation steps so as to save time and space, and will focus more on the current hot topics in the field of NAV Installation.

At the end of this chapter, we will explain the different terminologies and techniques used by expert NAV Administrators. This chapter is intended for those whose systems are on-premise, and who are looking to better manage it on-premise, or are planning to opt for cloud technologies.

In this chapter, will cover the following points:

  • Architecture of the different models that are used while installing the system

  • Details on the cloud technology and how it is useful

  • Differences between installation environments

  • Walkthrough of installation and deployment scenarios on different platforms

  • Details on PowerShell and its usage

 

The background- before we start


Microsoft Dynamics NAV 2016 is a Microsoft Product, which delivers a complete ERP Business solution for small- and medium-sized organizations. You might want to know why this software package is not suitable for large industries; let's investigate this.

First, let's understand the difference between a large customer (Enterprise-level industry) and a smaller customer (Small and Medium business) from the ERP perspective. The ERP software sees a customer as a large enterprise if the number of employees is over 5,000. A company with lesser number of employees but a greater turnover can also be taken as an Enterprise-level customer. Another key factor in determining the size of a company is the size of data, whether it is high or low.

There are cases where Microsoft Dynamics NAV has been implemented in companies with 500, 1000, and even a couple of thousand users. But the main idea behind choosing the right ERP Software depends on many factors such as the following:

  • Functionality

  • Performance

  • Interface and integration

  • Out-of-the-box features

  • Future customization requirement

  • Cost

  • Maintenance

As a consultant, our duty is to determine the best solution, and convince the customer on that. We must make sure that the system covers all the functionalities, or most of it. The performance should be within the acceptance limit. Their system should be equipped with sufficient interfacing API and services so as to integrate the updates and third-party integration, as the customer might like to integrate some in the future. It should provide out-of-the box customization features so that the client does not have to rely heavily on the developers for small changes. This, in turn, can be one of the most decisive factors, as modern users want some level of control with themselves. The system should guarantee easy and cost-effective customization if requested by the user. It should not be rigid. The cost of the system should be within an acceptable range, since clients have a budget for the product implementation. Last but not least is the maintenance cost; if the cost of maintaining the software is too high, then it is less likely that the customer is going to choose the product. Most of the customers also want to know the maintenance time requirement of the system.

Here we can conclude that there is a very thin line when we want to select the right product, since some of the products have a stronghold in some of the aforementioned points, while others have advantages regarding other points. We should spend an ample amount of time determining the right product for our client. Thankfully, Microsoft Dynamics NAV fulfills most of the criteria mentioned here, and so, it is the leader in the Dynamics family when it comes to the number of satisfied customers and number of implementations.

 

Architectural components


Microsoft Dynamics NAV can be installed on-premise, as well as on cloud. It is the most flexible and robust product of the Microsoft Dynamics family. Microsoft Developers have worked a lot on installation and configuration, which allows the product to have multidimensional installation options. It can be easily deployed to a multitenant environment. It supports PowerShell, which is like a magician, and provides added power when it comes to administering and installing the system. Installation of Microsoft Dynamics NAV 2016 on Azure is one of the key points to look for. We will be more focused around these points in this book.

I have tried to show the easiest and most efficient ways to accomplish the installation process in this chapter. There might be other ways, but I have tried to stick with the simplest one.

We should always install three core components of Microsoft Dynamics NAV 2016, which are the three tiers that comprise the core of NAV Architecture.

Three-tiered architecture

Like previous RTC versions, the Microsoft Dynamics NAV 2016 architecture is a three-tiered architecture, which uses three core components as follows:

Tier 1

Tier 2

Tier 3

Client Tier

Middle Tier

Data Tier

RTC (Windows Client/ Web client, web-service clients (SOAP Web Services and OData Web Services), and an NAS services client for programmatic access)

Microsoft Dynamics NAV Server

SQL Database Server (Application Database, Tenant Database)

Client User Interface

For example: Frontend Application-RTC

Multitenant server, which manages business logic and all kinds of communication.

For example: Multitenant Server-Development Environment

Database Server of Data layer

For example: SQL Database server-Database

Here in the following diagram, you can clearly understand the different tiers in the Microsoft Dynamics system:

NAV Application Server

NAV Application Server, or NAS, is a middle-tier server component, which can be utilized without a user interface for task scheduling, client offloading, and specialized integration scenarios. Since, it executes business logic without any user interaction, they are managed completely from the Microsoft Dynamics NAV server administration tools in the NAS Services tab:

It is always better to create a Microsoft Dynamics NAV server instance for each NAS services application. The following are the two main reasons:

  • Convenience

  • Performance

Whenever you use NAS services for Microsoft Office Outlook integration, managing job queues, create a separate Microsoft Dynamics NAV server instance for each NAS service application, then modifying the setting for one of these services will not affect other services. On the other hand, configuring NAS services applications to use separate server instances makes better use of the server resources. This lets you run more applications with less degradation.

Multiple configurations

We can implement multiple configurations for the three-tier architecture in Microsoft Dynamics NAV.

The core components that comprises the tiers must be installed. We can choose a single machine for all the three tiers, or a separate machine for each tier.

Multitenant environment

There are various architectures that can be implemented for the Microsoft Dynamics NAV installation process. It all depends on the requirements. If there is a need of a single database system for a single group of users, then multi-tenancy has not much significance. But when we are trying to implement Dynamics NAV as a SaaS, keeping the system constant for multiple clients, then the significance of multi-tenancy comes into play.

Note

Multi-tenancy is a software architecture where a single instance of the software runs on a server and supports multiple customers or tenants.

In a multi-Tenant environment, we keep the business data of each tenant (client) in different databases while keeping all the SQL Server application objects in a different database.

Because of the level of separation between the three layers, now we can use the same shared NAV objects with more databases.

Each tenant can hold one or more companies, as depicted in the following diagram:

Azure (cloud service)

Microsoft Azure is an infrastructure and cloud-computing platform, which helps us solve problems such as building, deploying, and managing different applications. They are implemented by huge datacenters managed by Microsoft Corporation. It initially started with the IaaS service, but later also started providing PaaS.

Differences between on-premise and cloud

This quick public cloud adoption can be explained by several factors such as the following:

  • Minimal up-front investments or commitments are required

  • You pay for what you use

  • Users can test any of the services prior to purchase

  • Less human resources are required for infrastructure maintenance

  • Service offerings are easy to compare

  • Software upgrades can be automated

The latest member of the Dynamics Family, Dynamics 365, is not hosted on Azure, since Azure does not provide SaaS.

The difference between on-premise and the different cloud services can be better understood by the following diagram. As you can see, in on-premise setup you have different levels of control whereas in the cloud services the controls and access are limited:

Microsoft Azure - relevant services

There are a number of relevant services that play an important role during the deployment process. They are as follows:

  • Virtual machines (Dynamics NAV SQL Server)

    Virtual machines services are similar to the on-premise environment and the installation is also pretty much the same.

  • Cloud services (Ports load balancer scale fail over)

    A cloud service has one public IP-address. It is located in a region or affinity group. It is possible to link to the owned domain. It can contain multiple VMs with local IP addresses.

    All the VMs can be accessed via endpoints on the cloud service. Endpoints can be loaded-balanced or port-forwarding.

  • Storage (Hard disks backups)

    Storage in Azure contains hard disk space where we can put backup, PowerShell commands, and other files.

  • Network VPN (VM network)

    Network VPN helps extend the private network space in the public domain where you can define other virtual machines, or VM. Each VM has a unique IP address in the same subnet so that they can see each other and communicate as per the command.

  • Active Directory (User directory synchronized from AD Office 365 users)

    Azure Active Directory provides identity and access monument. It can be integrated with the on-premise Active Directory. It can also be used to Integrate with Dynamics NAV.

Microsoft Azure Management Portal

Use the link, https://manage.windowsazure.com/, in order to access the management portal of Windows Azure. It manages all Azure Services. Also, PowerShell is available for more options (this topic is covered in detail in a later part of this chapter).

Note

To access the link https://manage.windowsazure.com/, make sure you have a subscription for Windows Azure.

Three-service model

Cloud computing offers its services in three different models: Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS). These models offer increasing abstraction. The following diagram shows how services provided using the same channel have been categorized so as to keep it easy to understand:

Infrastructure as a Service

Infrastructure as a Service helps companies to move their physical infrastructure to the cloud with a level of control similar to what they would have in a traditional on-premise data center. Core data center infrastructure components are storage, servers (computing units), the network itself, and management tools for infrastructure maintenance and monitoring. These are depicted in the following diagram:

Infrastructure as a Service taxonomy

Note

IaaS includes virtual machines, servers, storage, network gear, and any other hardware/OS.

Platform as a Service

Platform as a Service provides the user with a configurable application platform including a preinstalled software stack. PaaS can be understood as another abstraction layer above the hardware, OS, and virtualization stack:

Platform as a Service taxonomy

Software as a Service

PaaS provides execution runtimes service without direct access to the OS (databases, development platforms, and application servers).

Software as a Service is a cloud services delivery model, which offers an on-demand online software subscription.

The latest SaaS release of Microsoft is Dynamics 365 (previously known as Project Madeira). The following diagram illustrates the SaaS taxonomy. Here you can clearly understand different services such as Sales force, NetSuite, and QuickBooks which are distributed as SaaS:

Software as a Service taxonomy

Note

SaaS includes software services such as Microsoft Office 365, Microsoft Dynamics 365, and so on.

Difference between on-premise, SaaS, PaaS, and IaaS services

In an on-premise architecture, one needs to take care of all the services and layers of the software system starting from the network layer up to the application layer (client). Here, the cost of maintenance is high, and it is a redundant service.

In IaaS, Microsoft provides a virtual abstraction of the operating system, which can be used as any on-premise operating system, and hence it lowers the cost of maintaining low-level systems.

In PaaS, a specific platform is exposed to the user so as to make the service even more precise and the user is concerned only up to the platform he/she is using; all the layers below it are managed by Microsoft.

SaaS is the latest of all services, where specific software can be isolated from all those complex layers. The user just needs to worry about the software layer, and everything beyond that is handled by the cloud factory. It is the easiest and most efficient model in cloud technology.

Introduction to the NAV Universal application

Nav Universal is an application designed for phones and tablets to run Microsoft Dynamics NAV. It is the client-side part, which offers portability and flexibility of usage. It is basically targeted at small- and medium-sized businesses which want to access data from a hand-held device, on the go.

In general day-to-day use, these apps are used for functions such as the following:

  • Approving invoices

  • Getting an overview of business

  • Viewing the progress report

  • Lightweight data entry

  • Checking the status of documents

The following diagram illustrates the architecture of the NAV Universal application in details:

The Microsoft Dynamics NAV Tablet client and Microsoft Dynamics NAV Phone client support the same credential types as the Microsoft Dynamics NAV Windows client and Microsoft Dynamics NAV Web client.

Out-of-the-box tools in the Installation DVD

We do not always need to search for treasure in the ocean, sometimes we can find it in our backyard pond as well. The Microsoft Dynamics NAV Installation DVD is no less than a treasure for an NAV professional. It includes almost all of the installation tools, upgrade tools, PowerShell scripts, Test tools, and much more. Most of the times, this resource remains unnoticed, which is why I would like to go into detail for some of these important tools:

Folder with numbers such as 1029-4105

There are almost 15 folders in this category. These are folders that contain agreement terms in different languages. They also contain the developers' help file, which is an extremely valuable asset for NAV Developers and consultants. Let us understand its components in brief.

License.rtf

This license agreement (Agreement) is an agreement between Microsoft corporation (or one of its affiliates based on where you are) and the user of the system. The main intention of this multilingual license agreement is to inform all non-English speaking users about the terms and conditions in their local language.

setupres.dll

These files are the dynamic-link library (DLL) files, which represent implementations for the shared library concept in the Microsoft world, and are generally used by the operating system and various other programs.

devitpro.chm

Microsoft has compiled a documentation file, which contains the Help section in the .chm format; which consists of a collection of navigational HTML pages. The files are compressed and deployed in a binary format for the compiled HTML. This is a very important file for consultants and developers as well as for administrators and implementers. The contents of this file are considered as treasure for most developers, since this contains all the syntax of all the functions that can be used in the C/AL code. It also gives a detailed walkthrough for system deployment. In addition, this file contains the business logic flow, which can be extremely valuable for consultants.

ADCS

ADCS stands for Automated Data Capture System. The pattern implemented by ADCS helps Microsoft Dynamics NAV to communicate with different handheld devices through web services.

For example, if we want to test any handheld device that transmits a radio frequency, then we can use a radio receiver to capture those radio frequencies, and then a VT100 plug-in can be used to test that connection. The plugin helps Microsoft Dynamics NAV to receive the data transmitted from the device. The data is fetched in the form of an XML file, and can be used for further processing.

ClickOnce Installer tools

This folder contains the tools used for the ClickOnce installation process. The details of the ClickOnce process is explained in a later part of this chapter.

CRM customization

This folder contains a zip folder called DynamicsNAVIntegrationSolution.ZIP, which contains customization settings, content type, solution code, and other web-related resource files. It also contains a JavaScript file, which contains functions such as ConnectToNavClient, which is used by the NAV system to connect to the CRM and vice versa. It can be used by developers to make changes in the connection.

Outlook

It contains the .msi file, which can be used to install the outlook add-ins. This is a useful tool if you, by any chance, miss the installation of Outlook components during the Dynamics NAV installation process. It can also be used if the outlook component is corrupted.

Prerequisite components

This is a very important folder, which should be properly understood before we start the installation process. It gives the details of all the prerequisite components that are required for the installation process. It is extremely important that one must fulfil all the prerequisites in order to guarantee a successful installation process:

Role Tailored Client

This folder contains the configuration file for Role Tailored Client (RTC). It also contains all other essential component files that help RTC to connect to the middle tier. This folder is required in the later part of this chapter, in the ClickOnce installation in particular.

SQL Demo database

This is another very important folder, which contains the license file along with the precious SQL Demo database backup file. In most of the cases when we accidentally corrupt our demo database, we can easily restore this .bak file. This comes in very handy if we want to play with the database and objects.

Test toolkit

I personally believe this part to be the best part of Dynamics NAV 2016. It contains tools that can be used to test our customizations against regression issues. Most of us do not even know about this part, and I would like to go into detail over this in Chapter 4, Testing and Debugging. Some experts also call it the last missing piece to complete the big puzzle called Road to Repeatability.

Upgrade toolkit

This folder contains the tools that are key to the upgrade process. We will go into detail on the Upgrade toolkit in Chapter 9, Upgrade and Migration.

Windows PowerShell Scripts

This folder contains most of the PowerShell Scripts, which can be used for various PowerShell operations related to multi-tenancy, database, company data, Azure installation, and many others. In fact, most of the manual operations can be customized using PowerShell Scripts, which is available in this folder. Since this is an extremely useful topic, I have explained it in detail in the Installation scenarios section of this chapter.

Microsoft SQL Server requirements for Microsoft Dynamics NAV

The following are the Microsoft SQL Server requirements for Microsoft Dynamics NAV:

  • Microsoft SQL Server 2014

    • Express, Standard, or Enterprise 

  • Microsoft SQL Server 2012 Service Pack 2

    • Express, Standard, or Enterprise (64 bit only)

  • Azure SQL Database V12

    • Standard and Premium service tiers.

The components needed while installing SQL Server are as follows:

  • Database Engineer Services

  • Client Tools Connectivity

  • Management Tools-complete

Note

This can be useful when we select every component while installing. It's always a good idea to know what are the requirements in particular to save time and memory. In this book, we will not cover basic installation of SQL Server assuming it to be the basic process that is similar to all the other older versions such as Microsoft Dynamics NAV 2013 and 2015.

Data encryption between MS SQL Server and Microsoft Dynamics NAV 2016

It is recommended to use Internet Protocol security (IPsec) for data encryption to maintain a secure channel between NAV and SQL System. IPSec uses cryptographic security services. For a better understanding of the concept, refer to the following diagram:

Using Azure SQL Database

In Microsoft Dynamics NAV, we can also use the Azure SQL database, which is a cloud service. It provides data storage, and the best part is that it is inbuilt in the Azure services platform.

We can directly connect the Microsoft Dynamics NAV Server instance to Azure VM.

Note

For better performance, VM and the SQL database must be in the same Azure region, and NAV Development Environment must be on the same VM in Azure as in the Microsoft Dynamics NAV Server.

 

Microsoft Dynamics NAV PowerShell


PowerShell is a very strong tool. It's useful in managing Microsoft dynamics NAV over Azure and Dynamics 365. It is also very useful for some out-of-the box installations such as Multitenant configuration. Moreover, it helps in carrying out major processes with just a few lines of code, and is often very fast. It fortifies our skills in administering Microsoft Dynamics NAV.

Dynamics NAV tools

The following are the tools that we use for development, administration, and object management purposes. As you can see, PowerShell can be used in all the areas, and so, this is the time when we should take PowerShell more seriously. Let's dive deep into PowerShell:

Development

Administration

Object Management/ Source control

C/Side

Administration Console (MMC)

Team Foundation Server (TFS)

Visual Studio

Add Ins

Extensibility

Report Design

Role Tailored Client(RTC)

iFactor ReVision

Word

Report Design

OMA

SQL Report Builder

Merge tool

PowerShell

PowerShell

PowerShell

Where in NAV are we with PowerShell?

With PowerShell, we are on the tooling side of NAV. For example, we have the report design (Visual Studio-SQL Report builder) tool and the MS Dynamics NAV Administrator tools.

Using PowerShell

Most of the Microsoft products are either already using or will be using PowerShell, and in the context of NAV, it is a growing trend to use PowerShell to make life easier for Administrators and Developers. In spite of that, we cannot do everything using a GUI, and so, Microsoft has provided backdoor processes using PowerShell command lines.

Getting started with PowerShell

The PowerShell works on objects so it is extremely useful. It can be useful while working with .NET Framework as well.

PowerShell ISE (Integrated Scripting Environment) can be taken as the development environment of PowerShell; it helps PowerShell look developer-friendly. It allows multiline editing, selective execution, context-sensitive help, debugging, command-exploration, snippets, and many more advanced functionalities, which makes it more than just a command shell.

Let's start with an example.

Let us assume that PowerShell is installed onto our system along with Microsoft Dynamics NAV.

There are three options [on right-click] to open it as one of the different authorities, as shown in the following screenshot:

Generally, when we are coding, we might like to use the Windows PowerShell ISE option. This is because, if we create some file in the administrator mode, and if we want to edit the file later, we would have to open it with the administrator authority.

We will take an example of the Windows PowerShell ISE, which is the most common environment, just to make things simple:

For administrative operations, we use the administrative mode. The following window does not have one:

Dynamics NAV PowerShell has the following two modulus/snap-ins in particular:

  • Microsoft.Dynamics.NAV.Management: import-module "${env:ProgramFiles}Microsoft Dynamics NAV90ServiceNAVAdminTool.ps1"

Note

This script is used to manage the service; it is a part of the Server management tool.

  • Microsoft.Dynamics.NAV.Model.Tools: import-module "${env:ProgramFiles(x86)}Microsoft DynamicsNAV90RoleTailoredClientMicrosoft.Dynamics.NAV.Model.Tools.psd1"

Note

This tool can be used to work with the text object of NAV objects such as merging objects, comparing, creating Delta, creating objects, joining it, working with languages, and many more.

So, in general, we can take these snap-ins as the tools to hook NAV with PowerShell.

Patterns of scripting

It is essential for you to understand how different cmdlets function in order to harvest their full potential. Here in this section we are going to understand how cmdlets are written and we will also be examining some of the most useful cmdlets.

Understanding the PowerShell cmdlets

We can categorize the PowerShell commands into five major categories of use:

  • Commands for server administrators

  • Command for implementers for company management

  • Commands for administrators for upgrades

  • Commands for administrator for security

  • Commands for developers

Commands for server administrators

The first category contains commands that can be used for administrative operations such as create, save, remove, get, import, export, set, and the so on as given in the following table:

Dismount-NAVTenant

New-NAVServerConfiguration

Export-NAVApplication

New-NAVServerInstance

Get-NAVApplication

New-NAVWebServerInstance

Get-NAVServerConfiguration

Remove-NAVApplication

Get-NAVServerInstance

Remove-NAVServerInstance

Get-NAVServerSession

Remove-NAVServerSession

Get-NAVTenant

Save-NAVTenantConfiguration

Get-NAVWebServerInstance

Set-NAVServerConfiguration

Export-NAVServerLicenseInformation

Set-NAVServerInstance

Import-NAVServerLicense

Set-NAVWebServerInstanceConfiguration

Mount-NAVApplication

Sync-NAVTenant

Mount-NAVTenant

Note

We can set up web server instances, change configurations, and create a multitenant environment; we can only use PowerShell for a multitenant environment.

Commands for implementers for company management

The second category of commands can be used by implementers, in particular, for operations related to installation and configuration of the system. The following are a few examples of this category of commands:

Copy-NAVCompany

Get-NAVCompany

New-NAVCompany

Remove-NAVCompany

Rename-NAVCompany

Commands for administrators for upgrades

The third category is a special category for administrators, which is related to upgradation of operations.

Get-NAVDataUpgrade

Resume-NAVDataUpgrade

Start-NAVDataUpgrade

Stop-NAVDataUpgrade

Note

The third category of commands can be useful along with the upgrade toolkit.

Commands for administrator for security

This is one of the most important categories, which is related to the backend of the system. The commands in this category grant the power of accessibility and permission to the administrators. I strongly recommend these make-life-easy commands if you are working on security operations. Commands in this category include the following:

Get-NAVServerUser

Remove-NAVServerPermission

Get-NAVServerUserPermissionSet

Remove-NAVServerPermissionSet

New-NAVServerPermission

Remove-NAVServerUser

New-NAVServerPermissionSet

Remove-NAVServerUserPermissionSet

New-NAVServerUser

Set-NAVServerPermission

New-NAVServerUserPermissionSet

Set-NAVServerPermissionSet

Set-NAVServerUser

Note

These commands can be used basically to add users, and for permission set.

Commands for developers

The last, but not the least, treasure of commands is dedicated to developers, and is one of my most-used commands. It covers a wide range of commands, and should be included in your daily work. This set of commands includes the following:

Get-NAVWebService

Join-NAVApplicationObjectFile

Invoke-NAVCodeunit

Join-NAVApplicationObjectLanguageFile

New-NAVWebService

Merge-NAVApplicationObject

Remove-NAVWebService

Remove-NAVApplicationObjectLanguage

Compare-NAVApplicationObject

Set-NAVApplicationObjectProperty

Export-NAVAppliactionObjectLanguage

Split-NAVApplicationApplicationObjectFile

Get-NAVApplicationObjectProperty

Split-NAVApplicationObjectLanguageFile

Import-NAVApplicationObjectLanguage

Test-NAVApplicationObjectLanguage

Update-NAVApplicationObject

Note

This preceding category of commands can be used to manage web services, invoke codeunits, work with object files, and work with languages.

Practice with PowerShell

Here, in this section, I will break down the basic syntax of PowerShell Script, and explain how it functions:

Syntax: get-service -name "*net*" 

The preceding syntax can be broken down into four essential parts. The first part, that is, GET, is a function, which is generally used as a verb that signifies the main action of the code. The second part is generally a noun, which defines the operation. Part one and part two combine to form a command, leaving part three and four to be the name and argument, which combine to form a parameter. This is better explained as follows:

Verb

Noun

Name

Argument

Get

Service

Name

Net

Command

Parameter

I have drawn the following simple figure just to explain the process for a better understanding of the PowerShell Script. Every PowerShell Script can be understood by this method, and it's even easy to memorize and manipulate it if you can understand the structure of the scripts:

 

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:

  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:

    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:

  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:

  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:

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:

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

    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

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:

    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:

  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:

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:

  1. Right-click on the database you want to replicate.

  2. Select the Tasks option.

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

  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:

  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:

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

  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:

    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:

  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:

    It is very fast and reliable.

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

  10. 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.

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

  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:

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:

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.

 

Post-installation operations


After the successful installation of Microsoft Dynamics NAV 2016, the administrator has access to the Microsoft dynamics NAV database. The database can be either on Cloud or On-premise. It can either be single tenant (traditional) or multitenant. The administrator can easily grant permission to other users using PowerShell commands, or he/she can manually  grant the database owner role in the database in SQL Server Management Studio.

 

Summary


In this chapter, you learnt about the installation process of Microsoft Dynamics NAV 2016 in detail. We mostly covered the cloud platform. You also learnt ways to deploy the system on a multitenant environment. We explained how PowerShell can be better utilized to make life easier. Try to spend some time with PowerShell, and you will understand why Microsoft is trying to force most of the processes to be totally PowerShell-dependent.

In the next chapter, we will explore the latest features of Microsoft Dynamics NAV 2016 in detail, and the different design pattern that has been implemented into the Dynamics NAV system. The chapter will give you a better understanding of the business logic that has been implemented in NAV 2016.

About the Author
  • Rabindra Sah

    Rabindra Sah is a Microsoft Dynamics NAV technology specialist. He started his career as a Dynamics NAV consultant in the year 2011 with a Microsoft gold partner company in Nepal, where he fortified his functional skillset and evolved as a versatile Dynamics NAV professional. His hunger to solve problems and positive communication skills helped him flourish as an all-round consultant. His deep understanding of the Dynamics NAV system allowed him to successfully implement the company's first international project, which was funded by International Red Cross and Red Crescent Society. He has been a part of more than 12 full-phase Dynamics NAV projects and has earned several appraisal certificates from the clients and donor organizations for his extraordinary dedication and co-ordination. Rabindra is a technology enthusiast and quick learner of new technologies, which has allowed him get along with the latest Microsoft releases and related technologies. In addition to Dynamics NAV expertise, Rabindra also has a deep understanding of .NET technologies. Besides .NET, he also possesses a deep-level understanding of programming languages such as C and Java, which broadens his domain of competence. He believes that learning and sharing should go hand in hand, so, he is also an active member of online Microsoft communities, where he loves spending his time resolving the issues posted by other developers and end users. He is also an active blogger and loves to post problems and solutions that he comes across in his daily professional life. To further improve his skills and better understand the evolving Dynamics NAV system, he recently took several on-campus courses, such as algorithms, design patterns, software engineering, and enterprise architecture, during his Masters in Computer Science at Maharishi University of Management in United States. He is also an active volunteer item writer for Association of Dynamics Professionals for Microsoft Dynamics NAV Certification, where he participates in online meetings and contributes to the design of the certification examinations. He also creates materials for the examinations. Recently, he also got involved in the Microsoft Dynamics NAV courseware project lead by some of the best brains in the field. He is currently working as a Senior Associate for Microsoft Dynamics NAV in RAND Group, a Microsoft gold partner company, in Texas, USA. You can find him on LinkedIn at https://www.linkedin.com/in/rabindrasah.

    Browse publications by this author
Latest Reviews (4 reviews total)
Good publishing edition..
Mastering Microsoft Dynamics NAV 2016
Unlock this book and the full library FREE for 7 days
Start now