Windows Azure Pack: VM Clouds Automation: How it works ?

Hi all,

I’m here to continue my series about the automation with Windows Azure Pack.

In my last blog, i described the general mechanism to achieve automation actions related to virtual machine deployment in Windows Azure Pack.

So let me explain the end to end process of automation : I will use the “Create new Standalone VM” example

1- The tenant decides to create a new standalone virtual machine

2- The tenant validates the “Create Virtual Machine” wizard

3- In a WAP/SMA language, the “Create” “VMM Virtual Machine” action is called

4- in the meanwhile, the Create Virtual Machine process is triggered via SPF to VMM.ย  SPF tells VMM to create the VM

So, what have we here ?

Like everyone can notice it, in step 3, something was called by Windows Azure Pack. We will use this to achieve automation.

Our goal is to run a script (a workflow in SMA language) when an action is triggered.

Here is the complete list of the actions that we can link to a runbook (A powershell script, workflow), you can find almost all the possible actions : Create standalone VM, Create VM role, scale Up a VM role, Delete a standalone VM…

The following table resumes the Create/Delete VM actions:

Object-Action-VMClouds

NB: Till today, i have an issue triggering the action related to a “VM Role instance deletion”, i’m in touch with Microsoft to solve this issue, and will update this blog as soon as i have an update.

So if you join my first blog and this one you will say: I have a powershell script (A workflow, or a runbook) that i want it to be executed when creating a virtual machine.So I have to create the script, import it to Windows Azure Pack, then tell Windows Azure Pack to run this script every time a VM is created ie an Object=VMM Virtual Machine, Action = Create is called.

This is it! Now in the next blogs we will go deeper and make a step by step to achieve this, practically.

We will define a goal: I want that every time a new Standalone Virtual Machine is created, a checkpoint is created for this VM. Note that once you understand the tricks, you can do a lot of things than that just creating a snapshot: You can send emails telling the tenant that its VM has been provisioned, you can create a Replica for this VM or you can enable backup for this VM, any thing you can script ๐Ÿ™‚

The following are the steps:

1- Create a script that takes as input the VMID and creates a checkpoint as output. Note that we will use the VMID and not the Virtual Machine name because the VMID is the unique identifier of a VM, and that multiple VMs can have the same name in Hyper-V (Hyper-V supports similar VM names)

2- Understand how to deal with runbooks in Windows Azure Pack and SMA : Syntax, Import runbooks, call a runbook from another runbook

3- Learn how to extract important data from a WAP action: For example how to catch the VM Name or the VMID and pass it to the script, we will manipulate the $PSPrivateMetaData SMA variable (Very important)

4- Use 1, 2 and 3 now to finalize our goal: catch the VMID (3) and run the script (1). We will also use a trick (2)

5- Test our runbook

After these 5 blogs, you will be able to deal with SMA runbooks and VM Clouds automation ๐Ÿ™‚

Advertisements

System Center 2012 R2 : Update Rollup 4 breaks the SPF website

Hi All,

System Center 2012ย  Update Rollup 4 was released on October 28 to bring some bug fixes and new features to the System Center 2012 products concerned by this update.

I was obliged to install this update for SPF to try to fix a bug in a Windows Azure Pack deployment (I was asked by Microsoft to do that). After installing the update on the SPF servers, the WAP Admin portal was not ale to connect to my SPF web point.

4

Browsing the SPF website has failed, at this moment, i was sure the UR4 has broken something (as usual)

On the SPF servers (the deployment contains two load balanced SPF servers), the IIS management console shows that the site was off, so i tried to start it.

2

The following error was thrown (This website cannot be started. Another website may be using the same port)

3

The System event log also records the following error “The World Wide Web Publishing Service (WWW Service) did not register the URL prefix https://:8090/xxxxx for site 2. The necessary network binding lay already b ein use. Th site has been disabled. The data field contains the error number”

When seeing the site bindings, i was surprised that a duplicated binding was made (Using the same port 8090, the SPF endpoint port).

6

I had to remove one of the duplicated bindings, and be sure to reselect the SSL certificate to the left binding (When removing the duplicated binding and validating, the left binding configuration loose the SSL certificate mapping)

9

Now, the site can be started, and the WAP Admin portal is communicating with SPF.

I was sure that the UR4 was the culprit because this issue happened on both SPF servers where i installed the update. And i’m happy because the issue wasย  simple to solve.

An advise, don’t install Microsoft updates until the community confirms that no harm will happen due to it. This always was the precious Aidan Finn advise ๐Ÿ™‚

Windows 10 technical preview Build 7879 : The battery icon becomes horizontal

Hi All,

