Corfu Navision 2016, Development Tips, How To, Information, Instalation & Configuration

Configuring SQL Server Authentication in Microsoft Dynamics NAV 2016 – Part-2

Recall from my previous post Configuring SQL Server Authentication in Microsoft Dynamics NAV 2016 – Part-1, action is almost similar with few small differences when dealing with Multitenant Deployment.
Configure SQL Server Authentication on Microsoft NAV Server Instance in a Multitenant Deployment
How to configure a Microsoft Dynamics NAV database to use SQL Server Authentication with a Microsoft Dynamics NAV Server instance.

To configure a SQL Server Authentication on a Microsoft Dynamics NAV Server instance, you set up the server instance with the login credentials (user name and password) for the user accounts for the application and tenant databases in SQL Server.

To configure SQL Authentication on Microsoft NAV Server Instance using Microsoft Dynamics NAV Server Administration tool

  • Open the Microsoft Dynamics NAV Server Administration tool.
  • In the console tree, which is the left pane, expand the node for the computer that contains the Microsoft Dynamics NAV Server instance, and then select the Microsoft Dynamics NAV Server instance.
  • Configure SQL Server Authentication with the application database as follows:
    • In the Actions pane, choose Database Credentials.
    • On the Database Credentials page, choose the Edit button.
    • Set the Database Authentication Mode to SQL Server Authentication.
    • In the Database User Name field, type the login name for the database user that you want to use to access the Microsoft Dynamics NAV application database in SQL Server.
    • In the Password field, type the login password for the database user that you want to use to access the Microsoft Dynamics NAV database in SQL Server.
    • Choose the Save button, and then on the Enable Encryption on SQL Server Connections dialog box, choose the OK button.

Encryption keys are used to help secure the login credentials over the connection between the Microsoft Dynamics NAV Server instance and the Microsoft Dynamics NAV database in SQL Server.

  • On the Information dialog box about encryption, choose the OK button.

This dialog box is to inform you to enable encryption on SQL Server connections, which is disabled by default.

  • If you want to enable encryption on SQL Server connections, in the Action pane, choose Configuration, and then choose the Edit button. In the Database tab, select Enable Encryption on SQL Connections, choose the Save button, and then the OK button.
  • To configure SQL Server Authentication with the tenant database, mount the tenant to the Microsoft Dynamics NAV Server instance and specify the login credentials (user name and password) for the database user that you want to use to access the Microsoft Dynamics NAV tenant database in SQL Server.

If the tenant is already mounted to the Microsoft Dynamics NAV Server instance, you must dismount the tenant, and mount it again.

Restart the server instance.

Advertisement
Corfu Navision 2016, Data, Development Tips, How To, Information, Instalation & Configuration, PowerShell, upgrade

Few Helpful PowerShell Commands which you can use for Upgrade Process in Navision 2016 – Part 2

You can use Windows PowerShell scripts to upgrade the latest version of Microsoft Dynamics NAV. Microsoft Dynamics NAV 2016 provides sample scripts that you can adapt for your deployment architecture.

Automating the Upgrade Process

When you upgrade to Microsoft Dynamics NAV 2016, you must first upgrade the application code, and then you upgrade the data.

In my earlier post I have explained this using PowerShell commands, you can find the link here: Helpful PowerShell Commands which you can use for Upgrade Process in Navision 2016

By using Windows PowerShell, you can automate both parts of the upgrade process. Also, you can use the same scripts to test each step in your upgrade process before you upgrade production databases.

You can combine this automated upgrade with a migration to multitenancy this makes maintenance easier for you.

The Sample Scripts for Code Upgrade

Microsoft Dynamics NAV includes sample scripts that illustrate how you can use Windows PowerShell cmdlets to upgrade your application to the latest version of Microsoft Dynamics NAV.

The sample scripts are located in the ApplicationMergeUtilities folder under the WindowsPowerShellScripts folder on the Microsoft Dynamics NAV product media.

However you can follow above post link steps explanation to get it done.

The Sample Scripts for Data Upgrade

