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

Recent Answers


Mike McDermot answered on October 10, 2020 23:06

Any update on this issue? I am trying to 'refresh' my lower UAT and QA environments via an export/import of the production database (Kentico 12sp). I was able to do this ~4 months ago without issue, now when I follow the exact same steps I see the error above.

When I go to the CMS desk, it thinks I don't have a database and tries to walk me through the creating a new DB instance (/cmsinstall/install.aspx), but doesn't let me 'uncheck' the 'Create Kentico database objects' checkbox...it's disabled.

When I change the password by 1 character I too get the Login failed message.

I tried changing the conn string from my db_reader/writer user to the Azure SQL admin user, and still same problem.

Lastly, I triple checked my SQL Login and User records and passwords and even ran the AzureSQLConnectivityCheckerResults script recommended by the Azure SQL troubleshooter dialog.

When I restore the backup to my local dev machine, I'm able to connect fine.

I can't figure out if this is an Azure SQL issue, or a Kentico issue...

0 votesVote for this answer Mark as a Correct answer

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