It’s just for fun, but i’m wondering why Microsoft or Microsoft Windows 10 Technical Preview team has changed the battery icon from a vertical battery to an horizontal battery.

ssss

Maybe they are converging the the “unique Windows OS” path (The battery icon on Windows Phone is horizontal!!)

Or maybe they are just bored ๐Ÿ™‚

Windows Azure Pack: VM Clouds Automation

Hi All,

This post is about the automation that we can achieve with Windows Azure Pack when deploying virtual machines via the Windows Azure Pack VM Clouds service. This post is just a quick start to help you understand what Automation is about !

So, in one world we can say:

Q = Can i trigger an action when deploying a VM via Windows Azure Pack ?

R = Yes, via the automation service leveraged by System Center SMA (Service Management Automation)

SMA is an Orchestrator like product, it is almost Orchestrator for Windows Azure Pack. You can see more here

SMA is a product that will be installed then integrated to the Windows Azure Pack platform. We can find two main SMA roles: The SMA Automation Web Service Role and the SMA Runbook Workers role

The first one (SMA Automation Web Service Role) is the point that WAP communicates with and send requests and fire runbooks (Start a runbook…)

The second (SMA Runbook Workers role) is the server where the workflows run and are executed (like the Orchestrator Runbook server)

So it’s easy with Windows Azure Pack:

1- Create your workflows: SMA Workflows are pure Powershell, so the finality is to create powershell scripts.

2- Import them into Windows Azure Pack automation (Via the Windows Azure Pack Admin portal)

3 – Create an SMA trigger action: Via the VM Clouds Automation tab in the WAP Admin portal: Example: Run the runbook (ie script) MakeVMbackup when a VM is created

That’s it !

Keep in mind that you need only those three steps to achieve automation, that can be reduced to 2 steps: Create and Link

In the next blog i will explain some SMA triggers that you will certainly use in your WAP word.

Windows Azure Pack VM Role Virtual Machines : MAC addresses are static !

Hi All,

With Windows Azure Pack, when deploying Virtual Machines role instances, be careful regrading the Virtual Machines Network Interfaces MAC addresses. Unlike standalone virtual machines NIC MAC addresses that are assigned dynamically, the VM Role instances NIC interfaces MAC addresses are fixed during the deployment and the MAC addresses are assigned from the VMM Default MAC address pool.

This behavior is likely by design, and cannot be changed using a straight configuration or option.

You can create SMA workflows that are linked to the MicrosoftCompute VMRole object actions, that change the NICs MAC type to dynamic but you will need to develop these workflows (Powershell scripts): Not easy!

Finally, if you change manually the MAC addresses type to dynamic (via VMM console or VMM powershell), be aware that you missed a configuration. In fact, during deployment, VMM assigns the MAC addresses via a MAC addresses pool (The default pool), each NIC receives a MAC reservation, and this particular MAC address ‘belongs’ now to this NIC. When you set the NIC MAC to dynamic, the reservation still exist and the used MAC still owned by this NIC. This behavior canย  lead to reserved MAC addresses that are not assigned, and that can’t be used by other NICs.

The solution is to give back the MAC address to the VMM MAC pool. This can be done by the Revoke-SCMACAddress VMM powershell cmdlet.

The hole process is defined below:

##### SCRIPT BEGINNING #####

#Get the VM

$VM = Get-SCVirtualMachine -Name “VMName”

#Get the VM’s NIC, 0 for the first NIC, 1 for the second…

$NIC = $VM.VirtualNetworkAdapters(0)

#Get the NIC MAC Address

$DEFMAC = Get-SCMACAddress -MACAddress $NIC.EthernetAddress

#Revoke the MAC address

Revoke-SCMACAddress -AllocatedMACAddress $DEFMAC

#Set the NIC MAC address to dynamic

Set-SCVirtualNetworkAdapter $NIC -MACAddressType dynamic

##### SCRIPT END #####

You can use a for loop for multiple NICs VM

##### SCRIPT BEGINNING #####

#Get the VM

$VM = Get-SCVirtualMachine -Name “VMName”

#Get the NIC count

$NICCount = $VM.VirtualNetworkAdapters.Count

#Start the iteration

For ($i=0 ;$i -lt $NICCount ; $i++) {

$NIC = $VM.VirtualNetworkAdapters(i)

$DEFMAC = Get-SCMACAddress -MACAddress $NIC.EthernetAddress

Revoke-SCMACAddress -AllocatedMACAddress $DEFMAC

Set-SCVirtualNetworkAdapter $NIC -MACAddressType dynamic

}

##### SCRIPT END #####

If you have questions, shoot!!