Microsoft Dynamics NAV includes sample scripts that illustrate how you can automate the upgrade of data to the latest version of Microsoft Dynamics NAV.

The sample scripts are located in the Upgrade folder under the WindowsPowerShellScripts folder on the Microsoft Dynamics NAV product media. You can run the sample script using a partner license or a customer license.
PowerShell-3

To learn and follow MS suggested steps you can find details using this link. Automating the Upgrade Process using Windows PowerShell Scripts in Microsoft Dynamics NAV 2016

To run the sample script for the data upgrade of a Microsoft Dynamics NAV database, you must have a Microsoft Dynamics NAV 2013, Microsoft Dynamics NAV 2013 R2, or Microsoft Dynamics NAV 2015 database that is available on a SQL Server instance and is ready to be upgraded.

Here I present my version derived from above Steps:

To continue we will do some setup. Copy the Upgrade folder from above path and save as DataUpgradePSKit.

PowerShell-4

Create Folder OriginalScript and move the PS1 file on root to this folder although we don’t require for this exercise but you can safe copy for your reference. (Example, Set-PartnerSettings, Set-PowerShellEnvironment)

Create Backup folder, script will use to store backup of the database previous to start Upgrade process.

Create Upgrade Folder and place these files:

  • License File
  • New Merged Objects fob
  • Upgrade Toolkit / or your own prepared Upgrade Codeunits

PowerShell-5

  • Create ProcessLogs Folder, which will be used for recording log of Shell Script.

Here is the script which we will be using to perform our Data Upgrade process:

You can find this script here http://1drv.ms/1NyolVV or you can download from Menu of my Blog using Link Shared Files.

 

# Added below parameter values globally for ease of maintenance

# You just do correction on values here (as per your environment) and will be in effect for rest of below script

# No need to scan and change every occurrence for same value in different steps of the script.

# Select this section and Execute first so that these Variables value are available for rest of the script.

Import-Module ‘C:\Program Files\Microsoft Dynamics NAV\90\Service\NavAdminTool.ps1’

$NAVUpgrade_NAVServerInstance = “UpgradedDBfrom2013R2”

$NAVUpgrade_NAVServerServiceAccount = “NT AUTHORITY\NETWORK SERVICE”

$NAVUpgrade_FinSqlExeFile = “C:\Program Files (x86)\Microsoft Dynamics NAV\90\RoleTailored Client\finsql.exe”

$NAVUpgrade_IDEModulePath = “”

$NAVUpgrade_DatabaseServer = “INDEL-AXT5283VM”

$NAVUpgrade_DatabaseInstance = “”

$NAVUpgrade_DatabaseName = “Demo Database NAV (7-1)”

$NAVUpgrade_DatabaseToUpgradeBakFile = “C:\UserData\DataUpgradePSKit\Backup\DynamicsNAV70_BeforeUpgrade.bak”

$NAVUpgrade_NewVersionObjectsFobFilePath = “C:\UserData\DataUpgradePSKit\Upgrade\NewObjects.fob”

$NAVUpgrade_UpgradeToolkitObjectsFobFilePath = “C:\UserData\DataUpgradePSKit\Upgrade\Upgrade710900.FOB”

$NAVUpgrade_UpgradeObjectsFilter = “Version List=UPGTK9.00.00”

$NAVUpgrade_UpgradeLogsDirectory = “C:\UserData\DataUpgradePSKit\Upgrade\ProcessLogs”

#$NAVUpgrade_RapidStartPackageFile = ‘C:\UserData\DataUpgradePSKit\Upgrade\PackageSTCODES.rapidstart’

$NAVUpgrade_CurrentVersionLicenseFile = “C:\UserData\DataUpgradePSKit\Upgrade\DevLicense.flf”

$NAVUpgrade_PreviousVersionLicenseFilePath = “C:\UserData\DataUpgradePSKit\Upgrade\DevLicense.flf”

 

# Upgrade Steps:

Import-Module (Join-Path (Get-Location) ‘Cmdlets\NAVUpgradeCmdlets.psm1’) -DisableNameChecking

