PowerCLI and VVols Part III: Getting VVol UUIDs from the FlashArray

The next step if you want to do correlation between a VMware VVol VMDK pointer and its corresponding FlashArray volume using PowerCLI.

As a review, here are the previous posts in this series:

If you followed part 2, you now have your VVol UUID, so how do I correlate it to a volume? Well you could use the VM name and then look at the name of the volume and size, but this is not scientific, and certainly not exact.

Let me start with this: the FlashArray VVol implementation uses key/value tags for VVol information–we did not create a custom database for this stuff. Doing so is a step in the complexity direction–so we used something we already had: tags. The benefit of this, besides being flexible, is that they are stored with your volumes and their data, so there is no special database to backup/protect. Currently, tags are not really exposed to end users though. This is on purpose–we are still working on how to properly expose them in the GUI and how to handle some other parts around their use–so fully exposed tagging management is not quite ready.

But with that being said, we realized that the ability to pull this information was important. So this is available in our REST API.

Please note that the ability to pull tags from the FlashArray is still in tech preview, so the APIs or process to do so may change between now and when the tag feature is officially GA.

Eagle-eyed API document readers may notice this is not documented and they would be correct. I already make extensive use of tag retrieval in the VVol Workflow Package I wrote for vRO.

So how do you do it? Well in the body of certain REST calls to the array, you can query for tags. There are a few places to do this today. They are all GET calls (read-only data retrievals):

  • Get all of the tags for all volumes
  • Get tags for a specific volume
  • Get tags for all snapshots
  • Get tags for a specific snapshot
  • Get tags for a specific volumes snapshots

All of the REST calls are similar just with an additional parameter tags=true.

The call to get a volume information is like below:

GET https://pure01.example.com/api/1.14/volume

The call to get a volumes tags would be like below:

GET https://pure01.example.com/api/1.14/volume?tags=true

The response is returned in JSON and you would see the tags returned.

A tag has three parts:

  • Value: this is the actual data you want to pull out.
  • Name: this is the name of the object the tag is assigned to, so either a snapshot or a volume
  • Key: this is the name of the tag.

So how do I pull this with PowerCLI, or rather PowerShell?

Like I said, since tags are still in tech preview it is not yet built into our PowerShell SDK to do this. So you need to it the old fashioned way at this point.

Directly authenticate with PowerShell and use invoke-restmethod. I’ve walked through authenticating here:


So check that out if you want to know how. At this point, I will assume you have authenticated and are ready to move on.

Note you might need to use both of these posts to connect depending on your certificate situation. If you get an error at retrieving the API token, look at these:



So if I want to pull tags for all of the volumes now, I can use invoke-restmethod to get them. The command would look like this:

Invoke-RestMethod -Method Get -Uri "https://${purevip}/api/1.14/volume?tags=true" -WebSession $Session

When run, there will be a response with tags for all of the volumes (in this case). I will store it in a variable called $allTags:

$allTags = Invoke-RestMethod -Method Get -Uri "https://${purevip}/api/1.14/volume?tags=true"
-WebSession $Session

$allTags is an array of the tags. So $allTags[0] would return to me the first listing.

$allTags[0].key would give me the tag name (remember the name listing is the volume name, key is the name of the tag itself, i.e. key/value)

Now you can either parse this with PowerShell, or you can use our REST filtering. So if I want to find the volume with rfc4122.e09df235-ce50-4b27-9e64-201d577af6eb as the VVol UUID, I would change it to look like so:

Invoke-RestMethod -Method Get -Uri "https://${purevip}/api/1.14/volume?tags=true&filter=value='rfc4122.e09df235-ce50-4b27-9e64-201d577af6eb'" -WebSession $Session

In the filtering case the “name” column will contain the volume name you are looking for! You can then do what you need to with that volume (snapshot, report on, etc.).

So combining what the previous post showed, I have written a script to do this.

I have decided to formalize my scripts a bit more though–I have made a PowerShell module this time around, that you can then import and include my scripts easily into your own. I will work on adding more cmdlets into my module (and adding my existing scripts into it).

So simply go to your module directory on your host you want to run the script and create a directory with the same name as my module:

Which is usually here:

C:\Program Files\WindowsPowerShell\Modules

Name the folder Cody.PureStorage.FlashArray.VVol

Then plop my .psm1 file in there, you can get it here:


Then run:

import-module Cody.PureStorage.FlashArray.VVol

You can now use whatever cmdlets are in there. Right now I have three:

  • new-pureflasharrayRestSession
  • remove-pureflasharrayRestSession
  • get-faVolumeNameFromVvolUuid

    You can run them interactively or as a cmdlet in a script.

The second line runs my cmdlet for creating a REST session to a FlashArray with invoke-restmethod. The cmdlet returns the REST session itself you can use elsewhere. You can either run it like I did, and it will prompt for credentials, or you can pass them in with a PSCredential object created by running get-credential.

Then you can run the VVol UUID script. It can be run interactively, meaning you choose a VM then a VMDK and it will return you the FlashArray volume name, or you can pass in a VVol UUID and it will just return the volume name.

You must pass in a REST session for the FlashArray and the FlashArray mgmt address either way. If you do the VM choice part, you need to connect to vCenter first with connect-viserver.


The cmdlet returns the volume name from the FlashArray.

Or you can pass everything in directly.

Enjoy! I will be adding a lot to this module moving forward, so there will be much more than 3 cmdlets.

5 thoughts on “PowerCLI and VVols Part III: Getting VVol UUIDs from the FlashArray”

  1. These posts are very helpful!

    One question I have is how can we map exactly vvols from the Pure side to the VMware side so that we can determine programmatically if there are orphaned volumes or volume groups?
    We can’t use # of connections for the volumes as it will show a count of 0 for normal situations where the vm is powered off. The volume group name may contain a partial piece of the original vm name which may have changed so that won’t do the trick.
    I am guessing the secret is the hex #s in the volume/volume group names but I have been unable to match them to anything meaningful.
    For example, one of our volume group names is vvol-0edtest-rhel7b-0ef6be94-vg. Can we correlate 0ef6be94 with something in vmware? Similarly, a volume in that group is called Config-1668c742, Can we correlate that string with something?

    Thanks and much appreciated,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.