Product Announcements

vSphere PowerCLI 5.8 SPBM – Part3: Associating vSphere Storage Policies

powercli 5.8 icon
In our last article we demonstrated how to use the new vSphere PowerCLI 5.8 SPBM cmdlets to create vSphere Storage Policies. In this article we will demonstrate how to quickly associate a vSphere Storage Policy with  a new or existing VM.

Example Provisioning Scenariospbm_1vmdk_vsan

To illustrate how to leverage PowerCLI to associate vSphere Storage Policies with VMs we will continue with the provisioning example from our previous article.

  • Virtual machine
  • Single virtual disk
  • Virtual SAN datastore

Follow these links for more information on creating vSphere Storage Policies for Virtual SAN:

Previously in order to create, manage, and associate vSphere Storage Policies with VMs using PowerCLI, one would need to leverage an intermediary method as well (e.g. Esxcli, RVC, REST API, etc). Often this could require the use of third party applications to bridge the gap in interfacing with the vSphere Storage Policy Based Management service. This resulted in added complexities and additional processing time for workflows that were automated with PowerCLI.

With the new PowerCLI 5.8 cmdlets for vSphere Storage Policy Based Management we are able to greatly reduce the complexity of vSphere Storage Policies with PowerCLI now by using PowerCLI exclusively. In the example below, we will demonstrate how to enhance the VM provisioning process by associating a vSphere Storage Policy with a virtual machine.

Associate vSphere Storage Policy with a virtual machine

We can use the new “Set-SpbmEntityConfiguration” PowerCLI cmdlet to assign a vSphere Storage Policy to a VM.

Single-Line Example

Multi-Line Example

This will direct the vSphere Storage Policy Based Management service to begin managing storage SLAs for our new or existing virtual machine.

Validating Storage Policies

After assigning, we can then use the Get-SpbmEntityConfiguration cmdlet to validate the association. In the image below we can see our example virtual machine (VM1) now has the “GoldPolicy” associated with it.

imageedit_2_8925614301
Associating a vSphere Storage Policy with a virtual machine is that quick and easy! This is only the tip of the iceberg though. There is much more that can be quickly automated with the new PowerCLI 5.8 cmdlets vSphere Storage Policy Based Management. Stay tuned as we have many more articles with examples on their way!

 


Resources