Azure Application Deployment

«« Previous
Next »»

In this chapter, we will discuss different ways of deploying an application on Windows Azure. When we say application, it can be a web application or a mobile application. Earlier web apps were called websites, but now everywhere they are referred as web applications. We will be discussing how to deploy applications from Visual Studio and management portal in the chapter ‘Websites’.

Deploying a Web App from PowerShell


To get started with the PowerShell, refer to ‘PowerShell’ chapter in the tutorial. In order to deploy a website from PowerShell you will need the deployment package. You can get this from your website developers or you if you are into web deployment you would know about creating a deployment package. In the following sections, first you will learn how to create a deployment package in Visual Studio and then using PowerShell cmdlets, you will deploy the package on Azure.

Create a Deployment Package


Step 1 − Go to your website in Visual Studio.

Step 2 − Right-click on the name of the application in the solution explorer. Select ‘Publish’.


Step 3 − Create a new profile by selecting ‘New Profile’ from the dropdown. Enter the name of the profile. There might be different options in dropdown depending on if the websites are published before from the same computer.


Step 4 − On the next screen, choose ‘Web Deploy Package’ in Publish Method.


Step 5 − Choose a path to store the deployment package. Enter the name of site and click Next.


Step 6 − On the next screen, leave the defaults on and select ‘publish’.

After it’s done, inside the folder in your chosen location, you will find a zip file which is what you need during deployment.

Create a Website in Azure using PowerShell


Step 1 − Enter the following cmdlets to create a website. Replace the highlighted part. This command is going to create a website in free subscription. You can change the subscription after the website is created.

New-AzureWebsite -name "mydeploymentdemo" -location "East US" 


If cmdlet is successful, you will see all the information as shown in the above image. You can see the URL of your website as in this example it is mydeploymentdemo.azurewebsites.net.

Step 2 − You can visit the URL to make sure everything has gone right.

Deploy Website using Deployment Package


Once the website is created in Azure, you just need to copy your website’s code. Create the zip folder (deployment package) in your local computer.

Step 1 − Enter the following cmdlets to deploy your website.

Publish-AzureWebsiteProject -name "mydeploymentdemo" -package 
"C:\Users\Sahil\Desktop\deploymentDemo\MyWebsiteOnAzure.zip" 

Here in above commandlet, the name of the website just created is given and the path of the zip file on the computer.

Step 2 − Go to your website’s URL. You can see the website as shown in the following image.



«« Previous
Next »»

0 comments:

Post a Comment