Geeks With Blogs

Shervin Shakibi's Blog blog

 

I wanted to have a VM that I could access remotely and thought why not take advantage of the VM role. So I just documented my steps, for those of you might be interested, but more importantly for myself, if I have to do this again.

the server image that is used for the VM role in windows Azure consists of a base VHD and may or may not have differencing VHD. to create the base VHD you can use Hyper-V Manager.

Creating the Base VM image

  1. In Hyper-V manager connect to your server , right-click the server name
  2. Point to New, and then select Virtual Machine.
  3. Click Next at the welcome screen to start the New Virtual Machine Wizard.
  4. Give your VM a name and press Next.
  5. Assign Memory size, I am going to go with 4096, you should use minimum of 2048 to have a halfway decent performance.
  6. For your network select an external connection that has been configured, if you do not have any connections in the drop down please refer to http://technet.microsoft.com/en-us/library/ee247420(WS.10).aspx
  7. Now, in the Connect Virtual Disk step, select the option labeled Create a virtual hard disk. Set the Name of the disk to baseimage.vhd, change the location to a suitable folder in your Hyper-V server, set the disk Size to 30GB, and then click Next to continue. the size must fit the quota allocated for the chosen VM size for your role. In this case, setting the size to 30GB allows you to deploy the VM in a small Role.
    1. If you already have a VHD file with a clean installation of Windows Server 2008 R2, you may use that instead. To do this, select the option labeled Use an existing virtual hard disk and browse to the location of the VHD file. Note that the image file must contain a single partition with the OS installation and must not include a recovery partition.
  8. Select the Operating system, you can do this using a dvd, .iso image or other options, or selecting another image that already has the operating System.
  9. Press Next , review the settings and press Finish
  10. In the toolbar of the Virtual Machine Connection window, click the Start icon.
  11. after you connect you proceed with the installation of your operating system.

  12. The only special requirement for a valid VM Role image is to allocate the entire virtual hard disk file to a single partition where you install the operating system. To avoid creating a recovery partition during the installation, follow these steps:

    • Choose the Custom (advanced) installation type to select the partition where you will install Windows.
    • Press Shift + F10 to open a command prompt during GUI-mode setup.
    • At the command prompt, enter the following commands:

      diskpart
      select disk 0
      create partition primary
      exit
      Close the command prompt window.

    • Install Windows in the newly created partition.

Preparing the base VM Image for Deployment

Now we need to install all the components required for deployment to windows Azure.

  1. In Server manager click on add Roles and select webserver (IIS). press next and take all the default options and click on Install.
  2. Add Features , and select .Net Framework 3.5.1
  3. Open Windows update Control Panel from Start –> All Programs –> windows Update
    • Click on Change Settings link and then select Never Check For Updates (not recommended)
    • Click on Check for updates and install all available updates

