• Upload VHD to Windows Azure

     

    In my previous blog I covered a small introduction about windows Azure, and as we discussed Windows Azure has 3 roles as web role, worker role and VM role. VM role is the new role and till now still under Beta program. To be able to test this new role you have to upload a VHD to Azure. The base VHD acts as the initial template for the VM Role instances that are created in Windows Azure. The base VHD contains the operating system, any operating system customizations, and your applications.

    clip_image001

    Request access for VM Role

    1- Go to https://windows.azure.com/ log in with your live ID.

    2- Select home then Beta programs.

    3- Select the program check box and Apply for Access.

    4- It may take from 1 day up to a week to get approval for access.

    clip_image003

    Extend visual studio to support VM role

    1- Create a new text.

    2- Past the following

    Windows Registry Editor Version 5.00

    [HKEY_CURRENT_USER\SOFTWARE\Wow6432Node\Microsoft\Windows Azure Tools for Microsoft Visual Studio 2010\1.0]

    "VirtualMachineRoleEnabled"=dword:00000001

    3- Save and rename the file” EnableVMRole-X64.reg”

    4- Double click of the file, which will enable this role in the context menu in Visual studio.

    clip_image005

    Prepare VHD before upload to Azure

    You can use Hyper-V Manager to create a new base VHD to be uploaded to Azure or you can use existing VHD. However the maximum size of VHD can be uploaded is 65 GB. After you create VHD follow the following steps:-

    1-  Before start uploading you must install the Windows Azure Integration Components inside the virtual machine. The source of Windows Azure Integration Components is inside the installation path of windows Azure SDK %ProgramFiles%\Windows Azure SDK\<VersionNumber>\iso\ folder, select the wavmroleic.iso.

    2-  Mount wavmroleic.iso to virtual machine which you want to upload its VHD to Azure and then double-click WaIntegrationComponents-x64.msi. Enter the Administrator password that is used when the operating system starts after the image is prepared and deployed to Windows Azure. Finish the installation of the components. You must restart the virtual machine for the components to be completely installed.

    clip_image006

    3- 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.

    clip_image007


    Upload VHD to Windows Azure

    Now you are ready to upload VHD to windows Azure

    1- Open a Windows Azure SDK Command Promptas an administrator from Start | All Programs | Windows Azure SDK v1.x.

    2- Run the following command

    csupload Add-VMImage -Connection "SubscriptionId=[subscription_id]; CertificateThumbprint=[certificate_thumbprint]" -Description "[description]" -LiteralPath "[vhd_location]" –Name [vhd_filename] -Location "[azure_subregion]" -TempLocation %TEMP% -SkipVerify

    For example:-

    csupload Add-VMImage -Connection "SubscriptionId=XXXXXXXX-XXXX-XXXX-XXXX- XXXXXXXX; CertificateThumbprint=512DB65E1233C227DCD2067X5F7295BFEBA01X99" -LiteralPath d:\VMs2012\test.vhd -Location "West US"

    3- Wait until VHD to be uploaded it depends on your VHD size and internet speed.

    clip_image009

    4- Once it finish go to the Management Portal, select the Hosted Services, Storage Accounts & CDN tab, and then VM Images. Notice that the list includes the test.vhd file that you are currently uploading and that its status is shown as Pending and once it finishes it will be committed.

    Create new service model contains VM role

    1- Configuring your Windows Azure Management Portal Credentials in Visual Studio.

     

    clip_image011

    2- Open Visual studio and create new cloud project

    3- Don’t select any role and click OK.

    clip_image012

    4- Add new VM Role

    clip_image014

    5- Select your windows azure subscription you created in step 1 and select VHD for your virtual machine role.

    clip_image015

    6- In configuration tab select number of instance.

    7- Finally, create a package to deploy your virtual machine role.

    clip_image017

    8- Click on “Configure Remote Desktop connection” to enable remote desktop on VMs which will be created.

    clip_image018

    9- Choose the newly created certificate from the drop down list, and then enter the name of the user that you will use to connect remotely to your VM. Finally enter a password and confirm it, and choose the account expiration date then click ok.

    clip_image019

    10- Click package, then wait until Visual Studio creates it. Once the package is ready, Visual Studio opens a window showing the folder that contains the generated files.

    clip_image020

    11- Go to Management Portal and create new hosted service using the files you got from step 10 and certificate we created earlier, then click ok.

    clip_image022

    Note that you must choose the same region you upload VHD to.

    12- Wait until the status of the deployment is shown as ready.

    image

  • Part 4- Monitor Azure with System center Operation Manager (SCOM).

    In Part 3 we configured System Center App controller 2012 to manage public cloud on Microsoft Azure. In this Part 4 I will cover how you can monitor hosted services using System Center Operation Manager (SCOM). SCOM can monitor the public and private cloud at the same time using the same console so the administrator can monitor all his system from single pane of glass.

    Configure System Center Operation Manager 2012 to monitor hosted service in Azure

    1- First download install windows Azure management pack which has the following features:-

    Feature Summary
    After configuration, the Windows Azure Monitoring Management Pack offers the following functionality:

    · Discovers Windows Azure applications.

    · Provides status of each role instance.

    · Collects and monitors performance information.

    · Collects and monitors Windows events.

    · Collects and monitors the .NET Framework trace messages from each role instance.

    · Grooms performance, event, and the .NET Framework trace data from Windows Azure storage account.

    · Changes the number of role instances via a task.

    2- Import MP in SCOM

    3- As we discussed in previous parts, to be able to communicate with windows Azure you need a certificate and your Subscription ID. However SCOM doesn’t understand Azure out of the box, so to import certificate and password we need to do small work around.

    4- Go to administration then right click on Run as configuration and Create a new run as account using Binary authentication and import the certificate we exported in Part 3.

    clip_image002

    5- Create a new run as account using basic authentication, we will use this account to host certificate password

    a. In user name enter any value we only care about password

    b. Enter the certificate password you exported in Part3.

    clip_image004

    6- Now we successfully import the certificate and authentication in SCOM, select now Authoring view then select the Management Pack templates you should see Windows Azure Application as one of the management packs templates.

    clip_image006

    7- right-click the Windows Azure Application node and select the “Add Monitoring Wizard.

     

    clip_image008

    8- On the Name and Description page of the wizard, provide the desired name and description for your new monitoring type and click Next.

    9- On the Application Details page of the wizard, provide the following information:

    a) The DNS name of your hosted services in the cloud that you want to monitor

    b) Your Subscription ID

    c) The Deployment slot of your application, which will either be Staging or Production

    d) The Azure certificate run as account, which will be the Azure Binary account you created in step 3

    e) The Azure certificate password run as account, which will be the Azure Password account you created in step 4

    Once you enter all information, you will select next.

    clip_image010

    10- The next step will be to select a proxy account.it can be any machine has internet connection. You should just select the Browse button, select the Search button, and then select your server name, as seen below. Select next when it takes you back to the original dialog if you don’t have a proxy server. If so, then enter your proxy server address and then select next then create.

    clip_image012

    11- Theoretically you finish and after a while if you go to Monitor then Windows Azure you will be able to see the status of the hosted services. However if it keep unmonitored follow the following to solve this known issue .

    12- In earlier versions of the Windows Azure SDK, the default Windows Azure Diagnostics string provided by the Visual Studio template in the service configuration file was named DiagnosticsConnectionString. Later Windows Azure SDKs have changed this name to Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString. And by default SCOM is looking for old value so we need to change it. To solve this issue either you change the value in Visiual sutdio or in SCOM itself.

    13- To change it from SCOM go to Authoring and select Object Discoveries.

    14- Select Scope and search for “windows Azure role instance”

    clip_image014

    15- Find your desired target whose name should look something like Windows Azure Hosted Service Total Discovery (<your hosted service name>) as seen below. Right-click on the item and select Properties from the popup menu and select override tab then select override.

    clip_image016

    16- Then change the “DiagnosticsConnectionString” to “Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString” then click Ok.

    clip_image018

    17- It will take a while until you will find SCOM can monitor your Hosted services in Azure healthy.

    image

  • Part 3- Manage windows Azure with System center App controller

    In Part 2 we created our first hosted service in the public cloud hosting a sample website. In this Part we will configure System Center App controller 2012 to manage our public cloud on Microsoft Azure. But first what is the App controller.

    System Center App controller 2012

    App controller is a part of Microsoft System center suite and it creates a simple way for the datacenter administrator to delegate to application owners control of their applications and virtual machines. It offers a simple, self-service experience for building application, giving application owner greater visibility into their services, virtual machines and the public or private clouds they run on. This frees datacenter administrators to concentrate on managing the infrastructure and enables application owners to focus on running their services rather than servers.

    Configure System Center App controller 2012 to manage Azure

    1- First we need to export the certificate we created in Part2, open MMC then add certificate and select “computer account”

    clip_image002

    2- Under personal right click in the certificate you generate from IIS and select export, and while exporting select export private key then click next , next and enter password.

    clip_image006

    3- Save the certificate in secure location.

    4- Open App controller go to Overview page and select “connect a Windows Azure subscription ”

     

    clip_image004

    5- Enter the following :-

    a. A friendly name for this subscription.

    b. Your subscription ID for Azure.

    c. Select the certificate you exported in step 3.

    d. Enter the password for the certificate that you enter in step 2 and click ok.

    clip_image007

    6- Now you successfully add your Azure subscription to App controller. If you go to services tab you will be able to see services we created in part2 and you can create a new service from here also.

     clip_image009

  • Part 2- Create a new service in windows Azure

    In part one we covered a small introduction to windows Azure and how you can create account in windows Azure. In this part I will cover how you can create simple website and how you can publish it to the public cloud. But before jumping to details steps we need to cover some concepts like subscription ID and certificate.

    Subscription ID

    Once you create an account in windows Azure you will have a unique subscription ID, this ID is the unique identifier for your account and you will use this ID during configuring SCOM or App controller to manage your public cloud.

    To get your subscription ID go to “Hosted Services, Storage Accounts & CDN” select Hosted Services as shown below

    clip_image002

    Certificates

    All your communication to public cloud “Windows Azure” is secured communication, so you need to create a certificate to establish this channel, this certificate can be a public certificate or even a self-sign certificate. There are multiple ways to create a self-sign certificate like CA, Visual studio, PowerShell, IIS and ….etc.

    To create self-sign certificate from IIS and upload it to Azure follow the following steps:-

    1- Open IIS manager console then select Server Certificates

    clip_image004

    2- Select “Create Self-Signed Certificate” from action section in the right side to generate a new one and it will automatically save locally in computer certificate store.

    clip_image006

    3- Any certificate has two parts Public key and private key; we need to export both of them. The Public key we will upload it to windows Azure (.cer file) and the private key we will use it while configuring SCOM and App controller.

    4- To export the Public key open MMC then add certificate and select “computer account”

    clip_image008

    5- Under personal right click in the certificate you generate from IIS and select export, and while exporting select don’t export private key.

    clip_image010

    6- Finally we will upload the certificate to Windows Azure, go to Azure portal select “Hosted Services, Storage Accounts & CDN” then management certificate and upload the public key of the certificate that you just exported in previous step.

    clip_image012

    7- After you finish, export the certificate again but with the private key and keep it in secure location.


    Create a new service in windows Azureclip_image014

    Now you can create your first website in the cloud. To upload your website to Azure your need to package your website code using Visual studio as Azure package which will generate two files:-

    1- .CSpkg file:- is the file that contains your website content.

    2- .CScfg file:-is the file that contains your website configuration like type of Roles, number of instances, enable remote desktop on machines,….etc.

    Sample of files ServiceConfiguration.Cloud.cscfg ; WindowsAzureProject1.cspkg

     

    clip_image016

    Note that by default Visual studio doesn’t understand cloud you have to install Windows Azure Tools for Microsoft Visual Studio.

    Now we are ready to create our first website in Azure and the first step as we discussed in part one is creating new hosted services. Go to Azure portal select “Hosted Services, Storage Accounts & CDN” then select “New Hosted Service”. Enter the name of your service, your public URL of your website and select either production or staging. Finally browse .CSpkg and .CScfg click ok.

    clip_image018

    Azure will start creating new virtual machines and deploy your website on them. Numbers and types of virtual machines is equal to what you defined in CScfg file. For example in screen shoot below Azure will 2 virtual machines, these 2 VMs are under the same role “Web Role”.

    clip_image020

    Once it finish you can browse your website immediately

    image

  • Part 1- Introduction to windows Azure and how you can create account

    What is Windows Azure?clip_image002

    Windows Azure is Comprehensive platform for running applications; simply you can consider it as a place where you can host and execute your code in the cloud.

    The main benefit of azure are:-

      • Scalability
      • Availability
      • Fault Tolerance

    Azure has three core components:-

    1. Compute: - is the virtual machines that will run your code.

    2. Storage: - is a scalable storage in the cloud which is auto-scale to meet massive volume and throughput database based on customer needs. Any data you upload in the cloud storage automatically replicated to 3 locations in Azure to provide you with high availability.

    Windows Azure storage has four types:-

    · Table: - group of entities (name/value pairs)

    · Queue: - Simple non-transactional message queue

    · Blob: - Large binary storage

    · Drives: - NTFS VHD mounted into Compute instance

    3. SQL Azure Database:- Is SQL Server relational database model delivered as a service which support clip_image004

    · Support for existing APIs & tools

    · Built for the cloud with high availability & fault tolerance

    · Easily provision and manage databases across multiple datacenters

    Service, Roles, and Instances

    Service, Roles, and Instances are representing the structure in windows Azure. Let say that you want to host website on windows azure, the first step you have to do is creating a service. The service is a container for your application and you assign the public URL for this service, so you can consider for every application you need to create a service.clip_image006

    Each service can contains one or more role. Let say that you want to host website which is 2 tier applications, so you will create a service for your website contains 2 roles one is web role and the second one is database server.

    Finally, you have to define how many instance you need from each role. Back to our example if you want to host website you will create 1 service contains 2 Role (web, SQL) and 2 instances from web role (2 web server) and 2 instances from Database role.

    Windows Azure Role

    Windows Azure has 3 roles as web role, worker role and VM role. VM role is the new role and till now still under Beta program.

    clip_image008

    How create account in Azure

    1- Simply you logon to http://www.windowsazure.com/en-us/pricing/free-trial/ and create free trial account

    clip_image010

    2- You need to enter your credit card information nothing charge.

     

    3- Congratulation now you’re in the cloud :-)

     clip_image011

    4- Switch to preview mode by clicking the green preview points, it will be looks like

    clip_image013