Showing posts with label Windows Azure. Show all posts
Showing posts with label Windows Azure. Show all posts

Monday, March 3, 2014

Create manually your own custom VM image for Windows Azure

1 Introduction

In order to create from scratch and have you own custom VM image available in Windows Azure, either :

- you are using Microsoft System Center and could perform the below tasks easily,

- or you could do it manually, i.e. go through a long process, yet relatively simple and intuitive.

This document presents the second alternative. By doing it manually, you will understand under the hood how Windows Azure IaaS is working.

image

 

Table of content:

1 Introduction
2 Creating a Hyper-V virtual machine
3 Converting the virtual machine for Azure
3.1 Snapshot your VM!!
3.2 Convert YOUR VHDX into vhd
3.3 Step 1: Prepare the image to be uploaded
3.4 Step 2: Create a storage account in Windows Azure and prepare WIndows Azure
3.4.1 Installing AND CONFIGURE Powershell for Windows Azure
4 UPLOADING the VHD into Windows Azure
5 Create your Windows Azure Image from the vhd your uploaded
6 Conclusion

 

2 Creating a Hyper-V virtual machine

Pre-requisites: In my case, I am using Windows 8.1, with Hyper-V activated.

Open your Hyper-V management console :

image

image

image

ViseoBI-FormationSAP-BO-WinSrv2008R2SP1-fr

image

image

For the training VM ideally 8000 MB (8GB) : (from my computer, I can only put 3000 MB)

image

image

Choose Intel(R) 82579LM … so that Internet could be activated

image

image

You could also choose a smaller size such as 50 GB to speed up upload time.

Choose the ISO of the OS that is automatically be installed on the VM. In ou example, let consider Windows 2008 R2 SP1 Enterprise French

fr_windows_server_2008_r2_with_sp1_x64_dvd_617591.iso

image

image

image

Start the VM

image

The OS starts is installed automatically:

image

image

image

Click “Installez maintenant” > “Win Serv 2008 R2 version complète!“

image

Choose « Personnalisé (option avancée) »

Install on « HD 127 Go »

image

Set the password of the Admin

image

You could either disable all IE security rules or install Firefox. See appendices a direct link to get Firefox

image

 

3 Converting the virtual machine for Azure

The virtual Machine under Hyper-V (Windows 8.1) is composed of 3 files

ViseoBI-FormationSAP-BO-WinSrv2008R2SP1-fr.vhdx (7 GB)

ViseoBI-FormationSAP-BO-WinSrv2008R2SP1-fr_BB96011B-1119-462D-8EB1-6880C2EBF187.avhdx (1 GB)

ViseoBI-FormationSAP-BO-WinSrv2008R2SP1-fr_CEE7D61D-AA09-4D55-A6CE-B9E2DE8BFB9A.avhdx (12 MB)

As per today, the format to be uploaded into Azure is *.vhd (and not *.vhdx). Hence a conversion is needed, on the top of sysprep.

Documentation here: http://www.windowsazure.com/en-us/documentation/articles/virtual-machines-create-upload-vhd-windows-server/

Once this vhd is prepared, it is called “image”

3.1 Snapshot your VM!!

In order to back it up, in case the SystPrep fails!

3.2 Convert YOUR VHDX into vhd

As we speak, Windows Azure IaaS only supports VHD (i.e. legacy and fixed size hard disk). You will want to convert your VHDX into VHD.

This could be done easily with Powershell: PS C:\> Convert-VHD –Path c:\test\MY-VM.vhdx –DestinationPath c:\test\MY-NEW-VM.vhd

C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks> Convert-VHD .\ViseoBI-FormationSAP-BO-WinSrv2008R2SP1-fr.vhdx vmForAzure.vhd

image

Conversion in progress

image

It is only a matter of a few minutes job

Then renamed into ViseoBI-FormationSAP-BO-WinSrv2008R2SP1-fr_ReadyForAzureImage.vhd

More information : https://blogs.technet.com/b/cbernier/archive/2013/08/29/converting-hyper-v-vhdx-to-vhd-file-formats-for-use-in-windows-azure.aspx

3.3 Step 1: Prepare the image to be uploaded

In order to declare your VHD as a Azure Drive, you will have to SysPrep it, with “Generalize” option.

image

image

 

3.4 Step 2: Create a storage account in Windows Azure and prepare Windows Azure

Prerequisites:

3.4.1 Installing AND CONFIGURE Powershell for Windows Azure

See here: http://www.windowsazure.com/en-us/documentation/articles/install-configure-powershell
Within a minute the install is complete.

image

Now you have Powershell for Azure installed, you will have to provide the proper authorization to your Powershell CommandLet to access your subscription.

To do so, just carry on following the steps documented in the previous URL,

image

which will open a web browser to ask you your Windows Azure credentials (your usual Microsoft Account Login and Password).

image

If you have many subscriptions, choose the proper one, which concerns the VHD you want to upload:

image

Now your Publish Setting file is being prepared for you and it is downloaded (bottom left : *.publishsettings):

image

Now import your Publish Settings credentials on your computer, so that the CmdLets will have the proper authorization to publish into your Azure Subscription.

