...building hybrid clouds that can support any device from anywhere
One thing I get asked quite often; is it possible to add an already running VM to a subscription in Windows Azure Pack (WAP), so it shows up in the WAP Tenant portal?
The blog post will have two scenarios:
"A tenant has signed up a subscription and just migrated 2 Virtual Machines from on premise to service provider environment and as a service owner we want to assign those 2 VMs under his subscription"
I have two VMs called Contoso101 and Contoso102 running in Virtual Machine Manager (VMM) which I would like to add to my new WAP subscription.
After the two VMs are added to the subscription we are going to give a co-worker at the Tenant access to the two VMs in the WAP Tenant Portal.
Windows Azure Pack & Service Provider Foundation (SPF) allows tenants to access their VMs using subscription which are registered in VMM as user role and has access to the Cloud assigned for that subscription (plan).
For a VM to show under a subscription the following needs to happen:
To add an already running VM to a WAP subscription do the following:
We are using the running VM to make sure we extract the right information to move the two VMs to the subscription.
Figure 1: VM running under Contoso subscription in the WAP Tenant Portal
Note the VMM Management Server and Virtual Machine Cloud for the VM Cloud Plan as we will use this later. (e.g. vmm01.contoso.com and Contoso).
Figure 2: VMM Server and Cloud used by a VM Cloud Plan in WAP
Figure 3: Plan and user showing for a subscription in the WAP portal
Note: In the list above, two VMs are showing that does not belong to a cloud. (Contoso101 and Contoso102).
Run the following command:
$SCVMMSERVER = Get-SCVMMServer -ComputerName vmm01.contoso.com -ForOnBehalfOf
We want to take the following properties from the already running VM in the cloud and save them to the following variables:
get-vm -name contoso01 |ft name, selfserviceuserrole, owner
$vmnamesource = "contoso01"
$vmnametarget = "contoso101"
$vminfo = Get-SCVirtualMachine -name $vmnamesource
$vmowner = $vminfo.owner
$vmselfserviceuserrole = $vminfo.selfserviceuserrole
Set-SCVirtualMachine –VM $vmnametarget –UserRole $vmselfserviceuserrole –Owner $vmowner
$vmnametarget = "contoso102"
The second part of the scenario is to add a co-administrator the Contoso subscription, so this user also can access the cloud resources under the Contoso subscription. To do this perform the following steps:
Hope this blog post helps you with adding already running VMs in Virtual Machine Manager to a Windows Azure Pack subscription and how it's possible to also add a Co-Administrator to a subscription.
While writing this blog post I stumbled over another blog post from an MVP (Hans Vredevoort), which has a similar approach to the VM scenario which can be viewed here.
Hans Vredevoort is also one of the people behind WAP Wiki blog that brings a good overview of WAP Blog Posts that can be found on the Internet, the Wiki can be found here.
Happy moving VMs to a WAP Subscription.