Deploying Microsoft Dynamics NAV on Two Virtual Machines Using Example-2VM Script

This topic describes the Example-2VM.ps1 script of the Microsoft Dynamics NAV Provisioning Tools for Microsoft Azure. The script is located in the \WindowsPowerShellScripts\Cloud\HowTo folder on the Dynamics NAV installation media (DVD). The Example-2VM.ps1 script deploys Dynamics NAV on two Microsoft Azure virtual machines. After the script is run, you will have a fully functional environment that enables you to access Dynamics NAV data from the Microsoft Dynamics NAV Windows client or Microsoft Dynamics NAV Web client.

For information about how to use the script, see How to: Deploy Microsoft Dynamics NAV on Microsoft Azure by Using the Example Scripts or Walkthrough: Deploying Microsoft Dynamics NAV on Two Microsoft Azure Virtual Machines for a step-by-step example.

Deployment Overview

The Example-2VM.ps1 script creates two virtual machines, which are created based on an Azure image that you specify, and then installs Microsoft Dynamics NAV Web Server components and Microsoft Dynamics NAV Server on one machine and Dynamics NAV database components for SQL Server on the other machine.

Network topology for Example-2VM.ps1

The script restores a Dynamics NAV application database of your choice, along with a Dynamics NAV license. You can choose to install the CRONUS International Ltd. demonstration database and license. The script also configures endpoints in Azure for Dynamics NAV client service and management services and opens the communication ports in Windows Firewall.

When the script is finished, you will have a functional Dynamics NAV environment that has the following characteristics:

  • Two virtual machines on Azure in a virtual network and affinity group that you specify.

  • A website on Internet Information Services (IIS) with a web application for the Microsoft Dynamics NAV Web client. The website runs on TCP port 443 and uses https protocol. Users can access Dynamics NAV data by using the Microsoft Dynamics NAV Web client from a web browser.

  • OData and SOAP Web services are enabled and configured to use https protocol.

  • A Dynamics NAV application database that is configured to have a Dynamics NAV license file, company, and a single Dynamics NAV user that has SUPER permissions.

  • NavUserPassword credential type is configured as the user authentication method.

  • Microsoft Dynamics NAV Windows client available by using ClickOnce.

Deployment Process

The Example-2VM.ps1 script is a combination of several of the provisioning tools scripts that are called at various points in the deployment process. Before running each script, a secure Windows PowerShell remote session using HTTPS is established between the provisioning computer and the Azure virtual machine.

NAV powershell remoting with Azure

Deployment Phases

The following flow chart illustrates the process that is executed by the Example-2VM.ps1 script to deploy Dynamics NAV. The dashed boxes illustrate the manual alternatives in the flow.

Process for the Example-2VM deployment on Azure

The following table provides a description of each phase and the Windows PowerShell script that is executed.

Note

The scripts are located in the Cloud\NAVRemoteAdministrationSamples folder of the Microsoft Dynamics NAV Provisioning Tools for Microsoft Azure. For more information, see How to: Install the Microsoft Dynamics NAV Provisioning Tools for Microsoft Azure.

Phase Script Description
Import cmdlets and scripts Imports NavAzureRemoteAdminToolsSamples.psm1 with all the HowTo-prefixed scripts. Other PowerShell modules are automatically imported as needed.
Import the publishsettings file Imports the PublishSettingsFile that was downloaded when Azure PowerShell was installed.

Selects the Azure storage account and imports the Azure subscription ID and certificates.

For more information about these items, see Preparing for Deploying Microsoft Dynamics NAV on Microsoft Azure.
Create SQL VM HowTo-CreateAzureVM PowerShell session established.

Creates a new virtual machine to host SQL Server and the Dynamics NAV database. The virtual machine is created based on a selected image from the Microsoft Azure Marketplace that you specify.

NavAdministration module transferred to new virtual machine.
Create NAV Server VM HowTo-CreateAzureVM PowerShell session established.

Creates a new virtual machine to host Microsoft Dynamics NAV Server and Microsoft Dynamics NAV Web Server components. The virtual machine is created based on a selected image from the Azure Marketplace that you specify.

NavAdministration module is transferred to new virtual machine.
Open Firewall for SQL HowTo-OpenFirewallPort Modifies the Windows Firewall settings on the virtual machine that is running SQL Server to enable communication on TCP port 1443 from the virtual machine that is running Microsoft Dynamics NAV Server.
Upload DVD to NAV Server VM HowTo-UploadFilesToVM Creates .VHD in Azure storage, uploads the Dynamics NAV installation files to the VHD, and then copies the files from the VHD to the virtual machine running Microsoft Dynamics NAV Server.

Creates a .VHD file on the provisioning computer.

Alternatively, the Dynamics NAV installation files can be copied directly from the provisioning computer to the virtual machine through an active PowerShell session. To specify whether to use a VHD, change the $NAV_UseAzureStorageForDvdTransfer variable in the script.

Transfer of files by using either Azure Storage Account or through active PowerShell session.
Upload DVD to SQL VM HowTo-UploadFilesToVM Creates a .VHD in Azure storage, uploads the Dynamics NAV database backup (.bak) file to the VHD, and then copies the .bak file from the VHD to the virtual machine running SQL Server.

Alternatively, the .bak file can be copied directly from the provisioning computer to the virtual machine through an active PowerShell session. To specify whether to use a VHD, change the $NAV_UseAzureStorageForDvdTransfer variable in the script.
Install NAV on VM HowTo-InstallNAVonVM NAVAdministration module cmdlets are executed through a PowerShell session.

Installs Dynamics NAV on the virtual machine. The Microsoft Dynamics NAV Server instance and Microsoft Dynamics NAV Web client instance are not installed in this phase.
Add server instance HowTo-AddNAVInstance Establishes a PowerShell session, and then does the following:

- Installs a Microsoft Dynamics NAV Server instance.
- Installs a Dynamics NAV web server instance on IIS for Microsoft Dynamics NAV Web client.
- Creates a ClickOnce website for Microsoft Dynamics NAV Windows client deployment.
- Restores the Dynamics NAV database from the .bak file.
- Adds Dynamics NAV user.
- Imports the Dynamics NAV license.
- Adds Azure endpoints.
- Configures Windows Firewall.

See Also

How to: Deploy Microsoft Dynamics NAV on Microsoft Azure by Using the Example Scripts
Deploying Microsoft Dynamics NAV on Two Virtual Machines Using Example-2VM Script
Deploying and Managing Microsoft Dynamics NAV on Microsoft Azure
Preparing for Deploying Microsoft Dynamics NAV on Microsoft Azure
Network Topologies for Microsoft Dynamics NAV on Azure
Deploying Microsoft Dynamics NAV on One Virtual Machine Using Example-1VM Script
How to: Install the Microsoft Dynamics NAV Provisioning Tools for Microsoft Azure