Partilhar via


Creating a Microsoft Azure Virtual Machine Operating System Image for Microsoft Dynamics NAV

This topic describes how to create custom images in Microsoft Azure Gallery that you can use to create virtual machines for deploying Dynamics NAV. Following this procedure ensures that Dynamics NAV remains fully automated when using the scripts that are provided with the Microsoft Dynamics NAV Provisioning Tools for Microsoft Azure.

To create a custom image and add it to the Azure Gallery, you must complete the following tasks.

Create a New Azure Virtual Machine for Generating the Operating System Image

The first task in preparing an operating system image is to create a new Azure virtual machine that is running Windows Server 2012. To do this, you use the Azure management portal to create the virtual machine based on an image from the Azure Image Gallery.

To create a new Azure virtual machine

  1. Sign in to Azure at https://azure.microsoft.com.

  2. Complete the instructions for creating a new virtual machine in Tutorial: Create and Manage Windows VMs with Azure PowerShell.

  3. When the virtual machine has been created, establish a Remote Desktop connection to the virtual machine, and then run Windows Update and apply all recommended updates.

    To connect from the Azure management portal, under Virtual Machines, select the virtual machine, and then choose Connect. For more information, see How to Log on to a Virtual Machine Running Windows Server.

Install Microsoft .NET Framework 3.5

If Microsoft .NET Framework is not installed on the image, the Dynamics NAV Setup will install it automatically during deployment. However, by installing Microsoft .NET Framework 3.5 manually, you can decrease the installation time and eliminate potential installation problems.

To install Microsoft .NET Framework 3.5 on Windows Server 2012

  1. Establish a Remote Desktop Connection to the Azure virtual machine.

    From the Azure management portal, under Virtual Machines, choose the virtual machine from the list, and then choose Connect. For more information, see How to Log on to a Virtual Machine Running Windows Server.

  2. Run Windows PowerShell as an Administrator.

  3. At the command prompt, type the following command and press Enter.

    Add-WindowsFeature NET-Framework-Core  
    

Install Microsoft SQL Server by Using SysPrep (NAV Database Image Only)

If you are creating an image that will be used to host the Dynamics NAV database, then the next task is to install Microsoft SQL Server on the virtual machine. If the image will be used to create virtual machines that will only host the Microsoft Dynamics NAV Server and Microsoft Dynamics NAV Web client, not the Dynamics NAV database, then you can skip this task.

You cannot complete the installation of SQL Server on the virtual machine before you capture it as an image in Azure. This is because when you use the captured image to create a new virtual machine, the virtual machine is configured to use a new administrator account that has a different security identifier (SID) than the administrator account on the image. Therefore, you will use SysPrep to run the first part of the SQL Server installation before you capture the operating system image, and then run the second part of the installation after the new virtual machine is created from the image and started for the first time.

Note

The following procedure illustrates how to use SysPrep to install a trial version of SQL Server.

For more information about SQL Server 2012 installation using SysPrep and configuration file generation, see Install SQL Server 2012 Using SysPrep.

To install SQL Server

  1. Establish Remote Desktop Connection to the new virtual machine.

    Note

    From the Azure management portal, under Virtual Machines, choose the virtual machine from the list, and then choose Connect.

  2. Download SQL Server 2012 from https://www.microsoft.com/sqlserver/en/us/get-sql-server/try-it.aspx.

    Note

    By default, Windows Server 2012 is enabled with the Internet Explorer Enhanced Security Configuration feature. This might prevent you from downloading SQL Server 2012. If you encounter problems, disable the feature temporarily, and then enable it again after the download is finished. To enable or disable the feature, open Server Manager, and then set the Internet Explorer Enhanced Security Configuration option.

    SQL server is downloaded as an ISO image.

  3. Mount the SQL Server ISO image as virtual drive on the virtual machine.

    To mount the ISO file, open File Explorer, right-click the file, and then choose Mount. A new drive, such as DVD Drive (F:), appears in the File Explorer.

  4. Copy SQL Server 2012 installation files from the mounted drive to the system drive (for example C:) of the virtual machine.

  5. Create a SQL SysPrep configuration file for running the SQL Server setup.exe file.

    You can use the example file that is described in SQL Server Sysprep Installation Configuration File Example or follow the instructions at Install SQL Server 2012 Using a Configuration File to create your own file.

    Name the file ConfigurationFile.ini and save it in the same location as the setup.exe file.

  6. Open a command prompt on the virtual machine, and then change to the folder that contains the setup.exe file.

  7. To run the SQL Server installer, type the following command and press Enter.

    Setup.exe /ConfigurationFile=ConfigurationFile.ini /IAcceptSQLServerLicenseTerms=true  
    

    The ConfigurationFile parameter specifies the SQL Server 2012 installation configuration file that executes the first part of the SysPrep-based SQL Server installation. The IAcceptSQLServerLicenseTerms parameter suppresses and acknowledges the SQL Server license agreement.

  8. To schedule the second part of the SQL Server Installation, follow these steps to create a SetupComplete2.cmd file.

    1. Open a text editor, such as Notepad.

    2. Include the following command:

      "C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\SQLServer2012\setup.exe" /QS /ACTION=CompleteImage /INSTANCEID=MSSQLSERVER /INSTANCENAME=MSSQLSERVER /IACCEPTSQLSERVERLICENSETERMS=1 /SQLSYSADMINACCOUNTS=%COMPUTERNAME%\VMAdmin /BROWSERSVCSTARTUPTYPE=AUTOMATIC /INDICATEPROGRESS /TCPENABLED=1  
      
      

      VMAdmin species the user name of the administrator account that is created on the virtual machine. If you want to specify a different user name, substitute VMAdmin with the name that you want to use. You cannot use Administrator as the user name.

      Important

      When you deploy Dynamics NAV on Azure by using the example scripts (Example-1VM-ps1 and Example-2VM.ps1), you must specify this user name for the administrator account on the virtual machine that will host the Dynamics NAV database. You specify the user name in the Setting-PartnerSettings.ps1 file or Set-PartnerCustom.ps1 file that is used by the example script. If you are using the Example-1VM-ps1 script, then you specify the user name in the $NAV_VMAdminUserName parameter. If you are using the Example-2VM-ps1 script, then you specify the user name in the $NAV_SqlServerMachineAdminUserName parameter. For more information about how to run the example scripts, see How to: Deploy Microsoft Dynamics NAV on Microsoft Azure by Using the Example Scripts

    3. Save the file as SetupComplete2.cmd in the C:\Windows\OEM\ folder.

      For an example of the SetupComplete2.cmd, see SetupComplete2.cmd File Example.

Capture the Image and Add it to the Azure Image Gallery

The last task for creating a custom operating system image is to capture the image and add it to the Azure Image Gallery. This operation is performed by using SysPrep.

.NET Framework Security

We recommend that the image adheres to the guidance that is provided on Microsoft Solution Accelerators.