...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.
It looks like the VMSelfServiceUserRole is a combination of owner and subscription ID, is there any way of doing this without needing to copy it from another VM?
I tried to manually add it, but get an error stating 'cannot convert value of type "System.String" to type "Microsoft.SystemCenter.VirtualMachineManager.UserRole"...
I have tried the same operation as Ryan and also get the error as mentioned by Ryan.
Set-SCVirtualmachine -VM $VMName -UserRole $UserRole -Owner $Owner
Ftm we don't have enabled VM creation by tenants in our Enterprise so I can't copy past from existing VM.
Please advice how to put Owner and Role to a VM.
As per step 18. Note the Self-service Owner (e.g. firstname.lastname@example.org (email@example.com_4afe55ef-c171-4b48-8a02-97aee2e7ed34))
I don't get the email address, it checks only for the domain name contoso\admin and not the email address
As per the instructions in point:
18. Note the Self-service Owner (e.g. firstname.lastname@example.org (email@example.com_4afe55ef-c171-4b48-8a02-97aee2e7ed34))
I am unable to add with the GUID but only with the domain user, the guid that I copy form the portal and try to find to add it, does not resolve
Mine is having the same scenario as Joe, which we don't have an enabled VM created by tenants. I too, encountered the same error as other 'cannot convert value of type "System.String" to type "Microsoft.SystemCenter.VirtualMachineManager.UserRole"...
I broke up the parameters and found out that only the -UserRole has an error. The -Owner works fine.