Importing a new BC license from PowerShell

When you transition from Navision to the newer Business Central, you will notice, that you no longer have a classic client. So how do you import a new license to the server?

Since you cannot not do this from the Business Central Administration Manager, you have to do it from PowerShell. You can use the standard PowerShell or you can use the Business Central Administration Shell.

First you need to start PowerShell as administrator. (Right click and select Run as Administrator)
PowerShell - Run as Administrator

If you have chosen to run the standard PowerShell, then you have to start with importing the Management module. This is done with help of the Import-Module command.

Import-Module “C:\Program Files\Microsoft Dynamics 365 Business Central\170\Service\Microsoft.Dynamics.Nav.Management.psd1”

I’m using version 17 in my example, so you might have to change the path, so that it fits your version of BC.

Now we are ready to import the license file. This is done with the Import-NAVServerLicense command.

Import-NAVServerLicense
[-Tenant ]
[-LicenseFile]
[-LicenseData] <Byte[]>
[-Database ]
[-ServerInstance]
[-Force]
[-WhatIf]
[-Confirm]
[]

Lets go through the parameters.

Tenant
The Tenant ID of which you want to import the license to.
This parameter is only required when the server instance is configured to run multiple tenants.

LicenseFile
Specifies the path to the Business Central license file.
This parameter should only be specified if LicenseData has not been specified.

LicenseData
Specifies the content retrieved from the certificate file by using the Get-Content cmdlet.
([Byte[]]$(Get-Content -Path “fin.bclicense” -Encoding Byte))
This parameter should only be specified if LicenseFile has not been specified.

Database
Specifies the database into which to import the license file. The possible values are described in the following list:
Default, Master, NavDatabase and Tenant

ServerInstance
Specifies the name of a Business Central Server instance, for example bc170

Force
Forces the command to run without asking for user confirmation

WhatIf
Describes what would happen if you executed the command without actually executing the command.

Confirm
Prompts you for confirmation before executing the command.

Usually I only uses the parameters ServerInstance and LicenseFile

After the License file has been imported, I would recommend to restart the service tier, so that it uses the new license.
This can also be done in PowerShell.

Restart-NAVServerInstance -ServerInstance bc170

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.