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

BC21 Encryption Keys for SQL Server Authentication Error #171

Open
sami3187 opened this issue Jan 5, 2023 · 5 comments
Open

BC21 Encryption Keys for SQL Server Authentication Error #171

sami3187 opened this issue Jan 5, 2023 · 5 comments

Comments

@sami3187
Copy link

sami3187 commented Jan 5, 2023

if (!$RestartingInstance) {

Write-Host „Use custom user to access database“
$DatabaseUserName = „DBAdmin“
$DatabasePassword = „D$1234567“
$EncryptionPassword = „abc123ABC$%&abc123“
$TrustSQLServerCertificate = $true
$ServiceTierFolder = „C:\Keys\“
$DatabaseServer = „sqlxx.database.windows.net“
$DatabaseSecurePassword = ConvertTo-SecureString -String $DatabasePassword -AsPlainText -Force
$DatabaseCredentials = New-Object PSCredential -ArgumentList $DatabaseUserName, $DatabaseSecurePassword
$DatabaseName = „BC210-DB“
$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 DAF
-ApplicationDatabaseServer $DatabaseServer
-ApplicationDatabaseCredentials $DatabaseCredentials
-ApplicationDatabaseName $DatabaseName
-KeyPath $EncryptionKeyPath
-Password $EncryptionSecurePassword
-WarningAction SilentlyContinue
-Force

Set-NAVServerConfiguration -ServerInstance „DAF“ -KeyName „EnableSqlConnectionEncryption“ -KeyValue „true“ -WarningAction SilentlyContinue
Set-NAVServerConfiguration -ServerInstance „DAF“ -KeyName „TrustSQLServerCertificate“ -KeyValue $TrustSQLServerCertificate.Tostring().ToLowerInvariant() -WarningAction SilentlyContinue
Set-NavServerConfiguration -serverinstance „DAF“ -databaseCredentials $DatabaseCredentials
}

Any Suggestions for the below error cause.

Error :

Error

@KennieNP
Copy link
Contributor

KennieNP commented Jan 6, 2023

The error message suggests that you check which permissions the user running the PoSh script has on the database. Did you doublecheck that?

@samimsc
Copy link

samimsc commented Jan 8, 2023

Thanks for your reply .
how to check that "check which permissions the user running the PoSh script has on the database."

@samimsc
Copy link

samimsc commented Jan 8, 2023

Do we need App Registrations in Azure Portal ?

@samimsc
Copy link

samimsc commented Jan 12, 2023

@KennieNP Could you please advise. thanks.

@KennieNP
Copy link
Contributor

Thanks for your reply . how to check that "check which permissions the user running the PoSh script has on the database."

You can use SSMS to see users and their permissions

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

3 participants