Odin Business Automation Assign Deleted Windows Azure Pack Subscription Resources or VMM Resources to Another WAP Subscription

By | 01/11/2016

If you are using Odin Business Automation for Provisioning Windows Azure Pack you can see deleted subscriptions are not deleted in VMM side. Resources will be accessible and running except WAP panel.

Some OBA customers forget to pay their renewal order and their subscriptions can be destroy. Don’t wory OBA can not delete their VMM resources. Resources waits in VMM until you manually delete them. (Of course you can create automation jobs to delete automatically)

In our case You can recover regretful customer data or You can add existing VMM resource (VM or Virtual Network) to WAP subscription.

Following article help adding VM to WAP subscription https://blogs.technet.microsoft.com/privatecloud/2013/12/05/adding-an-already-running-vm-in-virtual-machine-manager-to-a-windows-azure-pack-subscription/ but I couldn’t find any resource to add VM network to subscription. I will also write this in this post.

Deleted subscription can not be recovered in azurepack. So Customer who has deleted subscription need to buy new WAP subscription in OBA. After that you can move stayed VMM resources to his/her subscription.

Create a test VM in WAP subscription. And see its SelfServiceUserRole and Owner. (Deleted subscriptions have no SelfServiceUserRole and Owner)

To see this Open VMM powershell and run following (mensioned article above).

get-vm -name VMNAME |ft name, selfserviceuserrole, owner

VMNAME: name of test vm

You can get owner and Selfserviceuserrole properties in this output.

In powershell you need to run this command to set SelfserviceUserrole and owner which are outside of the Active Directory Domain.

Get-SCVMMServer -ComputerName YOUR_VMM_SERVER_FQDN -ForOnBehalfOf

So all we need to make pieces together. Assign all pieces to varible.

$vmnametarget = "SOURCE_VM_NAME"
$vmnamesource = "VMNAME"
$vminfo = Get-SCVirtualMachine -name $vmnamesource
$vmowner = $vminfo.owner
$vmselfserviceuserrole = $vminfo.selfserviceuserrole

SOURCE_VM_NAME: virtual machine name runs in VMM or deleted subscription’s VM name.

then run set command

Set-SCVirtualMachine –VM $vmnametarget –UserRole $vmselfserviceuserrole –Owner $vmowner

VM will be shown in customer WAP panel.

To move Virtual Network to WAP panel run following

get-SCVMNetwork -Name "VM_Network_NAME"

You can see Network ID in this output.

$vmNetwork = Get-SCVMNetwork -Name "VM_Network_NAME" -ID "VM_Network_ID"

After all finally you can set owner and UserRole by running following.

Set-SCVMNetwork -VMNetwork $vmNetwork -Owner $vmowner -UserRole $vmselfserviceuserrole

You will see network in WAP and you can delete test vm if you want.