Import-NAVEncryptionKey
Imports an encryption key from a file to a Microsoft Dynamics NAV Server instance and database in SQL Server.
Syntax
Default (Default)
Import-NAVEncryptionKey
[[-ServerInstance] <String>]
-ApplicationDatabaseServer <String>
[-ApplicationDatabaseCredentials <PSCredential>]
-ApplicationDatabaseName <String>
[-KeyPath] <String>
[-Password <SecureString>]
[-Force]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
When using SQL Server authentication between the Microsoft Dynamics NAV Server instance and database in SQL Server,Microsoft Dynamics NAV encrypts passwords that are used by a Microsoft Dynamics NAV Server instance to access to Microsoft Dynamics NAV databases in SQL Server. This includes, for example, the Microsoft Dynamics NAV Server service account credentials and the database credentials.
To encrypt and decrypt the passwords, an encryption key is used. Microsoft Dynamics NAV uses a single encryption key per server instance. The encryption key must be installed on the computer where Microsoft Dynamics NAV Server is installed and in the Microsoft Dynamics NAV database.
In some cases, such as when upgrading or migrating a system from one set of hardware to another, you might need a copy of the encryption key that is used on one Microsoft Dynamics NAV Server instance to use on another Microsoft Dynamics NAV Server instance.
By first using the Export-NAVEncryptionKey cmdlet to export the encryption key from one Microsoft Dynamics NAV Server instance to a file, you can then use the Import-NAVEncryptionKey to import the encryption key from the file to another Microsoft Dynamics NAV Server instance. The Import-NAVEncryptionKey cmdlet enables you to specify a destination file for the encryption key and also specify a password that is used to protect the file, if any.
You cannot import an encryption key on the Microsoft Dynamics NAV Server instance if an encryption key file already exists. You must first delete the encryption key from the computer where Microsoft Dynamics NAV Server is installed. By default, encryption keys are stored in the C:\ProgramData\Microsoft\Microsoft Dynamics NAV\80\Server\Keys folder.
Examples
EXAMPLE 1
Import-NAVEncryptionKey -ServerInstance DynamicsNAV -KeyPath "C:\Keys\nav.key" -ApplicationDatabaseServer MyNavSQLServer\MyNAV -ApplicationDatabaseName MyNavDB -Password (Get-Credential).Password
This example imports an encryption key from a password protected file that has the file path C:\Keys\nav.key to the Microsoft Dynamics NAV Server instance that is called DynamicsNAV. The encryption key is imported to the MyNavDB database on the MyNavSQLServer\MyNAV server instance in SQL Server.
Parameters
-ApplicationDatabaseCredentials
Specifies the user name and password of the login account to use to access the application database in SQL Server by using SQL Server authentication
Parameter properties
| Type: | PSCredential |
| 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: | True |
| Value from remaining arguments: | False |
-ApplicationDatabaseName
Specifies the name of the Microsoft Dynamics NAV database in SQL Server to which you want to import the encryption key. In a multitenant deployment, this is the application database, which contains a list of mounted tenants.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
-ApplicationDatabaseServer
Specifies the SQL Server name and instance, such as MyServer\MyInstance, that hosts the Microsoft Dynamics NAV database in which you want to import the encryption key. In a multitenant deployment, this is the application database, which contains a list of mounted tenants.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
-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
The full path to the file that contains the encryption key. The full path includes the drive, folders and file name.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 2 |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | True |
| Value from remaining arguments: | False |
-Password
Specifies a password that protects the encryption key file that are importing.
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 |
-ServerInstance
Specifies the name of a Dynamics NAV Server instance, for example, DynamicsNAV or myinstance. You can specify either the full name of an instance, such as MicrosoftDynamicsNavServer$myinstance or the short name such as myinstance.
Parameter properties
| Type: | String |
| Default value: | None |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | 1 |
| Mandatory: | False |
| Value from pipeline: | True |
| Value from pipeline by property name: | True |
| 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.
Inputs
System.String
You can pipe the ServerInstance and KeyPath as strings to this cmdlet.