Issue with deploying to Azure App Service from Visual Studio

S1T2 Developer asked on October 28, 2019 07:34

Hi all,

I am trying to deploy my Kentico site to Azure through Visual Studio as a little teaser of what is to come down the line with real deployment.

I first created an empty database (and db server) through Azure. I am able to connect to this through Microsoft SQL Server Management Studio 18. From here the user that I created at the time of making the db server has full access to create tables etc...seems like there is no issue.

I have changed the db connection string in web.config with the string straight out of azure database dashboard.

I also tried this string format from a kentico tutorial as it appears slightly different to the one from the dashboard...

<connectionStrings>
    <add name="CMSConnectionString" connectionString="Server=DATABASE_SERVER.database.windows.net;Database=DATABASE_NAME;User ID=DB_SERVER_USER_NAME;Password=DB_SERVER_PASSWORD;Trusted_Connection=False;Encrypt=True;Connection Timeout=120" />
</connectionStrings>

I then go to publish the app from Visual studio, create a new app service and connect to the existing db.

This is the error I am getting after I publish from Visual Studio...

Cannot access the database specified by the 'CMSConnectionString' connection string. Please install the database externally and set a correct connection string.

Alternatively, you can use web.config key CMSWaitForDatabaseAvailable or set property CMSApplication.WaitForDatabaseAvailable prior to the API initialization to let the application intentionally wait until the database is ready.

Interestingly, when I change the password in the connection string (making it incorrect), it spits out this message:

Login failed for user 's1t2'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: CMS.DataEngine.ApplicationInitException: Login failed for user 's1t2'.

This makes it seem like the login credentials are working to some extend when I am receiving the CMSConnectionString error...

Thanks in advance for any help

   Please, sign in to be able to submit a new answer.