One of the really great things about System Center Virtual Machine Manager (VMM) is that it allows you to define private clouds that can be used for self-service administration. One of the more important parts of setting up a private cloud, however, is defining user role quotas for those who will be using the cloud. After all, you don’t want a cloud administrator to be able to deplete your virtualization infrastructure of hardware resources. So let’s take a look at how to check and modify user role quotas within a private cloud.
The first thing that I like to do when managing quotas (using the Virtual Machine Manager command shell) is to map the private cloud to a variable. Unless I already know the exact name of the cloud, I like to use the two commands shown below. The first command retrieves a list of the private clouds, while the second one maps a private cloud name to a variable called $Cloud.
Get-SCCloud | Select-Object Name $Cloud = Get-SCCloud -Name "<cloud name>"
You can see an example of these commands in the screenshot below.
Next, I recommend mapping a user role to a variable. The reason for this is that quotas are generally mapped to user roles rather than to individual users. Hence, it makes sense to map a user role to a variable, because doing so will make it easier to manage the role’s quotas.
The process for mapping a user role to a variable is very similar to the procedure that I used a moment ago. I typically use one command to look up the role names, and another command to perform the actual variable mapping. Here is an example:
Get-SCUserRole | Select-Object Name $Role = Get-SCUserRole -Name “<role name>”
You can see an example of this in the screenshot below.
Looking at the quotas
Now that we have defined variables for the cloud and the user role, we can begin taking a look at the quotas. Before I show you how to view the quotas, there is one key concept that you need to understand. User roles can be assigned two separate quotas, one for the role as a whole and another for individual users who have been assigned to the role.
To show you what I mean, let’s take a look at the VMCount quotas for one of the role groups on my VMM server. The VMCount quota limits the number of virtual machines that users are allowed to create. You can see the VMCount quotas by entering this command:
Get-SCUserRoleQuota -Cloud $Cloud -UserRole $Role | Select-Object VMCount
As you can see in the screenshot below, the command shell returns two separate values. One of these values is the VMCount quota for the user role as a whole, while the other represents the VMCount quota for individual users within the role (the maximum number of virtual machines that an individual user can create).
So which quota is which? The lower number usually corresponds to the per-user quota, but the screen capture does not definitively tell us which quota is which. The easiest way to find out which is the user quota is to append -QuotaPerUser $True to the command. Here is what the command looks like:
Get-SCUserRoleQuota -Cloud $Cloud -UserRole $Role -QuotaPerUser $True | Select-Object VMCount
This command causes the console to display the user quota. If we wanted to look at the role quota instead, we could simply change $True to $False. You can see examples of both in the screenshot below.
Modifying the user role quotas
So as you can see in the screenshot, the user quota is currently set to 5, and the role quota is set to 10. Of course those values are kind of low. Thankfully, it is relatively easy to modify the quotas.
There are a few different ways in which a quota can be changed, but I personally think that the easiest approach involves mapping the current quota to a variable and then using that variable to modify the quota. Let me show you how this works.
For the sake of example, let’s create a variable named $Quota and map it to the role level quota (not the user level quota). We will then increase the role quota from 10 to 20. The variable mapping works very similarly to the commands that we have already been using. Here is what the command looks like:
$Quota = Get-SCUserRoleQuota -Cloud $Cloud -UserRole $Role -QuotaPerUser $False
Now that we have created the $Quota variable, we can modify the role quota by referencing this variable, and providing a new quota value. The command for doing so is listed below. As you look at the command, you will notice that because I am modifying a quota I am using the Set-SCUserRoleQuota command instead of the Get-SCUserRoleQuota command that I have been using throughout this article. Here is the command:
Set-SCUserRoleQuota -UserRoleQuota $Quota -VMCount 20
If we now use the Get-SCUserRoleQuota cmdlet to retrieve the user role quotas value, we can verify that the quota has indeed been increased from 10 to 20. You can see the entire command sequence in the screenshot below.
PowerShell makes it easy
As you can see, PowerShell makes it relatively easy to manage private cloud quotas. Even though I have used the VMCount quota in my examples, there are other quotas available for things like memory, storage, and CPU usage.
One of the nice things about using PowerShell to manage user role quotas is that doing so allows you to manage quotas on a conditional basis. If, for example, you upgraded your host server’s hardware, then you might create a conditional command that checks each role group’s quotas to see how many virtual machines are allowed to be created. If the current quota allows for less than 20 VMs, then you might increase the quota to 20. Something like that would be really tedious to do through the GUI, but would be relatively simple to do through PowerShell.
Featured image: Freerange Stock