Dynamics 2016 on Azure SQL Database service

aceXaceX Member Posts: 166
Hi there,

If anyone have experience with NAV on Azure, please help. The problem is explained bellow:

*We have server which is set on Azure and the database is set on Azure SQL Database service. We need to have two NAV Service instances. One DynamicsNAV100Local, which will be used for development locally on the server, and other one DynamicsNAV100WAN for connection to the service and NAV database from WAN connection.
*Problem is, when I start one of the instance which is logged using SQL user is ok. When I start the second one, I have an error*:

<error>The Microsoft Dynamics NAV Server instance cannot connect to the application database because it is using a different password encryption key than the one currently used on the database</error>

When one of the instances will be started, key from that instance is valid and only this instance is starting, when another instance I try to start, automatically service is going to status Stop Pending >> Stopped with explanation that the encryption key is wrong.

Using specifications to set up the system, to start up the Service instance, it must to use SQL authentication.

Thank you in advice
Best Regards



Comments

  • vremeni4vremeni4 Member Posts: 323
    Hi,

    In NAV Administration console, when you click on the second instance, did you set the parameters in the section AzureKeyVault encryption ?
  • aceXaceX Member Posts: 166
    Thanks for your suggestion @vremeni4.

    I'm not sure which fields should be filled, in this section. Can you send me some manual for this steps - how to fill AzureKeyVault section.

    And one more question:
    If I use this option, does the client need to buy (subscribe) to Azure Key Vault to be able to use more that one Service and is this possible to be done without additional fees.

    Thanks in advice

    Best Regards
  • vremeni4vremeni4 Member Posts: 323
    Hi,

    As I had so many issues with Azure SQL I haven't done this for a while so I cannot recall all the necessary steps.
    Anyhow these two links should provide necessary information.
    https://msdn.microsoft.com/en-us/library/dn951458(v=nav.90).aspx
    and this one
    https://msdn.microsoft.com/en-us/library/dn951464(v=nav.90).aspx

    This video, explains the setup in detail

    https://www.youtube.com/watch?v=_v2XFF4q0Ww

    I hope this helps.
  • aceXaceX Member Posts: 166
    All those steps are already accomplished, but examples are showing how to setup the environment with one Service, that's ok in my scenario, but the problem is when I try to work with two or more Service instances of NAV.
    In attachment is the message which is describing the problem when I'll try to start second service
  • vremeni4vremeni4 Member Posts: 323
    Hi,

    Did you run this
    To create and import encryption key

    In the Microsoft Dynamics NAV 2016 Administration Shell, run the New-NAVEncryptionkey cmdlet.

    This creates a file that contains an encryption key. If you already have an encryption key file, you can skip this step.

    Run the Import-NAVEncryptionkey cmdlet to install the encryption key on the Microsoft Dynamics NAV Server instance and database.
    as explained here

    https://msdn.microsoft.com/en-us/library/dn951464(v=nav.90).aspx

    as it was explained here
    https://msdn.microsoft.com/en-us/dynamics-nav/microsoft.dynamics.nav.management/import-navencryptionkey
    Microsoft Dynamics NAV uses a single encryption key per server instance.

    if you did all the above and it does not work, then I am not sure what is wrong.
    I would be really surprised if only one instance can be run per database.
  • mircenmircen Member Posts: 8
    Hi,

    when you create the first instance with database credentials, new key is generated and written in the database, so when you create new instance a new key is generated and written to database, because of this the first instance will stop because of missmatch key

    What should you do

    Delete the generated key from the second instance,
    Location of the key

    C:\ProgramData\Microsoft\Microsoft Dynamics NAV\100\Server\Keys

    Export the key from the first instance

    Export-NAVEncryptionKey -ServerInstance DynamicsNAV -KeyPath "C:\Keys\nav.key"

    Import exported key in the second instance
    You must provide database credentials in the -ApplicationDatabaseCredentials parameter

    $Credential = (New-Object PSCredential -ArgumentList ‘<your Azure SQL Database login name>‘,(ConvertTo-SecureString -AsPlainText -Force ‘<your password>‘))

    Import-NAVEncryptionKey -ServerInstance DynamicsNAV -ApplicationDatabaseServer <String>
    -ApplicationDatabaseCredentials $Credential -ApplicationDatabaseName <String> -KeyPath <String>


    Hope this will work

    BR,
    Mirce

  • aceXaceX Member Posts: 166
    Thank you @mircen that's the right solution :) . Part with credentials parameter was the key :) .

    Best Regards
    mircen wrote: »
    Hi,

    when you create the first instance with database credentials, new key is generated and written in the database, so when you create new instance a new key is generated and written to database, because of this the first instance will stop because of missmatch key

    What should you do

    Delete the generated key from the second instance,
    Location of the key

    C:\ProgramData\Microsoft\Microsoft Dynamics NAV\100\Server\Keys

    Export the key from the first instance

    Export-NAVEncryptionKey -ServerInstance DynamicsNAV -KeyPath "C:\Keys\nav.key"

    Import exported key in the second instance
    You must provide database credentials in the -ApplicationDatabaseCredentials parameter

    $Credential = (New-Object PSCredential -ArgumentList ‘<your Azure SQL Database login name>‘,(ConvertTo-SecureString -AsPlainText -Force ‘<your password>‘))

    Import-NAVEncryptionKey -ServerInstance DynamicsNAV -ApplicationDatabaseServer <String>
    -ApplicationDatabaseCredentials $Credential -ApplicationDatabaseName <String> -KeyPath <String>


    Hope this will work

    BR,
    Mirce

  • manikandanmanikandan Member Posts: 160
    Hi Mirce,
    When i am trying to import Key using below comments i am getting following error message .Please help me
    l1dnz5giwg7h.png

  • morfo8741morfo8741 Member Posts: 1
    Hi AceX
    can you send me your script, i have the same problem but dont works.

    thanks
    GER
  • KTA8KTA8 Member Posts: 398
    Do you know if this could be done in 2015?
  • aceXaceX Member Posts: 166
    Hi @morfo8741,

    The script for above is valid. I've contacted @mircen about the problem described here, and he answered that the steps will be:

    (If you have key for the first database)
    1. You need to copy the key from the file and name it like your new instance which will use your new database (DynamicsNAV100Example2).
    2. This must be done before you start the DynamicsNAV100Example2 service instance.

    The trick here is that you must to use the same key for other databases.

    Best Regards
Sign In or Register to comment.