This topic describes how to create custom images in Microsoft Azure Gallery that you can use to create virtual machines for deploying Microsoft Dynamics NAV. Following this procedure ensures that Microsoft 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
- Install Microsoft .NET Framework 3.5
- Install Microsoft SQL Server by Using SysPrep (NAV Database Image Only)
You only perform this task if the image will include SQL Server for hosting the Microsoft Dynamics NAV database. - Capture the Image and Add it to the Azure Image Gallery
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
Sign in to Azure at http://azure.microsoft.com.
Complete the instructions for creating a new virtual machine at http://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-tutorial.
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 Microsoft 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
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.
Run Windows PowerShell as an Administrator.
At the command prompt, type the following command and press Enter.
Copy Code 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 Microsoft 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 Microsoft 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
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. Download SQL Server 2012 from http://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.
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.
Copy SQL Server 2012 installation files from the mounted drive to the system drive (for example C:) of the virtual machine.
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.
Open a command prompt on the virtual machine, and then change to the folder that contains the setup.exe file.
To run the SQL Server installer, type the following command and press Enter.
Copy Code 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.
To schedule the second part of the SQL Server Installation, follow these steps to create a SetupComplete2.cmd file.
Open a text editor, such as Notepad.
Include the following command:
Copy Code "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, substituteVMAdmin
with the name that you want to use. You cannot useAdministrator
as the user name.Important When you deploy Microsoft 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 Microsoft 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 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.
To capture the image and add it to the Azure Image Gallery
For instructions about how to capture the image and add it to the Azure Image Gallery, see How to Capture an Image of a Virtual Machine Running Windows Server.
Security
We recommend that the image adheres to the guidance that is provided on Microsoft Solution Accelerators.