Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import-NAVEncryptionKey erroring out BC20 #526

Closed
SilviuVirlan opened this issue Jul 14, 2023 · 1 comment
Closed

Import-NAVEncryptionKey erroring out BC20 #526

SilviuVirlan opened this issue Jul 14, 2023 · 1 comment

Comments

@SilviuVirlan
Copy link

SilviuVirlan commented Jul 14, 2023

In Azure SQL copied BC Prod database as DEV database but BC service for DEV fails to start,
BC service for PROD and BC service for DEV are on 2 different machines. SQL databases are on the same SQL Azure.
Tried to import NAV encryption key but fail:
image

Result:

PS C:\Temp\UAT> Write-Host "Use custom user to access database“
$DatabaseUserName = "...“
$DatabasePassword = "...."
$EncryptionPassword = '...'
$TrustSQLServerCertificate = $true

$ServiceTierFolder = "C:\Keys"
$DatabaseServer = '....database.windows.net'

$DatabaseSecurePassword = ConvertTo-SecureString -String $DatabasePassword -AsPlainText -Force
$DatabaseCredentials = New-Object PSCredential -ArgumentList $DatabaseUserName, $DatabaseSecurePassword
$DatabaseName = 'CI_DEV'
$EncryptionKeyPath = Join-Path $ServiceTierFolder 'BC.key‘
$EncryptionSecurePassword = ConvertTo-SecureString -String $EncryptionPassword -AsPlainText -Force
New-NAVEncryptionKey -KeyPath $EncryptionKeyPath -Password $EncryptionSecurePassword -Force | Out-Null

Write-Host "Import Encryption Key“

Import-NAVEncryptionKey -ServerInstance CI-DEV -ApplicationDatabaseServer $DatabaseServer
-ApplicationDatabaseCredentials $DatabaseCredentials -ApplicationDatabaseName $DatabaseName
-KeyPath $EncryptionKeyPath -Password $EncryptionSecurePassword
-WarningAction SilentlyContinue `
-Force
Use custom user to access database
Import Encryption Key
Import-NAVEncryptionKey : Invalid syntax on line 9 - 'Expected > character.'.
At line:19 char:1

  • Import-NAVEncryptionKey -ServerInstance CI-DEV `
  •   + CategoryInfo          : NotSpecified: (:) [Import-NAVEncryptionKey], XmlSyntaxException
      + FullyQualifiedErrorId : System.Security.XmlSyntaxException,Microsoft.Dynamics.Nav.Management.Cmdlets.ImportNavEncryptionKey
    
    

This is the script:

Write-Host "Use custom user to access database“
$DatabaseUserName = "...“
$DatabasePassword = "..."
$EncryptionPassword = '...'
$TrustSQLServerCertificate = $true

$ServiceTierFolder = "C:\Keys"
$DatabaseServer = '...database.windows.net'

$DatabaseSecurePassword = ConvertTo-SecureString -String $DatabasePassword -AsPlainText -Force
$DatabaseCredentials = New-Object PSCredential -ArgumentList $DatabaseUserName, $DatabaseSecurePassword
$DatabaseName = 'CI_DEV'
$EncryptionKeyPath = Join-Path $ServiceTierFolder 'BC.key‘
$EncryptionSecurePassword = ConvertTo-SecureString -String $EncryptionPassword -AsPlainText -Force
New-NAVEncryptionKey -KeyPath $EncryptionKeyPath -Password $EncryptionSecurePassword -Force | Out-Null

Write-Host "Import Encryption Key“

Import-NAVEncryptionKey -ServerInstance CI-DEV -ApplicationDatabaseServer $DatabaseServer
-ApplicationDatabaseCredentials $DatabaseCredentials -ApplicationDatabaseName $DatabaseName
-KeyPath $EncryptionKeyPath -Password $EncryptionSecurePassword
-WarningAction SilentlyContinue `
-Force

@SilviuVirlan SilviuVirlan changed the title Import-NAEncryptionKey erroring out BC20 Import-NAVEncryptionKey erroring out BC20 Jul 14, 2023
@freddydk
Copy link
Contributor

Sorry for not seeing this issue, assuming it was resolved long ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants