Application deployment on Azure using Visual Studio
Pre-requisites
The following are the list of things required before going ahead with Azure deployment.
a. Azure Subscription
b. Type of deployment – Web site or Cloud service
c. Storage account as per requirement
Azure Subscription is required to work with Azure. Using Azure subscription, you will be able to create and manage user applications using different Azure Services. Storage account provides access to Azure services like Blob, Queue and Table services.
As the title suggests, this document is going to talk about deploying applications on Azure using Visual Studio.
Deployment of Cloud Service
https://whitehedge.wpcomstaging.com/wp-admin/edit-comments.php
To publish a cloud service to Azure, we should first create a cloud service, which runs your roles in the Azure environment. We can create a cloud service by using Visual Studio.
When you proceed to create a new cloud service project for your solution, you are then required to choose the appropriate role(s).
As you can see, there are 4 types of roles that can be chosen for your project. The basic types of roles are Web Role and Worker Role. To quickly understand these roles, read the brief description below each type in the above snapshot. This will help us to decide which roles are to be used in project. In other words, web role would require IIS to be available on the Virtual Machine (VM) whereas worker role will not require an IIS as it would typically be running background processes.
Once the appropriate role is chosen, it will show on the right-side pane. You may want to rename it by click on it and choosing Rename option. Click OK button to proceed. This will create a project with cloud service and another project for your renamed role.
Since we are talking about deploying on Azure, we will skip the points about coding for such roles. Once the code is ready, the application in Visual Studio can be deployed using two options – package or publish.
The package option will create three files –
a. one service definition file (servicedefinition.csdef)
b. one service configuration file and (servicedefinition.cscfg)
c. one service package file (servicedefinition.cspkg)
To deploy cloud service, right-click on the cloud service project and choose Package option. If you are doing this for the first time, then you need to set the correct options. The following screen was shown –
In order to give access to roles, one needs to click on Enable Remote Desktop for all roles check box. If this is being done for the first time, then following dialog will appear –
You need to specify the credentials who would access to remotely connect to the server.
Once the package is ready, it needs to be uploaded on the Azure web site. For this, you need to follow the steps as shown below –
The package will create VM with IIS in it if the configuration contains a web role.
If the package contains only a worker role, then a single VM will be hosted with the worker project running on that VM. In order to update the functionality
later, we need to go through the cycle of build – package – upload – deploy on Azure account.
Deployment of Website:
To deploy website to Azure, first we need to create app service using Azure subscription.
After creating app service in Azure, you can directly publish your web application to Azure using App service as below –
- Right click the web application and select publish option.
- From publish dialog box, select publish to Azure.
- Provide the valid credentials of your Azure subscription.
- Enter the URL of App service to which your application is hosting.
- After successful publish, access the web application using app service URL.