Connecting Windows Azure Pack to MySQL

Hello readers,

This is a fast how-to to connect your Windows Azure Pack to a MySQL platform in order to add MySQL services to a Windows Azure Pack platform.

1- Install the MySQL server extension (provider)

Connect to the server where you want to install the MySQL server WAP extension, this operation is mandatory to add the MySQL server support to your Windows Azure Pack environment. It’s recommended to install the extension on the WAP Admin servers.

Run the Microsoft Web platform installer, go to Products, Windows Azure, and choose to install Windows Azure Pack : MySQL Server extension. Follow the instructions to complete the installation, and to configure the Windows Azure Pack platform.

SNAG-0001

2- Install the MySQL server

In order to use MySQL, you need a MySQL server platform. Until the writing time of this blog, the last supported MySQL server version is 5.5. You can use your existent MySQL sever platform, or choose to install a new one. If you choose to use your existent platform, skip this step and go to step 3. Otherwise, connect to the machine where you want to install MySQL server. Run the Microsoft Web platform installer, Products, All, and search for MySQL

SNAG-0002

Choose the latest version of MySQL, click Add and then Install. Follow the instructions until you complete the MySQL installation.

3- MySQL configuration

Now you need to configure your MySQL configuration. I’m not a guru of MySQL, but i will explain here two steps that may be useful for you.

3.1- Configure the default MySQL databases location

By default, MySQL will create new provisioned databases in a default folder. You should/can change this behavior by choosing another location.

  • First, stop the MySQL service.

SNAG-0004

  • Go to the MySQL installation folder (By default: C:\Program Files\MySQL\MySQL Server 5.5) and edit the my.ini configuration file with a text editor (Notepad…). It’s recommended to make a backup of this file before proceeding in case you miss-configure it.

SNAG-0005

  • Locate the default database folder, browse it and copy all the content to the new location where you decided to store the new provisioned databases.

SNAG-0006

To

SNAG-0007

  • Change the datadir value to the new path (In our example E:\MySQLDatabases)

SNAG-0008

  • Start the MySQL service

SNAG-0009

3.2- Configure the Windows Azure Pack / MySQL connection user

Windows Azure Pack needs a MySQL user to connect the MySQL server and provision new databases. I will detail here how to create the user in MySQL and grant it the needed rights.

  • Start the MySQL command line client, tape the root password to access the MySQL server

SNAG-0010

  • To create a new user, you must provide 3 values :
    • Name : The name of the user (in this example : wap)
    • The server name: The server from which you will connect remotely to mysql (in this example: wap-admin01). If your Windows Azure Pack platform is highly available (more than one mySQL provide°, use the % symbol to mean Any Server)
    • Password: the new user password

CREATE USER ‘wap’@’wap-admin01’ IDENTIFIED BY ‘P@ssw0rd’;

OR

CREATE USER ‘wap’@’%’ IDENTIFIED BY ‘P@ssw0rd’;

  • Provide the user the root privileges then apply the rights

GRANT ALL PRIVILEGES ON * . * TO ‘wap’@’wap-admin01’ WITH GRANT OPTION;
FLUSH PRIVILEGES;

4- Connect Windows Azure Pack to MySQL

Finally, log into the Windows Azure Pack admin portal. Go to MySQL Servers and click Add a New MySQL Server

SNAG-0011

Fill the needed information:

MySQL Server Group : Choose a group to include this MySQL server connection to

MySQL Server Name : The name or FQDN of the MySQL server

Username : The name of the user

Password : The password of the user

Size of the hosting server: The maximum allowed databases size (The full storage size)

SNAG-0012

and you got this

SNAG-0013

Congratulations!!!!

—-NB—-

When adding the MySQL server connection to Windows Azure Pack you may encounter the following error if the user does not have root rights with Grant rights. Don’t forget to use the “with Grant Options”

  • The server encountered an internal error. Please retry the request.
  • And the following error is logged on the Microsoft-WindowsAzurePack-MgmtSvc-MySQL/Operational event log, on the WAP Admin server:
    • Source: MgmtSvc-MySQL
    • EventID: 160
    • Level : Error
    • Content: Unexpected exception for operation ”, version ”, client request Id ”, server request Id ”, exception ‘MySql.Data.MySqlClient.MySqlException (0x80004005): Access denied for user ‘wap’@’%’ (using password: YES)

Bonus : MySQL commands

  • How to list the MySQL users: select host, user, password from mysql.user;
  • How to delete a MySQL user: DROP USER “username”

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 🙂

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 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!!

Deploying “System Center 2012 R2 and Windows Azure Pack” Series

Hi All,

Today, deploying System Center components in an environment become a time consuming task to an IT or consultant.

Using the straightforward method of installing prerequisites, a Next after a Next and the integration at the end is becoming  more and more boring and time killing. We can pass days (1 day = 8 hours) for just installing VMM, SCOM, SCCM, SCSM and the other system center products if needed.

If you are also deploying Windows Azure Pack, you will need more hours and hours.

In addition, i’m not mentioning installing SQL Server for hosting databases, and spreading system center roles for high availability and scalability.

The all achievement can take several tens of hours : Not very cool since we are just installing!! not using

What do you think if i told you that you can reduce this huge number from tens (50, 60,70,80) to just 16 !!

And yes, thanks to Rob Willis and his great team, they made a great tool (A set of Powershell scripts (3 to be exact) and xml files (3 to be exact but only 2 are really needed in the major scenario) where you will need just to fill in the blanks (populate your custom variables) and the scripts will just do the whole work for you : Create VMs, Create SQL Cluster and instances, Install System Center products and install WAP)

For whom who just need to install some products, you can use it !! You can for example, just install VMM, SCOM and SCCM!!

During this series, i will try (in parallel of my deployment) to share information about where to begin, how to proceed and a step by step guide of my deployment (as possible as i could 🙂 )

Finally, the tool name is : Powershell Deployment Toolkit, and the time i’m writing (and working) this blog, the version i’m working with is PDT 2.2600  , exactly the 2.64.2608

You can download the tool from the the following link (normally you will find always the latest version, updated by Rob Willis) : PDT Download

See you in the next post 🙂

Deploying “System Center 2012 R2 and Windows Azure Pack” Series