Share via


New-NAVEncryptionKey

Create an encryption key and stores it in a file in a specified path on the computer or network.

Syntax

Default (Default)

New-NAVEncryptionKey
    [-KeyPath] <String>
    [-Password <SecureString>]
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

When using SQL Server authentication between the Business Central Server instance and database in SQL Server, Business Central encrypts passwords that are used by a server instance to access to Business Central databases in SQL Server. This includes, for example, the server instance service account credentials and the database credentials.

To encrypt and decrypt the passwords, an encryption key is used. Business Central uses a single encryption key per server instance. Encryption and decryption is performed by a RSA algorithm as provided by the cryptographic service provider (see RSACryptoServiceProvider(Int32)). The generated encryption key size is 2048 bits.

In some cases, such as when upgrading or migrating a system from one set of hardware to another, you might need to copy of the encryption key to use it on another Business Central Server instance. By using the New-NAVEncryptionKey cmdlet, you can create an encryption key, and then use the Import-NAVEncryptionKey cmdlet to import the exported key to a Business Central Server instance and database. The New-NAVEncryptionKey cmdlet enables you to specify a destination file for the key and specify a password to protect the file.

Examples

EXAMPLE 1

New-NAVEncryptionKey -KeyPath "C:\Keys\nav.key" -Password (Get-Credential).Password

Description


The following example creates an encryption key in a password protected file.

Parameters

-Confirm

Prompts you for confirmation before executing the command.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Force

Forces the command to run without asking for user confirmation.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-KeyPath

Specifies the full path of the key will be exported. The full path includes the drive, folders, and file name. The folder path must already exist. The file will be created that has the given file name.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Password

Specifies a password that protects the encryption key file.

Parameter properties

Type:SecureString
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

System.String KeyPath