Sharing vApps in vCloud with PowerCLI

June 11, 2013

Table of Contents

Some times vCloud Directors give the organization users grainy control over the the level of access users have to vApps , this is all controlled through the the vCloud API and powerCLI. The code below takes vApps‘ current settings and allow the user to modify the vApp:

# Get our required Objects

$vapp = Get-CIVApp “My vApp”

$user = Get-CIUser “UserToBeAdded”

# Access Level can be one of: ReadOnly,Change,FullControl

$accessLevel = “Change”

# Get current access policy from vApp

$access = $vapp.ExtensionData.GetControlAccess()

if (!$access.AccessSettings)

{

 $access.AccessSettings = New-Object VMware.VimAutomation.Cloud.Views.AccessSettings

}

# New Access object

$newAccess = new-object VMware.VimAutomation.Cloud.Views.AccessSetting

$newAccess.Subject = New-Object VMware.VimAutomation.Cloud.Views.Reference

# Set our access level

$newAccess.AccessLevel = $accessLevel

# Insert user href

$newAccess.Subject.Href = $user.ExtensionData.Href

$newAccess.Subject.Type = “application/vnd.vmware.admin.user+xml”

# Add new access to vApp access settings object

$access.AccessSettings.AccessSetting += $newAccess

#Send new Access config

$vapp.ExtensionData.ControlAccess($access)

A user is also able to control the default access policyand the level-using:

$access.IsSharedToEveryone and $access

Home

Share on
Facebook
Twitter
LinkedIn
Pinterest
More posts

Dedicated Servers Quick Guide

What is a Dedicated Servers? Why bother using a dedicated server over a VPS or Shared Hosting?A dedicated server is a server 100% dedicated to your website/project or business needs.

vMA 5.1 Patch 1 Released

Expendable news item here too good not to be posted.  For those who may have missed it, VMware has released an update to the vSphere Management Assistant (vMA) 5.1 appliances

Setup Nginx Website Easy Simple Guide

What is needed for a quick Nginx server and website setup? A Dedicated or VPS Server A compatible operating system 247Rack recommends: Centos OS A domain name pointed to the

VMware Fusion 6.0.2 Update Released

VMware have just released a maintainance update (6.0.2) for their Mac based Fusion product. This minor update addresses a number of bug fixes to the recently released Fusion 6.X virtualization

Storage Center 5.6 Released

There is a release of the storage center 5.6 and it comes with some features and platform support currently built into storage center 6.x as well as a large number

Get 90% Discount

First 3 People gets the Bonus!
Don't Miss Out Our Big Sale

Get 0-90% On All
247Rack Services

247Rack

The Sale Is Until The End Of March