Import-NAVEncryptionKey erroring out BC20
SilviuVirlan opened this issue · comments
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:
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
Sorry for not seeing this issue, assuming it was resolved long ago.