Lab Ops part 17 - Getting Started with Virtual Machine Manager
In my last post I talked a lot about the way all of System Center works, now I want to look at one part of it Virtual Machine Manager (VMM) as VMs in a modern data centre are at the core of the services we provide to our users. In the good old days we managed real servers that had real disks connected to real networks and of course they still exist, but consumers of data centre resources whether that other parts of the IT department or business units will only see virtual machines with virtual disks connected to virtual networks. So administration in VMM is all about translating all the real stuff (or fabric as it’s referred to) into virtual resources. So before we do anything in VMM we need to configure the fabric, specifically our physical hosts, networking and storage.
There’s good TechNet labs and MVA courses to learn this stuff, but I think it’s still good to do some of this on your own server, so you can come back it again whenever you want to especially if you are serious about getting certified. So what I am going to do in the next few posts is to explain how to use the minimum of kit to try some of this at home. I generally use laptops which are sort of portable typically with 500Gb plus of SSD and at least 16Gb or RAM half of those resources should be enough.
I am going to assume you have got an initial setup in place:
- A Windows Server 2012R2 sysprepped VHDX. If not use the Microsoft Convert-WindowsImage script to create one from the Windows Server 2102R2 evaluation iso.
- The host itself running Windows Server 2012R2 Hyper-V. If not:
- Copy the above VHDX to the root of a suitable disk on your host (say e:\) and mount it(so it now shows up as a drive for example X:)
- from an elevated prompt type BCDBoot X:\windows
- Type BCDEdit /set “{default}” hypervisorlaunchtype auto
- Type BCDEdit /set description “Hyper-V Rocks!”
- reboot the host and select the top boot option which should say Hyper-V Rocks!
- from PowerShell type add-windowsfeatures Hyper-V –includemanagementtools –restart
- the machine should restart and you are good to go.
- VMM running already either by downloading a complete VMM evaluation VHD or installing from the VMM2012R2 iso yourself.
- A domain controller as per my earlier post on this, with the host and the VMM VM belonging to this domain.
The first thing you want to do in VMM is to configure Run As Accounts. One of the reasons my PowerShell scripts in this series are not production ready is that they have my domain admin password littered all over them which is not good. VMM allows us to create accounts used to authenticate against anything we might need to which could be a domain account a local account on a VM (be that Windows or Linux), access to a switch or a SAN. So lets start by adding in domain admin. We can do this from settings | Security | Run As Accounts or with the VMM PowerShell cmdlets and not all I have to do is open PowerShell from inside VMM or use PowerShell ISE and either way there’s no more of that mucking about importing modules to do this..
#New Run As Account in VMM
$credential = Get-Credential
$runAsAccount = New-SCRunAsAccount -Credential $credential -Name "Domain Admin" -Description "" -JobGroup "cb839483-39eb-45e0-9bc9-7f482488b2d1"
Note this will popup the credential screen for me to complete (contoso\administrator is what I put in). The jobGroup at the end puts this activity into a group that ends up in the VMM job history so even if we use Powershell in VMM our work is recorded which a good thing. We can get at that job history with Get-SCJob | out-gridview
We’ll probably want to do the same for a local account so just Administrator and a password so that any VM’s we create will have the same local admin account & Note this will popup the credential screen for me to complete.
Now we can consume that domain login account to add manage our host. In VMM we would do this from Fabric | Servers | all Hosts and before we add in a server we can create Host groups to manage lots of hosts ( I have one already called Contoso). To add a host right click on all hosts or a host group and select add Hyper-V Hosts or Clusters and the equivalent PowerShell is ..
<#Note in the raw PowerShell from VMM there is a load of IDs included but this will work as long as we don’t use duplicate names in accounts etc. #>
$runAsAccount = Get-SCRunAsAccount -Name "Domain Admin"
$hostGroup = Get-SCVMHostGroup -Name "Contoso"
Add-SCVMHost -ComputerName "clockwork.contoso.com" -RunAsynchronously -VMHostGroup $hostGroup -Credential $runAsAccount
In the background the VMM agent has been installed on our host and it has been associated with this instance of VMM. You should now see the host in VMM and against all the VMMs that are on it so not bad for a line of PowerShell! We can also see the properties of our host by right clicking on it, and of special interest are the virtual switches on the host and if you have used my script with modifying it you’ll see a switch called RDS-Switch on the host. We can also see the local storage attached to our host here.
So now we have a basic VMM environment we can play with, a host a DC and VMM itself so what do we need to do next. If this was VCenter we would probably want to setup our virtual switches and port groups so let’s look at the slightly scary but powerful world of virtual networks next.
Comments
- Anonymous
January 29, 2014
Excellent resources to have. Thanks for sharing this useful post!