#1. Prepares the Windows PowerShell session by importing the required modules.

        # Import the NAV IDE Module.

Import-NAVIdeModule -IDEModuleSuggestedPath $NAVUpgrade_IDEModulePath -FinSqlExeFile $NAVUpgrade_FinSqlExeFile

Import-NAVManagementModule

Import-SqlPsModule

 

#2. Saves the current license from the Microsoft Dynamics NAV 2013, Microsoft Dynamics NAV 2013 R2, or Microsoft Dynamics NAV 2015 database.

# Backup current license from the application part of the database (table ‘$ndo$dbproperty’) , if it exists

        Export-NAVLicenseFromApplicationDatabase `

-DatabaseName $NAVUpgrade_DatabaseName `

-DatabaseServer $NAVUpgrade_DatabaseServer `

-DatabaseInstance $NAVUpgrade_DatabaseInstance `

-LicenseFilePath $NAVUpgrade_PreviousVersionLicenseFilePath

 

#3. Creates a backup of the Microsoft Dynamics NAV 2013, Microsoft Dynamics NAV 2013 R2, or Microsoft Dynamics NAV 2015 database, and then converts the database to Microsoft Dynamics NAV 2016.

        Backup-NAVSqlDatabase `

-DatabaseServer $NAVUpgrade_DatabaseServer `

-DatabaseInstance $NAVUpgrade_DatabaseInstance `

-DatabaseName $NAVUpgrade_DatabaseName `

-DatabaseBackupFilePath $NAVUpgrade_DatabaseToUpgradeBakFile

$NAVUpgrade_DatabaseSQLServerInstance = Get-SqlServerInstance -DatabaseServer $NAVUpgrade_DatabaseServer -DatabaseInstance $NAVUpgrade_DatabaseInstance

$NavServerInfo = New-Object PSObject

Add-Member -InputObject $NavServerInfo -MemberType NoteProperty -Name NavServerName -Value “$NAVUpgrade_DatabaseServer”

Add-Member -InputObject $NavServerInfo -MemberType NoteProperty -Name NavServerInstance -Value (Get-NAVServerConfigurationValue  -ServerInstance $NAVUpgrade_NAVServerInstance -ConfigKeyName “ServerInstance”)

Add-Member -InputObject $NavServerInfo -MemberType NoteProperty -Name NavServerManagementPort -Value (Get-NAVServerConfigurationValue -ServerInstance $NAVUpgrade_NAVServerInstance -ConfigKeyName “ManagementServicesPort”)

 

# Perform technical upgrade of the NAV database

        Invoke-NAVDatabaseConversion `

-DatabaseName $NAVUpgrade_DatabaseName `

-DatabaseServer $NAVUpgrade_DatabaseSQLServerInstance `

-LogPath $NAVUpgrade_UpgradeLogsDirectory\”Database Conversion”

 

#4. Connects the Microsoft Dynamics NAV 2016 Server instance to the converted database, imports the Microsoft Dynamics NAV 2016 license file, and then synchronizes the table schema.

 

# Connect the NAV Server to the NAV database

        Connect-NAVServerToNAVDatabase  `

-NAVServerInstance $NAVUpgrade_NAVServerInstance `

-NAVServerServiceAccount $NAVUpgrade_NAVServerServiceAccount `

-DatabaseServer $NAVUpgrade_DatabaseServer `

-DatabaseInstance $NAVUpgrade_DatabaseInstance `

-DatabaseName $NAVUpgrade_DatabaseName

# Import the new version license into the application database, and restart the server in order for the license to be loaded

        Import-NAVServerLicense -ServerInstance $NAVUpgrade_NAVServerInstance -LicenseFile $NAVUpgrade_CurrentVersionLicenseFile -Database NavDatabase

Set-NAVServerInstance -ServerInstance $NAVUpgrade_NAVServerInstance -Restart

# Synchronize the NAV database

        Sync-NAVTenant -ServerInstance $NAVUpgrade_NAVServerInstance -Mode Sync -Force

 

