When adding Tags for port groups through PowerCLI, Unable to view them in vCenter UI.
search cancel

When adding Tags for port groups through PowerCLI, Unable to view them in vCenter UI.

book

Article ID: 376740

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

Symptoms:

  • When trying to add a Tag for port groups using PowerCLI, it succeeds, but is not visible in vCenter UI.
  • You are using Standard switches 

 

Example: 

New-TagAssignment -Tag $tag -Entity $portgroup

Tag                                      Entity
---                                      ------
Test_1/TEST                       11_22_33_TST

Environment

vCenter Server 7.0

PowerCLI 

Cause

Port groups of standard switches are NOT Managed Objects - vCenter UI visualizes tags which are assigned to Managed Objects

With Distributed Switches and Port groups, the matching virtual networks are backed up by the same Managed Object. 

 

Note: PowerCLI and the VAPI allow assigning tags to objects that are not managed objects by using the so-called dynamic IDs that are programmatically generated. These tags can be observed only from PowerCLI and not the vSphere UI.

Resolution

vCenter Server UI is visualizing only tags assigned to Managed Objects (objects visualized in the Inventory tree). Standard port groups are not shown in the inventory tree. What you see there is the Virtual Network object, whose name matches the name of the standard port group.


If you try to assign the tag to the VirtualNetwork object rather than to the VirtualPortgroup, this tag will be visible in the UI:

$myVNet = Get-VirtualNetwork -Name "test"
$mytag = Get-Tag -Name "tag"
New-TagAssignment -Tag $mytag -Entity $myVNet

On the contrary, when working with distributed switches and distributed port groups, the distributed port group and its matching virtual network are backed by the same managed object:

$dvPgNet = Get-VirtualNetwork DPortGroup
$dvPgNet.ExtensionData.MoRef

Type                        Value
----                        -----
DistributedVirtualPortgroup dvportgroup-21


$dvPortGroup = Get-VDPortgroup DPortGroup
$dvPortGroup.ExtensionData.MoRef

Type                        Value
----                        -----
DistributedVirtualPortgroup dvportgroup-21

 

So, when working with distributed port groups, assigning tags to either of the objects will be visualized the same way in the UI.