Demo Script - Publishing Cloud Apps

advertisement
Demo Script
Publishing Cloud Applications with Visual Studio
Version:
1.0.0
Last updated:
2/6/2016
CONTENTS
OVERVIEW ................................................................................................................................................... 3
Key Messages ........................................................................................................................................... 3
Key Technologies ...................................................................................................................................... 4
Time Estimates ......................................................................................................................................... 4
SETUP AND CONFIGURATION .................................................................................................................. 4
DEMO FLOW ................................................................................................................................................ 5
OPENING STATEMENT............................................................................................................................... 5
STEP-BY-STEP WALKTHROUGH .............................................................................................................. 6
Deploying the Hello Windows Azure application....................................................................................... 6
SUMMARY .................................................................................................................................................. 13
KNOWN ISSUES ........................................................................................................................................ 13
Overview
Until recently, the deployment of an application to Windows Azure, required several manual steps in the Windows Azure Management Portal.
Now, inside Visual Studio, we can use the Publish Wizard to quickly deploy a Cloud Application without requiring a developer to have previously
created a Hosted Service or a storage account. In this demo you will see:

Adding a Windows Azure deployment project to a Web project.

Automatically setting up the appropriate management credentials (you no longer need to manually create/manage a certificate).

Select the subscription you want to use when doing a publish (making it easier to use multiple subscriptions within Visual Studio).

Creating new hosted services within VS (no need to ever visit the portal to set this up).

Creating and configuring appropriate storage accounts (you no longer need to do this manually).

Enable Remote Desktop workflow (just click a checkbox and provide a username/password – no need to create or upload a certificate).

Leveraging in-place upgrade functionality (by default redeploying in VS will do an in-place update – which will make single instance
deployments faster).

Managing multiple deployment environment configurations.
Note: In order to run through this complete demo, you must have network connectivity and a Windows Azure account.
Key Messages
In this demo you will see three key things:
1. First you will see how the Windows Azure SDK and Visual Studio Tools for Windows Azure provide development tools to configure and
perform deployments to Windows Azure.
2. Second, you will update the published application using Web Deploy.
3. And third, you will re-deploy the Cloud Application to the Production environment to upgrade the Cloud Application package.
Key Technologies
This demo uses the following technologies:
1. .NET Framework 4.0
2. Visual Studio 2010
3. ASP.NET MVC 3
4. Windows Azure SDK and Windows Azure Tools for Microsoft Visual Studio
Time Estimates

Estimated time for setting up and configuring the demo: 10 min

Estimated time to complete the demo: 15 min
Setup and Configuration
This demo does not have any advanced configuration requirements. Make sure you have checked all the dependencies for this demo and have a
developer account for Windows Azure.
Demo Flow
The following diagram illustrates the high-level flow for this demo and the steps involved:
Figure 1
Demo Flow
Opening Statement
In the next 5 minutes, we will build and deploy a simple ASP.NET Application using Windows Azure Tools for Visual Studio. I want to show you a
simple demo to use the Publish Workflow within Visual Studio and configure it to deploy our Cloud Applications to Windows Azure. If we use the
Windows Azure Management Portal, we have to create a storage account, a hosted service, upload certificates to enable Remote Desktop, etc.
Using the Publish Wizard, we can perform all of these steps within Visual Studio, without requiring a developer to access the Management
Portal. In addition, I will introduce you the concept of Profiles, which allows us to save the Wizard settings to reuse them in future deployments,
greatly improving deployment configuration times. Last, we will perform a Web Deploy to update our published application.
Step-by-Step Walkthrough
Deploying the Hello Windows Azure application
Action
Script
1. Start Visual Studio 2010 as
Administrator user.

Let us launch Visual Studio 2010 and
create a new project.
2. Select File -> New -> Project.

3. Select the C# ASP.NET MVC 3
template. Name the solution
HelloAzureWeb and click OK.
We will create a new ASP.NET MVC
3 application using the Intranet
template.

Now, we will add an Azure
Deployment project to it. This will
automatically create a Cloud Project
to our solution.
4. Select the Internet template option
and click OK.
5. Wait for the new solution to be
created.
6. Right-click the HelloAzureWeb
project node and select Add
Windows Azure Deployment
Screenshot
Project.
7. Wait for the new project to be
created.
8. Right-click the
HelloAzureWeb.Azure project and
select Publish.

I will show you how to publish this
MVC application using Visual Studio
only.
9. In the Publish Windows Azure
Application Wizard, click the link
Sign in to download credentials.

Right-click the Cloud Project and
select Publish.

The Publish Wizard walks me through
all the necessary steps to publish an
application to Windows Azure. I will
show you how to create a Hosted
Service and a storage account within
Visual Studio.

I will download the Management
Credentials by clicking the link and
login in using my Live Id credentials.
A settings file is generated which
includes the information required to
publish my application. I’ll import this
file to the Wizard.

I select my subscription from the list
and go to the next page.

In this page, you can choose the
common settings for the deployment.
I will create a new hosted service
selection the Create New option from
the list.

Let’s set the Hosted Service name as
HelloAzure.

I will deploy the application to the
Staging environment.

Also, we will enable the Remote
Desktop and Web Deploy. We will
use this to perform a quick upgrade to
our application after we publish it.
10. A browser opens in the Live Id login
page. Enter your credentials.
11. Download the settings file to a known
location. You will use this file in the
next step.
12. Back to Visual Studio, click the
Import button and select the file you
downloaded in the previous step.
13. From the drop-down list, select your
subscription name. Click Next.
14. In the Hosted Service drop-down list,
select <Create New>.
15. Set the Hosted Service name
HelloAzurePublish. Select a region
and click OK.
16. Select Staging from the
Environment drop-down list.
17. Check the Enable Remote Desktop
for all roles checkbox. When the
dialog opens, enter a username and
password and click OK. Take note of
the username as you will use it in the
following steps.
18. Check the Enable Web Deploy for
all web roles checkbox.
19. Click the Advanced Settings tab.
20. Set the Deployment Label to
HelloAzurePublishing.

Here we can set some advanced
settings for the deployment. Let’s
change the deployment label and
create a new storage account
associated to this Hosted Service.

In the last page of the Wizard, we can
manage our Profiles. A Profile is a
group of settings that can be reused
in future deployments. Instead of
configuring all the settings of the
wizard again, a Profile automatically
fills all the values that you used for a
previous deployment. You can modify
and create new Profiles by clicking
the Manage option in the Profiles list.
21. In the Storage Account drop-down
list, select <Create New>.
22. Set the Storage Name to
HelloAzureStorage and enter a
region. Click OK.
23. Click Next.
24. Click the Save icon to save a Profile.
25. Click Publish to start the deployment.

While we wait for the application to be
published to Azure, we’ll change the
Home page to show a different
message.

Let’s change the text to “Hello Azure.
Updated using Web Deploy.”

Now we wait until the deployment is
finished. We can see its progress
using the Azure Activity Log.
30. Wait until the deployment is
completed.

Let’s browse our deployed
application.
31. In the Windows Azure Activity Log,
click the Website URL link.

Take a look at the home page. We’ll
update this text and re-deploy the
change using Web Deploy. The Web
Deploy is a quick deployment feature
that doesn’t require recreating the
Hosted Service again.
26. While the Visual Studio deploys the
application, open the Index.cshtml
file, located under the Views/Home
folder of the HelloAzureWeb MVC 3
project.
27. Replace the text inside the <p> tag to
Hello Azure. Updated using Web
Deploy.
<p>
Hello Azure. Updated using
Web Deploy.
</p>
28. From the Menu, select View, Other
Windows and click on Windows
Azure Activity Log.
29. Expand the current deployment
details by clicking the left arrow.
32. Highlight the original Home page text.
33. Back to Visual Studio, right-click the
HelloAzureWeb project node and
select Publish.
34. Enter the same credentials you used
to set up the Remote Desktop in the
Publish Wizard. Click Publish.

Back in Visual Studio, I’ll deploy the
change we did to the Home page to
our recently published Hosted
Service.

You can see that the Web Deploy
dialog is already filled with our Hosted
Service information. I have to enter
the same credentials we used to set
up the Remote Desktop for our
Hosted Service. I’ll leave the rest of
the fields as they are and go ahead
and publish the application.

You can see the difference in time
using Web Deploy against publishing
again the application. Now, our Home
page was updated in only a few
moments.
35. Wait until the publishing is
successfully deployed.
36. Go back to the deployed application
in Internet Explorer and press F5 to
refresh the page. You will see the
updated text in the Home page.
37. In Visual Studio, right –click the
HelloAzureWeb.Azure cloud project
and select Publish.

The Web Deploy scenario is very
useful when we are developing an
application and want to see quick
updates in our staging environment.
But when an Azure virtual machine is
restored, by example using the
Reimage option in the Azure
Management Portal, our Hosted
Service uses the original uploaded
package to start the application. This
means that our changes made with
Web Deploy are lost.

In order to prevent this, we have to
redeploy our package using the
Publish Wizard again.

When it opens the Wizard shows us
the previous profile we created for our
first deployment. Let’s create a copy
of it and modify it to point to a
Production Environment.

Let’s go back to the previous page
and change the Environment to
Production. And we continue to the
end of the Wizard and save the
changes to the profile.

I click the Publish button and the
application will be deployed in the
Production environment.

As you saw in this demo, using the
Publish Wizard we simplified most of
the steps required to publish a Cloud
Application to Windows Azure.
38. In the Publish Wizard, open the
Profiles drop-down list and select
Manage.
39. Select the existing profile and click
Create Copy.
40. Select the new profile and click
Rename. Set its name to
HelloAzurePublishProduction.
Click OK and click Close.
41. Select the new profile from the
Target Profile drop-down list.
42. Click Previous.
43. Change the Environment and set it
to Production.
44. Click Next.
45. Click the Save icon to save the
changes to the profile.
46. Click Publish. If a confirmation dialog
appears, click Replace to replace the
current deployment with the new one.
47. Wait for the application to be
deployed.
48. In the Windows Azure Activity log,
click the Website URL link.
49. In Internet Explorer, show the new
URL and that the changes to the
Home page are still there.
Summary
In this demo, you saw how we could easily deploy a Web Application using Visual Studio. The Publish Wizard simplifies most of the steps
required to publish an application, such as creating a new Hosted Service or setting up our credentials to use Remote Desktop. You also saw how
to enable Web Deploy to update your applications in a faster approach.
Known Issues
Please note the following known issues with this demo:

It can sometimes take several minutes to start a Windows Azure application in the cloud. Consequently, you may want to have an
example application already deployed and running in the production environment.
Download