Skip to main content

Some deployment methods of a web application on Windows Azure

With the new version of Windows Azure we can publish web-sites on Windows Azure more easily. This new features can be used with Visual Studio 2010 also, not only with the new Visual Studio 2012 (current version is RC).
The classic deploy, using a deploy package or from the Azure project from Visual Studio remained unchanged. The new features help us a lot when we want to publish a new version (update) of web-site without recreated the web-role. In the old version of Windows Azure, this could be done, but there were a lot of configuration that need to be done on the solution.
Let see how we can publish a web-site very easily using the new features. I assume that you already have a Windows Azure account and a Windows Azure Deployment Project added to your current solution.
When you first time want to publish the web application you will need to configure the account credentials. The main different from the old version is the option to download the credentials information from Windows Azure Portal. At this first step you will find a URL that will redirect you to the page where from credentials can be downloaded. This information will be saved on your computer. Use the “Import” button to import all this information. After you make this configuration you are ready to deploy the application. No more copy/paste the subscription ID, user, and password and so on. This is one of the think that I hated more, the 1st time configuration of the Windows Azure Deploy Project.
Don’t forget to have a storage account configured also. It will be used to the deployment process. After the deploy ends, the package is automatically removed from the storage. I recommend having two instances because when an upgrade is made, the web application will be down. But with the new upgrade mechanism deploy can be made only in few seconds.
If you want, the wizard gives us the possibility to select a specific storage account or to have a custom label for the given deployment and so on. At this step, if you want to allow upgrades of your application, you need to select the “Enable deployment upgrade”.
Another very fast deployment process is the web deploys functionality. There are some very important things that you should know about this type of publish:
  • A web deploy can be made only to the web role. You will not be able to upgrade a worker role for instance. Because this process use a feature that can be found on the IIS
  • Use this deployment method when you are on the development process or testing. But never on a production environment as a deployment step. Because if the web role instances crash, the image that will be used to redeploy the package will be original one, not the one from the upgrade. This feature can be used for hot fixes in production if we cannot make a normal deploy, but we need to be very careful with it.
  • The remote desktop connection need to be activated on the web role.
  • This deployment can be done only when we have only one web role per web application. If for example we have 10 web role for a given application, that this deploy method cannot be used. Because Visual Studio should connect to each web role and make the upgrade.
  • Only the file that was changed is uploaded to the web role. For example if we have 10 html file, and only one file is changed, than that file will be the only file that is uploaded to the worker role.
After we configure the web deploy mechanism the only thing that you need to do is to right click on the web project and click “Publish”. If is the first type when you do this you will need to select the username, password and also the publish profile. You could have project with more than one publish profile (eq.: production, testing, development).
Let see how we can configure the web deploy. First of all you need to have the Remote Desktop connection activated. The same thing is required to make an upgrade. After that when you deploy your web role you need to select “Enable Web Deploy”. After that, when you will make a deploy, the web roles will have this options activated and you will be able to make the publish in only few seconds.
The web publish process goes on HTTP by default. If you want to have a secure connection (using HTTPS) you will need use a certificate from Windows Azure portal. I recommend creating on your machine a certificate for this purpose and uploaded it to the portal.
The default way to add this certificate is too remote connects to each machine and add the corticated to the IIS. Another solution is to add the certificate to the Azure project. To do this you will need to add the following lines of code to your “ServiceDefinition.csdef” from Azure project:
<Certificates>
<Certificate name="myProject" storeLocation="CurrentUser" storeName="My" />
</Certificates>
Next, in the *.cscfg file you will need a node for your defined certificate under the web role node with the thumbprint of your certificate:
<Certificates>
<Certificate name="myProject" thumbprint="17485124E04D8E64B1044F5BB43FEEDF431B5B32" thumbprintAlgorithm="sha1" />
...
</Certificates>
This certificate needs to be installed on your machine. The store name represents the location where certificate can be found. This configuration can be made from the UI, if you open your web role under the Roles directory from the Azure project and select the “Certificates” tab.
You can also make a web deploy using FTP. When you want to make a publish, you need to select the FTP publish method instated of web deploy.
There are a lot of methods to publish a web application to the cloud. You need to choose the best one for you and for your project.

Comments

  1. Your style is unique in comparison to other
    folks I have read stuff from. Many thanks for posting when you have the
    opportunity, Guess I'll just bookmark this blog.
    Feel free to visit my web blog ... free sites

    ReplyDelete

Post a Comment

Popular posts from this blog

Windows Docker Containers can make WIN32 API calls, use COM and ASP.NET WebForms

After the last post , I received two interesting questions related to Docker and Windows. People were interested if we do Win32 API calls from a Docker container and if there is support for COM. WIN32 Support To test calls to WIN32 API, let’s try to populate SYSTEM_INFO class. [StructLayout(LayoutKind.Sequential)] public struct SYSTEM_INFO { public uint dwOemId; public uint dwPageSize; public uint lpMinimumApplicationAddress; public uint lpMaximumApplicationAddress; public uint dwActiveProcessorMask; public uint dwNumberOfProcessors; public uint dwProcessorType; public uint dwAllocationGranularity; public uint dwProcessorLevel; public uint dwProcessorRevision; } ... [DllImport("kernel32")] static extern void GetSystemInfo(ref SYSTEM_INFO pSI); ... SYSTEM_INFO pSI = new SYSTEM_INFO(...

How to audit an Azure Cosmos DB

In this post, we will talk about how we can audit an Azure Cosmos DB database. Before jumping into the problem let us define the business requirement: As an Administrator I want to be able to audit all changes that were done to specific collection inside my Azure Cosmos DB. The requirement is simple, but can be a little tricky to implement fully. First of all when you are using Azure Cosmos DB or any other storage solution there are 99% odds that you’ll have more than one system that writes data to it. This means that you have or not have control on the systems that are doing any create/update/delete operations. Solution 1: Diagnostic Logs Cosmos DB allows us activate diagnostics logs and stream the output a storage account for achieving to other systems like Event Hub or Log Analytics. This would allow us to have information related to who, when, what, response code and how the access operation to our Cosmos DB was done. Beside this there is a field that specifies what was th...

Cloud Myths: Cloud is Cheaper (Pill 1 of 5 / Cloud Pills)

Cloud Myths: Cloud is Cheaper (Pill 1 of 5 / Cloud Pills) The idea that moving to the cloud reduces the costs is a common misconception. The cloud infrastructure provides flexibility, scalability, and better CAPEX, but it does not guarantee lower costs without proper optimisation and management of the cloud services and infrastructure. Idle and unused resources, overprovisioning, oversize databases, and unnecessary data transfer can increase running costs. The regional pricing mode, multi-cloud complexity, and cost variety add extra complexity to the cost function. Cloud adoption without a cost governance strategy can result in unexpected expenses. Improper usage, combined with a pay-as-you-go model, can result in a nightmare for business stakeholders who cannot track and manage the monthly costs. Cloud-native services such as AI services, managed databases, and analytics platforms are powerful, provide out-of-the-shelve capabilities, and increase business agility and innovation. H...