How to: Deploy Dynamics NAV Database on Azure SQL
With the release of Microsoft Dynamics NAV 2016, databases can be deployed in Azure SQL. By using Azure SQL as the replacement, you no longer need to manage SQL servers and licenses. Allowing you to reduce the running costs.
There are 5 main steps for the deployment
- Preparing the license
- Preparing the existing database
- Exporting the database
- Uploading the database to Azure SQL
- Mounting the database to Dynamics NAV
Step 1: Preparing the Dynamics NAV license
First, you need to prepare your license in the existing environment.
As part of how Dynamics NAV works, licenses are managed in two methods. One is to save the license file with an extension “flf” in the application server directory, and the other to save it within the SQL server.
To run Dynamics NAV in Azure SQL server, you need to save the license within the SQL server. If not saved, error will be shown in the steps after.
First, in the existing environment, start up the development environment. From there, access “Database” > “Alter Database” > “Integration”.
Make sure that “Save License to Database” check box is enabled.
Step 2: Preparing the database
You need to remove any Windows authentications that are associated with the database and have only SQL database mapped to it.
From SQL Server Management Studio, go to “Securities” and right click on the user, and open “Properties”.
In the “User Mapping” section, untick any mappings to the Dynamics NAV database. Once done, click OK.
Step 3: Exporting the database
Before exporting and importing database, you need to have the latest version of SQL Server Management Studio (Released later than December 2015 Preview)
You can check how from this article – How to: Install SQL Management Studio 2016 CTP.
First, we will export the existing database in a “BACPAC” format.
It’s a file format used to upload to Azure SQL and be careful not to get mixed up with BAK file.
Right click on the database you want to export, click on “Tasks” and select “Export Data-tier Application”.
The “Export Data-tier Application” wizard will show up. Click on “Next”.
Choose the location to export. Location can be either your local storage or uploaded on to Azure storage with this article, I will “Save to local disk”.
Check the details and once confirmed, click on “Finish” to start exporting.
During the export, you can see the progress. If your database size is big and depending on the speed of your internet connection, it may take more than 30 minutes. Make sure you have plenty of time.
Step 4: Uploading the database
Next step is to upload the exported database.
If you have not deployed your SQL server yet, read this article first.
Connect to the Azure SQL Server from your local environment.
Once connected, right click on “Databases” and select “Import Data-tier Application”
“Import Data-tier Application” wizard will startup.
Select “Import from local disk” and choose the directory where you have exported your bacpac file.
Enter the desired database name and select a database plan to run on Azure.
As of 2016/4/8, Elastic database cannot be chosen here.
In this article, I will be selecting “Basic” edition, but in live environments, make sure to choose “Standard” as the minimum spec.
Review your settings and once confirmed, click on “Finish” to start the upload.
Upload may take several minutes so make sure you have plenty of time.
When complete, the screen below will show up.
Step 5: Mount the database to Dynamics NAV Application Server
From the NAV Administration Console, add a new Dynamics NAV 2016 Instance.
Specify your server instance name and ports to run on.
Open up the detailed settings of your new instance. In the “Database” fasttab, specify the Azure SQL server address and the database name you’ve uploaded.
On the right side of the screen, click on “Database Credentials” and fill-in the authentication information for AzureSQL.
You need to also change the database authentication type from “Windows authentication” to “SQL authentication”.
The following message will appear for the first time. Click OK.
Now you just need to start the server instance and you’re done!