Publishing to Azure

One of the reasons why we went all in with Azure is its simplicity and reliability. Another reason is the integration with Visual Studio. The reason why we went all in with Blazor is that it offers a one-stop shop for writing web applications. You no longer need a separate process for building/transpiling your Javascript files. The fact that there is a language (Typescript, Coffeescript) on top of another language (Javascript) to address the inadequacies of the first language is a ludicrous concept. Not to mention the inefficiency and error prone process such an environment invites. But I digress again. Blazor is great because with the right UI library like Blazorise, you can focus on writing your application instead of debugging why your Javascript pipeline is broken.

Publishing your new project to Azure could not be simpler:

  • Create a new MS SQL database in Azure.
  • Ensure that the appsettings.Production.json file has the appropriate production values, including the database connection string. Ensure that the connection string has MultipleActiveResultSets=True, otherwise some operations will not work.
  • Open the Package Manager Console and type $env:ASPNETCORE_ENVIRONMENT = 'Production'. Then run update-database. This will create your tables in your production database. If in the future you add migrations, you will run this same command, which will make the necessary database changes. When you are done, $env:ASPNETCORE_ENVIRONMENT = 'Development', to set your environment back to Development. Be very careful with this in the future, because you could be inadvertently be running against he production database.
  • Right click on the project in the solution explorer and select Publish....
  • Specify Azure as the target and click next.
  • Select Azure App Service (Windows) as the target and click Next.
  • If you do not already have an Azure resource group created, visit the Azure Portal to create one.
  • Select the resource group and click on Create a new Azure App Service.... Fill out the information about the new service and click Create.
  • Once created, the dialog will close and then you click on Finish.
  • Then click Publish. Once the publish process is complete, your browser will open with the new page. If everything there looks good and you are able to log in as the admin user, you are good to go!

Table of Contents



An error has occurred. This application may no longer respond until reloaded. Reload 🗙