#5. Imports the application objects and upgrade toolkit objects from the specified .fob file, and then synchronizes the table schema again.

#   This updates the SQL Server database based on the new table schema that is defined by the imported application objects. Data that must be mapped to another table is saved in upgrade tables.

# Delete the tables from the previous version, using SynchronizeSchemaChanges Later.

# The new  objects we import will contain the new version of the tables.

        Delete-NAVApplicationObject `

-DatabaseName $NAVUpgrade_DatabaseName `

-DatabaseServer $NAVUpgrade_DatabaseSQLServerInstance `

-LogPath $NAVUpgrade_UpgradeLogsDirectory `

-Filter “Type=Table;ID=<2000000000” `

-SynchronizeSchemaChanges “No” `

-NavServerName $NavServerInfo.NavServerName `

-NavServerInstance $NAVServerInfo.NavServerInstance `

-NavServerManagementPort $NavServerInfo.NavServerManagementPort `

-Confirm:$false

# Import all the new objects and the upgrade objects, by delaying the schema synchronization

# If an $UpgradeToolkitObjects value has not been provided, then

#  the assumption is that the upgrade toolkit is within the same .FOB as the new objects

           if(!$UpgradeToolkitObjects)

{

# Import FOB file containing the new version of the application objects, including the upgrade toolkit

Import-NAVApplicationObject `

-Path $NAVUpgrade_NewVersionObjectsFobFilePath `

-DatabaseName $NAVUpgrade_DatabaseName `

-DatabaseServer $NAVUpgrade_DatabaseSQLServerInstance `

-LogPath $NAVUpgrade_UpgradeLogsDirectory `

-ImportAction “Overwrite” `

-SynchronizeSchemaChanges “No” `

-NavServerName $NavServerInfo.NavServerName `

-NavServerInstance $NAVServerInfo.NavServerInstance `

-NavServerManagementPort $NavServerInfo.NavServerManagementPort `

-Confirm:$false

}

else

{

 

# Import FOB file containing the new version of the application objects

Import-NAVApplicationObject `

-Path $NAVUpgrade_NewVersionObjectsFobFilePath `

-DatabaseName $NAVUpgrade_DatabaseName `

-DatabaseServer $NAVUpgrade_DatabaseSQLServerInstance `

-LogPath $NAVUpgrade_UpgradeLogsDirectory `

-ImportAction “Overwrite” `

-SynchronizeSchemaChanges “No” `

-Confirm:$false

 

# Import FOB file containing the upgrade codeunit and upgrade tables

Import-NAVApplicationObject `

-Path $NAVUpgrade_UpgradeToolkitObjectsFobFilePath `

-DatabaseName $NAVUpgrade_DatabaseName `

-DatabaseServer $NAVUpgrade_DatabaseSQLServerInstance `

-LogPath $NAVUpgrade_UpgradeLogsDirectory `

-ImportAction “Overwrite” `

-SynchronizeSchemaChanges “No” `

-Confirm:$false

}

# Synchronize the metadata changes to SQL

        Sync-NAVTenant -ServerInstance $NAVUpgrade_NAVServerInstance -Mode Sync -Force

#6. Calls the Start-NAVDataUpgrade cmdlet to verify the data upgrade preconditions and transfer data from the upgrade tables to the destination tables.

# Invoke the Data Upgrade process

        Invoke-NAVDataUpgrade -ServerInstance $NAVUpgrade_NAVServerInstance

 

#7. Deletes all obsolete tables and the upgrade toolkit objects.

# Delete Upgrade Toolkit objects

        Delete-NAVApplicationObject `

-DatabaseName $NAVUpgrade_DatabaseName `

-DatabaseServer $NAVUpgrade_DatabaseSQLServerInstance `

-LogPath $NAVUpgrade_UpgradeLogsDirectory `

-Filter “$NAVUpgrade_UpgradeObjectsFilter;ID=<2000000000” `

-SynchronizeSchemaChanges “Force” `

-NavServerName $NavServerInfo.NavServerName `

-NavServerInstance $NAVServerInfo.NavServerInstance `

-NavServerManagementPort $NavServerInfo.NavServerManagementPort `

