In this article, we will create a Windows VM on the Azure Cloud platform and configure it to deploy Asp net Web application from VS 2019 remotely.
By the end of this article, we will have our local .NET MVC application up and running on Azure windows machine using Iaas Model.
- Microsoft free account and Azure Credits.
- Basic knowledge of using Azure Services and understanding of PaaS and IaaS models.
- VS 2019 with Azure development tools installed.
In this article, we will cover the following topics:
- Create and configure the Windows VM.
- Remotely access VM from our local machine.
- Install IIS and other services on VM.
- Deploy .NET MVC from VS 2019 to remote VM.
Step 1 – Create and configure windows VM
The account creation will require you to provide your credit/debit card details for validation. The first month of the Azure Subscription is free and you will not be automatically charged unless you upgrade your account manually.
The home screen will display all recently used Azure resources.
Under Virtual machines, click add new VM.
Resource Group is a logical grouping of resources.
Any Azure service is a resource.
The user can create a new resource group and select windows service 2019 Image for our VM configuration.
Configure admin user and specify log on password.
We can select the VM CPU Size and RAM Size and our cost will vary as per selected size.
Configure Disk type and Size
This is the OS Disk. Additionally, we can add a storage disk.
Configure the networking tab with the default setting and we are good to go:
Review Final changes and click on create. Our VM machine is deployed and ready for use in less than 5 min.
Step 2 – Remotely access VM from our local machine
Navigate to VM resource and click on connect and select RDP
Download the RDP file and using the admin account, log on to your VM.
Download and accept the security certificate:
Step 3 – Install IIS and other services on VM
Navigate to server Dashboard and click on add roles and features.
Select the IIS service and complete the setup.
Navigate to the IE browser on your server and type localhost and you could see the IIS service up and running.
Navigate to your local machine and type Public IP address of your server and you could notice you would not be able to reach to IIS service.
Web server listens on port 80.
We need to add Inbound port rule under the networking tab and enable port 80
Now navigate to the public IP address of your VM and you could access IIS remotely from your local machine.
Step 4 – Deploy .NET MVC from VS 2019 to remote VM
Navigate through Under Server Manager Dashboard launch adds roles and features and install the required version of .NET framework.
In order to able to deploy our application from VS to remote VM, we need to install Microsoft Web deploy 3.5 Installer on the server machine
We would also need to enable Management service and start the service as described below.
Under Server Manager Dashboard launch add roles and features, and Select Management service, then install it.
Under IIS and management services enable remote desktop and start the service.
This service listens on port 8172 so we need to add Inbound port rule under networking tab and enable port 8172
We have done all the required steps for set up. Now navigate through Visual Studio and right-click publish and select your Azure profile.
It should display our configured VM.
This required Azure development tools to be installed with VS 2019 installation.
Click on publish and your code would be deployed to Azure VM.
Using your DNS Name, the site can be accessed.
In this article, we have learned how to create, configure, and deploy .NET Apps to windows VM in Azure Cloud using the IaaS model.
Thanks a lot for reading. I hope you liked this article. Please share your valuable suggestions and feedback. Write in the comment box in case you have any questions. Have a good day!