I would like to keep a diary to ensure that my exercises are not in vain.
Currently, I am learning ASP.NET, and today I made significant progress by understanding how to host my apps on the internet. So far, I've been experimenting with local applications on my laptop, but I had no idea how to publish them on the internet.
After exploring Azure, I decided to try out this platform. Therefore, I created an account and received a €200 voucher. This should be sufficient for my experiments.
The first tutorial covered deploying an ASP.NET application without databases using Visual Studio. It turned out to be surprisingly simple. Through the project's context menu in the explorer, I selected the "Publish" option and then signed in to Azure using a wizard. And just like that, the website was online. I didn't have to perform any complex manipulations in the Azure-CLI or Azure Portal.
[Tutorial Link]
In the next tutorial, I learned about deploying an ASP.NET application with a SQL database connection. This required more steps.
- First, we prepared a Resource Group and a database. A special wizard in Azure (Web App + Database in the Marketplace) helped us set up all the necessary resources.
- Next, the new App Service provided us with a ConnectionString to access the database.
- Then, I deployed an application from GitHub. This was an entirely new approach for me. Azure's Deployment Center connected to the GitHub repository and tracked all changes. In this process, we had to use the new ConnectionString and continue the migration. I also learned that with GitHub, you can edit content using the browser-based Visual Studio Code. So, I edited the appsettings.json file and a workflow YAML file, and all changes were instantly reflected in Azure.
- We now had a functional web application, but the database lacked structure, no schema. I resolved this by SSH into the Azure Portal, starting a terminal, and performing a migration. [Tutorial Link]
At the end, my application was up and running, and the data was successfully stored in the database.
I believe that if I have a simple app, I can configure the ConnectionString on the local host. Instead of migrations, one could also utilize a script for the database. Nevertheless, I'm glad I delved into this complex process, including YAML and Git. While it might be challenging at the beginning, once you grasp the mechanics, everything works smoothly and becomes an invaluable skill.
Tomorrow, I will attempt to repeat everything using Azure CLI.
Top comments (0)