-Confirm:$false

 

#8.       Initializes all companies in the upgraded database. If you specified a RapidStart package in the Set-PartnerSettings.ps1 file, the package is applied to all companies.

# Optionally, run RapidStart package import

        if($NAVUpgrade_RapidStartPackageFile)

{

Invoke-NAVRapidStartDataImport -ServerInstance      $NAVUpgrade_NAVServerInstance -RapidStartPackageFile $NAVUpgrade_RapidStartPackageFile

 

}

 

The sample script is intended to be run in the context of a Microsoft Dynamics NAV 2016 deployment, including the Microsoft Dynamics NAV Server instance.

The Microsoft Dynamics NAV Server instance cannot be multitenant. When the sample script runs successfully, the result is a Microsoft Dynamics NAV 2016 database that is connected to a Microsoft Dynamics NAV 2016 Server instance, and which uses a Microsoft Dynamics NAV 2016 license.

You may face some permission related issues, take help of you IT person if not sure about the nature of issue or use Administrator login.

I will come with more details in my next posts.

 

 

Development Tips, Excel, How To, Jet Reports, Office Integration, Report

Using NL( Lookup ) in Jet Reports Part-2

We have discussed regarding Lookup in my previous post. If you missed can find link here.

Using NL( Lookup ) in Jet Reports Part-1.

I am continuing with more advanced usage here below.

In some instances it is also desirable to base the values that are displayed in one NL(“Lookup”) function on the results that were selected in another NL(“Lookup”) function.

An example of this could exist in a Sales Report. The viewer will have the ability to select a Salesperson Code to run the report for, and will also be able to specify Customer Numbers in order to filter the report further.

If only one Salesperson Code is selected, however, it may be undesirable to display Customer Numbers that are associated with other Salesperson Codes.

In this instance, two NL(“Lookup”) functions will be used, with the Customer Number filtered by the Salesperson Code so that the values are related. The first NL(“Lookup”) function, which will allow the selection of the Salesperson Code, will look like this:
Lookup-6

Lookup-7

The next NL(“Lookup”) function will give the viewer the ability to select from a list of Customer Numbers, but it will be filtered based on the Salesperson Code that was previously selected. This is done but inserting a normal filter into the function and referencing the cell containing the Salesperson Code that was previously selected by the viewer.

This addition would make the report look like this:
Lookup-8
After selecting Salesperson Code Filter when we open Customer List it will show lookup as below:
Lookup-9

Customer List is filtered out with Salesperson Code we selected using Salesperson List Lookup.

Will come up with more details in my upcoming post, stay tuned for more details.

Development Tips, Excel, How To, Jet Reports, Office Integration, Report

Creating Simple List Report in Excel Using Jet Reports Part-2

In my previous post we saw how to create simple report in excel using Jet Report.

If not seen please refer it before you continue with this post, here is the link for same:

Creating Simple List Report in Excel Using Jet Reports Part-1

Using NL Lookup Part-1

Here we will start from where we left in previous post.

We will add one more sheet in Report we created in our previous post, and name it is as Option, where we will define all of our Filters.

Our Option sheet will look as below:
JetSimpleReport-7
Here we have created 3 Filters Customer No., Credit Limit LCY & Balance LCY.

Next Step will be to apply this Filter provided by user at runtime to the Report.

Return to your Report Sheet and edit the NL Function used to retrieve Rows from Customer as below:
JetSimpleReport-8
(*) in filter denotes all, in other words no Filter.

Now let see the Filter Sheet how it behaves when we run the report.

When we run the report first Report option is shown, where we will give our Filters:
JetSimpleReport-9

Here I am giving below filters:

Customer No. Filter                         *              Include All Customers

Credit Limit (LCY) Filter                  0              All rows with Credit Limit as Zero

Balance (LCY) Filter                      >0             All rows with Balance value greater than Zero

The output of the report should be as below:

JetSimpleReport-10

Stay tuned for more details in my future posts.

I will explain more about commands, filters, functions, lookup etc.…