Install windows Azure Integration component

    1. In the Virtual Machine Connection window, in the Media menu, point to DVD Drive and then select Insert Disk. In the Open dialog, browse to the location of the ISO file for the VM Role Integration Components, wavmroleic.iso, and then click Open. You can find this ISO in Windows Azure SDK folder ({drive}\Program Files\Windows Azure SDK\{version}\iso
    2. After you connect AutoPlay dialog will appear and then click Open Folder to view files using windows Explorer. If AutoPlay is disabled, use windows explorer and navigate to the newly created DVD Drive.
      • launch WaIntegrationComponents-x64.msi.
      • Press Next
      • Enter Administrator Password and press Next
      • Click on Install.
    3. When prompted to install device software, click Install to proceed.
    4. When prompted to restart the System, click Yes to continue.
    5. Wait for the system to restart and log in to the guest machine once again.
    6. Now, inside the VM, open the Start menu, type %windir%\system32\sysprep\sysprep.exe and then press Enter to launch the System Preparation Tool.
      • Set the System Cleanup Action to “Enter System Out-of-Box Experience (OOBE)”
      • Check the option labeled Generalize
      • Set the Shutdown Options to Shutdown, and then press OK. (Sysprep.exe) prepares the image by cleaning up various user and machine settings and log files, as well as removing any hardware-dependent information.
    7. Wait for system completely shut down.

Uploading the VM Disk image to Windows Azure

  1. Open a Windows Azure SDK Command Prompt as an administrator from Start –> All Programs –> Windows Azure SDK v1.x.
    • Before you can continue you want to make sure you have

    • Your subscription ID

    • Thumbprint of the certificate you have uploaded to learn how you can create a certificate and upload it to Azure manged certificates see(http://msdn.microsoft.com/en-us/library/gg432987.aspx)

    • Path to VHD File created earlier using Hyper-V Manager

    • Hosted Service location(choose, “East Asia”, “North Central US”, “North Europe”, “South Central US”, “Southeast Asia”, “West Europe”)

    • In Windows Azure Command Prompt execute the following command

csupload Add-VMImage -Connection "SubscriptionId={YourSubscriptionID};
 CertificateThumbprint={YourThumbPrint}-Description "Base image Windows Server 2008 R2" –LiteralPath 
"{PathToVHDFIle" -Name baseimage.vhd -Location {HostedServiceLocation}

Press Enter to start execution.

  1. In the Windows Azure VHD Verification Tool dialog, click OK to allow the VHD to be mounted. If the AutoPlay dialog appears, close it.

    5cf79665-981e-4bee-b3b2-73d6619be5b9

  2. The tool will prepare and create a new blob to hold the image file and then begins to upload the compressed image to your windows Azure account.

  3. In Hosted Services,Storage Accounts & CDN tab of Azure’s Management Portal you should see Pending under your VM Images.

  4. Depending on your Internet connection it might take hours for the image to get uploaded, which at that point the status will be changed to committed.

  5. Start Visual Studio

    1. Create a New Windows Azure Project (Language does not matter, but make sure Create directory for solution, is checked. Click OK.

    2. New Windows Azure Project click OK. No need to add any roles.

    3. Right click on Roles –> Add –> New Virtual Machine Role.

      1. If you have used Visual Studio previously to deploy service packages to Windows Azure, you may already have created the required credentials. For instructions on how to do this, see Appendix A - Configuring your Windows Azure Management Portal Credentials in Visual Studio.

      2. Once you configure the credentials, choose them in the drop down list labeled Select or create your Windows Azure account credentials. After you do this, Visual Studio accesses your subscription and retrieves a list of available virtual machine images.

      3. Expand the drop down list labeled Select VHD and choose the image named baseimage.vhd, which contains the installation of Window Server 2008 R2 Enterprise Edition that you uploaded earlier.
    4. Click on the Endpoints tab, then click Add Endpoint

        • Name = HttpIn

        • Type = Input

        • Protocol = htttp

        • Public Port = 80

        • Private Port = 80

    5. Configure the Remote Desktop connections for your Role, by right-clicking on your cloud service project, in Solution Explorer and select Package.

      • In Package Windows Azure Application dialog box, click Configure Remote Desktop connections.

      • Check the option labeled Enabled connections for all roles.

      • Expand the drop down list labeled Create or select a certificate to encrypt the user credentials and select Create.

      • In the Create Certificate dialog, enter a name to identify the certificate,  and then click OK.

      • In the Remote Desktop Configuration dialog, select the certificate from the drop down list, enter the name a  user and password,

        you may change the expiration Date.

      • Click on View, in the Details tab click on Copy to File, follow the wizard to export the certificate to a file, make sure that you check Export the private key. Save the file, the file will be uploaded to management portal later and press OK.

      • Click on Package, be patient this will take a few minutes.

Creating the Hosted Service and Deploying the package

    1. In Management Portal –select Hosted Services under the Hosted Services, Storage Accounts & CDN.
    2. Click on New Hosted Service.
      • Enter a service Name
      • Enter URL prefix for your service
      • Select a region or affinity group
      • select Do not deploy.
    3. Expand the node for your hosted service to display and select the certificates and click on Add Certificate.
      • Browse to the location of the certificate file and provide the password.
    4. Select your service then click on the New Production Deployment.
      • Provide a name, good name would be a version number like v1.0
      • Browse locally to the  package file (.cspkg) file created by Visual Studio
      • Browse locally to the configuration (.cscfg) file created by Visual Studio.
    5. You can monitor the status of your deployment.
Posted on Tuesday, November 1, 2011 8:59 AM | Back to top


Comments on this post: Creating a Windows Azure VM Role

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
In the Windows Azure VHD Verification Tool dialog, click OK to allow the VHD to be mounted. If the AutoPlay dialog appears, close it.
Left by pheromones on Nov 27, 2011 11:12 AM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
after you connect you proceed with the installation of your operating system.
Left by gout remedies on Nov 27, 2011 11:13 AM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
It looks quite effective.I will try my best to implement it and i hope it will bring the best for me.
Left by EPDM Coatings on Dec 30, 2011 2:37 AM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
Seems quite nice. Let me test it to my sites.
Left by EPDM Coatings on Dec 31, 2011 12:54 AM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
I Think I am mildly in love and ready to build my life upon my dreams and my emotional and physical readiness to face the best opportunities.
thank you dear and all the best in 2012
Left by projekty tanich domow on Dec 31, 2011 1:23 PM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
Web roles in Windows Azure are special purpose, and provide a dedicated Internet Information Services (IIS) web-server used for hosting front-end web applications.
Left by Slots Canada on Jan 03, 2012 6:51 AM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
Seems quite nice. Let me test it to my sites.
Left by Hotel in Florence on Feb 20, 2012 8:31 AM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
Quite helpful tips added bu you here regarding installation & connection to virtual machine. Thanks for sharing such nice information.
Left by custom swimming pools on Feb 26, 2012 6:42 AM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
This post is quite interesting and I really never get an fair information until I visit this great post.
Left by pwnone on Feb 28, 2012 1:39 AM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
Awesome info. Thanks for sharing.

Bed Bug Control Toronto
Left by Pest Control Toronto on Mar 11, 2012 1:29 PM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
Very helpful article thank you!
Left by υγραεριοκινηση on Apr 18, 2012 12:24 PM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
The post is very informative. I think it will be helpful for me in future. Thank you very much!
Left by online scratchcards on May 03, 2012 8:44 AM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
Thanks a lot for this tutorial. It seems a little complicated but very interesting at the same time.
Left by Click on Aug 14, 2012 1:39 PM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
This looks very complex article
Left by Melissa on Oct 06, 2012 3:09 PM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
It is not easy I give you that but the presentation was rather good for me to work out these scheme.
Left by Diamond Lift Romania on Mar 13, 2013 11:19 AM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
Wonderful article, thanks for sharing!

Best Condoms Canada
Left by Select Condoms on Apr 06, 2013 2:59 AM

# re: Creating a Windows Azure VM Role
Requesting Gravatar...
Thanks guys, found a lot of useful and interesting information 192.168.1.1
Left by huny on Oct 29, 2015 1:22 PM

Your comment:
 (will show your gravatar)


Copyright © Shervin Shakibi | Powered by: GeeksWithBlogs.net