In this post we are going to play with SMA and VMM. I wanted to achieve that a VLAN depended network was fully provisioned by Service Management Automation (SMA) in System Center Virtual Machine Manager 2012 R2 (VMM). I also wanted to create the option to de-provision the network. Virtual networks based on NVGRE are already exposed to the Tenant Portal in Azure Pack and can be managed by the tenants them self. If you are depended on VLAN based networks you need as an Admin to expose the network to the tenant via a Plan. I wanted to make sure the Admin only had to use the Azure Pack Admin Portal to fully provision the tenant and their network.
In this post I am going to create 2 assets and 2 runbooks. 1 for adding new VLAN depended networks in VMM and 1 for removing VLAN dependent networks. Before i can create and import the runbook, I have to create 2 Assets in SMA:
- VMM Server – Variable
- VMM Credentials – Credentials
To create these assets run these commands on a PC with SMA Powershell installed:
#Set web endpoint for SMA server
$smaEP = "https://ms-sma01"
#Set Variable for SCVMM Server
Set-SmaVariable -Name "VMMServer" -Value "MS-VMM01" -WebServiceEndpoint $smaEP
#Set Credentials and create Credential Asset for VMM
$cred = Get-Credential
Set-SmaCredential -WebServiceEndpoint $smaEP -Name "VMMCred" -Value $Cred
For adding new Networks we need the following input:
The Add-VLANNetwork does the following:
It will look up the logical network you specified (it needs to exist). Then it will look if the new Site definition you specified exist. If not it will create the Site Definition and assign it to the host group(s) you specified. Next it will add the vlan and subnet to the site definition. After that it will add the network to the uplink profile you specified (this only happens when a new site definition is created, Existing onces are already mapped. Next it will create the VM network based on the logical network you just created with the name you specified in the Runbook. If you select yes at the question for creating IP Pool it will create the pool with 100 ip addresses.
The next thing we need to do is to create those 2 runbooks. One will be created for adding new networks and the other will be for removing networks in VMM,
Publish the runbook in SMA with these commands.
#import Add-VLANNetwork.ps1 runbook
$smaEP = "https://ms-sma01"
$runbook = Import-SmaRunbook -Path "C:\Runbooks\VMM\Add-VLANNetwork.ps1" -Tags "VMM, Network" -WebServiceEndpoint $smaEP
Publish-SmaRunbook -Id $runbook.RunbookID -WebServiceEndpoint $smaEP
When the runbook’s are published the provisioning of a tenant would look like this:
In the Admin Portal I first create the new Tenant network by executing the Add-VLANNetwork Runbook:
I am prompted with a form to fill out the details. If I want to have a IP Pool created I have to select YES. I left the hostgroup empty. I specified in my Runbook that it will then apply to the “All Hosts” Group in VMM. I specified the logical network where I want to create the network in and make up my site definition name. In my case I use the customer name as a reference:
I will then specify the customer’s subnet, vlan and my uplinkprofile port to apply the network to:
Last but not least I need to specify the name of the VM Network that will be created then hit the check mark button to start the runbook:
And as proof to you the result in VMM:
Next I create the plan for the customer and assign it his new created network:
After I created the plan I need to edit the plan to assign a cloud, network and other settings to it. Click below plan services on the Virtual Machine Clouds:
Then assign VMM cloud to it:
Furthermore down the page you have the option to assign network to it. Choose the new provisioned network for CustomerA:
Specify the other option on the page and save the plan:
Next step is to create the admin account for customer A in azure pack. Select new -> Account -> Quick Create:
Now we fully provisioned a customer and their network only with the Admin Portal.