image

 

4 UPLOADING the VHD into Windows Azure

Now you have your PublishSettings configured on your computer, you could start to upload your VHD.

PS C:\> Add-AzureVhd -Destination http://visbisrvsapnoeustoacc.blob.core.windows.net/vhds/VISBT-WinSrv2008R2Fr-Base001.vhd -LocalFilePath 'C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\ViseoBI-FormationSAP-BO-WinSrv2008R2SP1-fr_ReadyForAzureImage.vhd'



/!\ Consider the option “NumberOfUploaderThreads” for Add-AzureVhd with the 32 threads
 
 

PS C:\> Add-AzureVhd -Destination http://visbisrvsapnoeustoacc.blob.core.windows.net/vhdstrainingsapbo/VISBT-WinSrv2008R2Fr-Base002.vhd -LocalFilePath 'C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\ViseoBI-FormationSAP-BO-WinSrv2008R2SP1-fr_ReadyForAzureImage.vhd' -NumberOfUploaderThreads 32


But not necessarily faster (2 days !):

image


(PS: An alternative of the Powershell “Add-AzureVhd” is the CSUpload.exe. Doc: http://msdn.microsoft.com/en-us/library/windowsazure/gg466228.aspx )

Before the upload, the Powershell starts by calculating MD5 Hash:

image

(note the if you have optical fiber the Throughput could be 1535 Mbps, or even faster)

Within 3 min the MD5 Hash calculation is over.

image

image

Don’t’ worry if you don’t see manything going on in this process, the Powershell is doing its job behind the sceen, as we can see with Fiddler:

image

Now, after the message “creating new page blob of size”, it is time for THE upload, which is the most time consuming part of this process. i.e. you can relax and wait few hours (3 to 6 hours, depending on your bandwidth). Strangly enough, after about 10 min my Throughput drops to 0.1Mbps.

image

 

AFTER FEW HOURS, you can now see your VHD in Windows Azure portal, but still not usable yet, because “just” a VHD, not yet an image (because a VHD could either be an “Azure VM Image” or an “Azure VM disk”, depend on how you prepared it)

image

 

5 Create your Windows Azure Image from the vhd your uploaded


Time to convert your *.vhd into a Windows Azure Image!

Under “All Items”, choose “Vistual Machine”

image

NOW your image is re-usable a multiple time, such as any ‘regular’ Windows Azure IaaS VMs that is provided by Microsoft.

DONE!!!

 

6 Conclusion

Don’t forget, this is relatively a long process since we are doing it manually. Use tools such as System Center, or CmdLets of Redgate, or wait for the fortnight Windows Azure portal imrpovements so that this could ease your Admin life!

Monday, February 10, 2014

TechDays 2014: Windows Azure experts on the Windows Azure on stage !!

Microsoft asked me to be one of the Windows Azure experts on the Windows Azure stage during the TechDays 2014 Paris, 18000 visitors.

How to say no to such offer ?!! Based on true massive fixed-price Azure projects, my role is to present how to easy it is to enforce DevOps and Dev-Tests thanks to Windows Azure.


I will also take to opportunity to represent the MUG-Lyon (Microsoft User Group) : as the lead organizer of the Global Windows Azure Bootcamp in Lyon for 2014 event. Its an unusually large bootcamp, since it targets 100 to 200 people, with 3 tracks in parallel and over 9 Azure experts from around France / Switzerland, to provide talks, live coding and demos.

Plenty of technologies to prove that Azure Cloud is respectful of your preferred programming language and environment.

and another sposor ADIRA.

Saturday, November 30, 2013

What’s new in Microsoft ALM 2013, hosted in Windows Azure, VISUAL STUDIO ONLINE

I have not put here all my talks, and I wanted to share my latest public talk for the MUG (Microsoft User Group).


Friday, July 26, 2013

I organized the first Agile .Net France in Lyon, packed of people.
And the most warriors of us stayed up until 1 in the morning where we were talking about TDD!
Free drinks and special hotdogs to accompany our discussions.


Wednesday, July 3, 2013

TFS Build number used as AssemblyVersion in AssemblyInfo.cs

 

Finally, after years of struggling with AssemblyInfo.cs files to be updated to track assembly versioning, here IS an EASY WAY to do this thing, which should have been made easy in the first place in TFS. In the past, I used a more sophisticated way of doing it.

The credit to this method goes to Steve Fenton, who explained his method called "Automatically Updating Your AssemblyInfo The Wrong Way".

To me it is less elegent than doing a full workflow foundation solution, but it solves my problem quick ! So that a good solution. Secondly, maintenability is also great, as it is based on a plain text Batch file. No need to recompile deploy, …

The secret lies the following steps :

  • Using a Team Foundation Build Activities called “InvokeProcess” that is dropped inside the “Run on Agent” process, just after the “Initialize Workspace”.

    More details on a old Post of mine back in 2010, where and how precisely how to operate it.

    This Process simply calls a Batch file that creates on the fly an AssemblyInfo.cs.
  • This “AssemblyInfo.cs” file is inserted on ALL the *.csproj that are part of your solution “As a Link” image


image

  • the only mini-change that one could barely notice the link icon on the AssemblyInfo.cs file. Here is a representation in both Visual Studio 2013 Ultimate preview and Visual Studio 2012 Ultimate



ZOOM ! on AssemblyInfo.cs
image
image

 

The result is instantaneous … on every single step of my software factory, it is highly traceable with the unique ID of the TFS Team Build of 370, as illustrated below.

image

(1) Displays on an “About Page” the exact version of the application, based on the assembly version of the AssemblyInfo.cs,

(2) This version number is dynamically generated by TFS Team Build during the Continuous Deployment process (called _CD).
This guaranties the uniqueness of this number. In this example, it is Build# 370, which gives a version 1.0.0.370.
As a result, we could go up to 1.0.0. 65534,
where 65534 = UInt16.MaxValue – 1= 65535-1
Then you can open the TFS Drop Folder to verify that ALL your assemblies have the correct assembly version.

(3) From TFS Cloud, you’ll get a Zip file that has got the unique suffix “CD_370”, and in the App.publish, you could unzip the Windows Azure package *.cspkg

(4) Once unzipped into the folder “???CD_370”, you’ll see the DLLs

(5) Check the first DLL; we could see the magic happened: The assembly is tagged as 1.0.0.370

(6) Check another Assembly: still 1.0.0.370 !!

DONE ! and Enjoy !!

And the most time consuming part to was to find the proper solution, since many great alternatives are present in CodePlex. I’m sharing this trick hoping it’ll save you plenty of time… and another wish is that one day, an easy feature to activate will appear TFS / VSO !!

 

Note: If needed, here is an example of a batch file.

SET version=%~1
SET outfile=%~2

SET year=%DATE:~6,4%
ECHO off
if "%outfile%"=="" SET /p "outfile=[Full Path] "
if "%version%"=="" SET /p "version=[0.0.0.0] "
REM %tfstool% checkout %outfile%
ATTRIB -r %outfile%
ECHO using System.Reflection; > %outfile%
ECHO using System.Resources; >> %outfile%
ECHO using System.Runtime.CompilerServices; >> %outfile%
ECHO using System.Runtime.InteropServices; >> %outfile%
ECHO

ECHO //// This file is auto generated by AssemblyVersion.bat >> %outfile%
ECHO [assembly: AssemblyTitle("Viseo")] >> %outfile%
ECHO [assembly: AssemblyDescription("This AssemblyInfo.cs is automatically generated by TFS Build")] >> %outfile%

ECHO [assembly: AssemblyConfiguration("")] >> %outfile%
ECHO [assembly: AssemblyCompany("Viseo")] >> %outfile%
ECHO [assembly: AssemblyProduct("Viseo")] >> %outfile%
ECHO [assembly: AssemblyCopyright("Copyright © 2013-%year% Viseo. All rights reserved.")] >> %outfile%
ECHO [assembly: AssemblyTrademark("")] >> %outfile%
ECHO [assembly: AssemblyCulture("")] >> %outfile%
ECHO [assembly: ComVisible(false)] >> %outfile%

ECHO //// Version information for an assembly consists of the following four values:
ECHO ////
ECHO //// Major Version
ECHO //// Minor Version
ECHO //// Build Number
ECHO //// Revision
ECHO ////
ECHO //// You can specify all the values or you can default the Revision and Build Numbers
ECHO //// by using the '*' as shown below:
ECHO [assembly: AssemblyVersion("1.0.0.%version%")] >> %outfile%
ECHO [assembly: AssemblyFileVersion("1.0.0.%version%")] >> %outfile%
ECHO [assembly: NeutralResourcesLanguageAttribute("en")] >> %outfile%

REM %tfstool% checkin %outfile% /comment:"***NO_CI*** Assembly Info Increment" /noprompt

Wednesday, April 24, 2013

At Seattle / Redmond working with Microsoft for ObjetDirect


I moved to another position, now working with ObjetDirect - France - as a Manager.

I'm in charge nationwide of the Microsoft Practice by developing our businesses and activities on at least the following topics:
  • ALM Software factory, 
  • Windows Azure, 
  • Microsoft consulting and development,
  • any other Microsoft technologies.
ObjetDirect, founded 15 years ago, addresses any domains that relates to software development and has developed agile methodologies and extended expertise on HTML5, Java, C/C++, PHP, Android, iOS, Enterprise Architect (by SPARXsystems). We are part of a larger company VISEO that takes care of complementary aspects (eg. SAP, BI, ...).

Obviously everything we're doing here is fully Agile ; why would I join ObjetDirect otherwise ?!?!
In addition, we are the sole company in France entitled to deliver Innovation Games® certified training, and we are very active as a community.

I got the opportunity to be invited by Microsoft on a worldwide NDA partnership in Redmond, to get trained and provide inputs on upcoming technologies (more info here).



Evening time: Seattle - Space Needle 



I would like to thank ObjetDirect and Edouard Danel, our CEO, whom I had the chance to meet though my numerous network in Paris (ranging from Agile, .Net, to PNL and "Transactional analysis"...).



The massive campus (like a town, and takes me about 30 min running from 1 building to another !!), all green grass and trees, and where we eat evening time: