Modifying Icons in vRA with PowerShell
There have recently been a number of blog posts around modifying the All Services icon in vRA, and how to change it programmatically:
- http://www.vmtocloud.com/how-to-change-the-vra-7-2-all-services-icon/ - curl
- https://virtualbrakeman.wordpress.com/2017/03/17/replacing-the-all-services-icon-in-vrealize-automation/ - Python
- http://read.virtualizeplanet.com/?p=1539 - .Net
- http://michaelpoore.com/2017/03/how-to-change-the-vra-7-2-all-services-icon-using-vro/ - vRO
We had a new feature request open in PowervRA for a while to do the same thing, so I figured it would be a good time to go and add it, so that the same change to the icon could be done from PowerShell. We decided to take a slightly more generic approach than just the All Services icon and make it possible to upload any icon and use it to modify any service or other element within vRA that supports modifying the icon via the API.
So in release 2.1 of PowervRA you will find some new functions for working with icons:
Modify the All Services Icon
Note: Modifying the All Services icon will affect all vRA tenants and requires admin permission to the default tenant. Ensure you are comfortable with this before going ahead!
The icon for All Services is known within vRA as cafe_default_icon_genericAllServices. You can find out more about it with Get-vRAIcon:
To update it, use Import-vRAIcon. The API documentation lets us know that it will either create a new icon or overwrite an existing one. Since the All Services icon already exists, it will be overwritten when you import a new one:
You can also set it back to the original brick icon with Remove-vRAIcon, since the API description states that for deleting an icon which is one of the default system icons, it will be reverted to its default state:
Modify a Custom Service
Note: for this piece you will need admin permissions in the Tenant the Service belongs to
Modifying the icon for your own created service is very straightforward process: import a new icon to the Catalog Service and then update the existing service with the new icon. In this example we’ll modify the icon for Service02:
We can find the name of the currently used icon with Get-vRAService and see that the default icon name is cafe_default_icon_genericService:
To change it, do the following:
Modify a Catalog Item
Note: for this piece you will need admin permissions in the Tenant the Catalog Item belongs to
As mentioned, we’re not just restricted to modifying Service icons, other icons can be changed too. For example we can update the icon of a Catalog Item. Again upload an icon first, then update the Catalog Item with it:
We can find the name of the currently used icon with Get-vRACatalogItem and see that the icon name is vcoIcon_256x256.png:
To update, use the following: