Storage Creation in VMM 2012R2 using SMI-S and iSCSI

To replicate how storage is presented in a production scenario inside of a LAB, there are some useful Software SAN Tools (Starwinds etc) which present storage to VMM in order to import into the Fabric using iSCSI for example.

Now in Server 2012 R2 this can be achieved right out of the box using the iSCSI Target Server and Powershell to present into VMM.

Ensure your host is Server 2012 R2 and add the feature for the iSCSI Target Server.

Note down the drives you wish to make use in your environment but for the purpose of this post, I have 2 drives that are SSD which I will use as Gold and Silver Storage.

The SMI-S piece that did ship with VMM is no longer required in R2 as its their Out of the box.

We will now go through the steps via Powershell to bring these disks under the control of VMM.

Add a storage provider

Obtain the iSCSI Target Server local administrative credentials that are based on user name and password as follows:

$Cred = Get-Credential

Note*- Any account that is part of the Local Administrators group is sufficient.

Create a Run As account in VMM as follows:

$Runas = New-SCRunAsAccount -Name “iSCSIRunas” -Credential $Cred

Add the storage provider as follows:

Add-SCStorageProvider -Name “Microsoft iSCSI Target Provider” -RunAsAccount $Runas -ComputerName “” -AddSmisWmiProvider

Review the storage array attributes as follows:

$array = Get-SCStorageArray -Name “

View available storage pools as follows:

$array.StoragePools

Add pools from iSCSI Target Server for VMM management

*Note – Note down the name of your iSCSI Drive name
e.g.
Powershell

Get the specific storage pool to add as follows:

$pool = Get-SCStoragePool -Name “MS iSCSITarget Concrete: D:”

Create a storage classification, if none existed, as follows:

$class = New-SCStorageClassification -Name “GoldStorage”

Add the storage pool to VMM as follows:

Set-SCStorageArray -AddStoragePoolToManagement $pool -StorageArray $pool.StorageArray -StorageClassification $class

Allocate the storage pool to a virtualization server group as follows:

Set-SCStoragePool -StoragePool $pool -AddVMHostGroup (Get-SCVMHostGroup -Name “All Hosts”)

Create a LUN

Create an iSCSI logical unit number (LUN) as follows:

$LUN = New-SCStorageLogicalUnit -Name “GoldLun1” -StoragePool $pool -DiskSizeMB 50000

Allocate the LUN to the virtualization server group as follows:

Set-SCStorageLogicalUnit -StorageLogicalUnit $LUN -VMHostGroup (Get-SCVMHostGroup -Name “All Hosts”)

Assign the LUN to the host group as follows:

$host = Get-SCVMhost -ComputerName

Add the host machine to the virtualization server group as follows:

Register-SCStorageLogicalUnit -StorageLogicalUnit $LUN -VMHost $host

Many of these actions can be achieved in the console but Powershell allows multiple repetitive actions if the need arises.