diff --git a/src/Functions/Public/catalog-service/Set-vRAEntitlement.ps1 b/src/Functions/Public/catalog-service/Set-vRAEntitlement.ps1 index 094e2374..75a871ff 100644 --- a/src/Functions/Public/catalog-service/Set-vRAEntitlement.ps1 +++ b/src/Functions/Public/catalog-service/Set-vRAEntitlement.ps1 @@ -1,4 +1,4 @@ -function Set-vRAEntitlement { +function Set-vRAEntitlement { <# .SYNOPSIS Update an existing entitlement @@ -46,6 +46,9 @@ .EXAMPLE Set-vRAEntitlement -Id "e5cd1c84-3b76-4ae9-9f2e-35114da6cfd2" -Name "Updated Name" -Description "Updated Description" -Principals "user@vsphere.local" -EntitledCatalogItems "Centos" -EntitledServices "A service" -EntitledResourceOperations "Infrastructure.Machine.Action.PowerOff" -Status ACTIVE + .EXAMPLE + Set-vRAEntitlement -Id "e5cd1c84-3b76-4ae9-9f2e-35114da6cfd2" -Name "Updated Name" -Description "Updated Description" -AllUsers:$true + .EXAMPLE Get-vRAEntitlement -Name "Entitlement 1" | Set-vRAEntitlement -Description "Updated description!" @@ -88,7 +91,11 @@ [Parameter(Mandatory=$false)] [ValidateNotNullOrEmpty()] - [bool]$LocalScopeForActions + [bool]$LocalScopeForActions, + + [Parameter(Mandatory=$false, ParameterSetName='AllUsers')] + [ValidateNotNullOrEmpty()] + [bool]$AllUsers ) @@ -246,6 +253,15 @@ $Entitlement.localScopeForActions = $LocalScopeForActions } + + # --- Update AllUsers + if ($PSBoundParameters.ContainsKey("AllUsers")) { + + Write-Verbose -Message "Updating AllUsers: $($Entitlement.AllUsers) >> $($AllUsers)" + $Entitlement.AllUsers = $AllUsers + + } + # --- Convert the modified entitlement to json $Body = $Entitlement | ConvertTo-Json -Depth 50 -Compress @@ -273,4 +289,4 @@ } -} \ No newline at end of file +} diff --git a/src/Functions/Public/identity/Invoke-vRATenantDirectorySync.ps1 b/src/Functions/Public/identity/Invoke-vRATenantDirectorySync.ps1 new file mode 100644 index 00000000..b41100d0 --- /dev/null +++ b/src/Functions/Public/identity/Invoke-vRATenantDirectorySync.ps1 @@ -0,0 +1,66 @@ +function Invoke-vRATenantDirectorySync { +<# + .SYNOPSIS + Sync an identity store + + .DESCRIPTION + Sync an identity store + + .PARAMETER Id + Specify the ID of a Tenant + + .PARAMETER Domain + Specify the Domain of a Tenant Directory + + .INPUTS + System.String + + .OUTPUTS + System.Management.Automation.PSObject. + + .EXAMPLE + Invoke-vRATenantDirectorySync -Id Tenant01 -Domain vrademo.local + + .EXAMPLE + Invoke-vRATenantDirectorySync -Id Tenant01 -Domain vrademo.local,test.local +#> +[CmdletBinding(SupportsShouldProcess,ConfirmImpact="High")][OutputType('System.Management.Automation.PSObject')] + + Param ( + + [parameter(Mandatory=$true)] + [ValidateNotNullOrEmpty()] + [String]$Id, + + [parameter(Mandatory=$false)] + [ValidateNotNullOrEmpty()] + [String[]]$Domain + ) + + # --- Test for vRA API version + xRequires -Version 7.4 + +try { + + foreach ($TenantDomain in $Domain){ + + $URI = "/identity/api/tenants/$($Id)/directories/$($TenantDomain)/sync " + if ($PSCmdlet.ShouldProcess($Id)){ + + # --- Run vRA REST Request + Invoke-vRARestMethod -Method POST -URI $URI + + Get-vRATenantDirectoryStatus -Id $Id -Domain $Domain + } + # --- Run vRA REST Request + Invoke-vRARestMethod -Method POST -URI $URI + + Get-vRATenantDirectoryStatus -Id $Id -Domain $Domain + + } +} +catch [Exception]{ + + throw +} +} diff --git a/src/PowervRA.psd1 b/src/PowervRA.psd1 index 5b85b4f1..fc34b6de 100644 --- a/src/PowervRA.psd1 +++ b/src/PowervRA.psd1 @@ -69,7 +69,7 @@ PowerShellVersion = '5.1' # NestedModules = @() # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. -FunctionsToExport = @('Add-vRAPrincipalToTenantRole','Add-vRAReservationNetwork','Add-vRAReservationStorage','Connect-vRAServer','Disconnect-vRAServer','Export-vRAIcon','Export-vRAPackage','Get-vRAApplianceServiceStatus','Get-vRAAuthorizationRole','Get-vRABlueprint','Get-vRABusinessGroup','Get-vRACatalogItem','Get-vRACatalogItemRequestTemplate','Get-vRACatalogPrincipal','Get-vRAComponentRegistryService','Get-vRAComponentRegistryServiceEndpoint','Get-vRAComponentRegistryServiceStatus','Get-vRAContent','Get-vRAContentData','Get-vRAContentType','Get-vRAEntitledCatalogItem','Get-vRAEntitledService','Get-vRAEntitlement','Get-vRAExternalNetworkProfile','Get-vRAGroupPrincipal','Get-vRAIcon','Get-vRANATNetworkProfile','Get-vRANetworkProfileIPAddressList','Get-vRANetworkProfileIPRangeSummary','Get-vRAPackage','Get-vRAPackageContent','Get-vRAPropertyDefinition','Get-vRARequest','Get-vRARequestDetail','Get-vRAReservation','Get-vRAReservationComputeResource','Get-vRAReservationComputeResourceMemory','Get-vRAReservationComputeResourceNetwork','Get-vRAReservationComputeResourceResourcePool','Get-vRAReservationComputeResourceStorage','Get-vRAReservationPolicy','Get-vRAReservationTemplate','Get-vRAReservationType','Get-vRAResource','Get-vRAResourceAction','Get-vRAResourceActionRequestTemplate','Get-vRAResourceMetric','Get-vRAResourceOperation','Get-vRAResourceType','Get-vRARoutedNetworkProfile','Get-vRAService','Get-vRAServiceBlueprint','Get-vRASourceMachine','Get-vRAStorageReservationPolicy','Get-vRATenant','Get-vRATenantDirectory','Get-vRATenantDirectoryStatus','Get-vRATenantRole','Get-vRAUserPrincipal','Get-vRAUserPrincipalGroupMembership','Get-vRAVersion','Import-vRAIcon','Import-vRAPackage','Invoke-vRADataCollection','Invoke-vRARestMethod','New-vRABusinessGroup','New-vRAEntitlement','New-vRAExternalNetworkProfile','New-vRAGroupPrincipal','New-vRANATNetworkProfile','New-vRANetworkProfileIPRangeDefinition','New-vRAPackage','New-vRAPropertyDefinition','New-vRAReservation','New-vRAReservationNetworkDefinition','New-vRAReservationPolicy','New-vRAReservationStorageDefinition','New-vRARoutedNetworkProfile','New-vRAService','New-vRAStorageReservationPolicy','New-vRATenant','New-vRATenantDirectory','New-vRAUserPrincipal','Remove-vRABusinessGroup','Remove-vRAExternalNetworkProfile','Remove-vRAGroupPrincipal','Remove-vRAIcon','Remove-vRANATNetworkProfile','Remove-vRAPackage','Remove-vRAPrincipalFromTenantRole','Remove-vRAPropertyDefinition','Remove-vRAReservation','Remove-vRAReservationNetwork','Remove-vRAReservationPolicy','Remove-vRAReservationStorage','Remove-vRARoutedNetworkProfile','Remove-vRAService','Remove-vRAStorageReservationPolicy','Remove-vRATenant','Remove-vRATenantDirectory','Remove-vRAUserPrincipal','Request-vRACatalogItem','Request-vRAResourceAction','Set-vRABusinessGroup','Set-vRACatalogItem','Set-vRAEntitlement','Set-vRAExternalNetworkProfile','Set-vRANATNetworkProfile','Set-vRAReservation','Set-vRAReservationNetwork','Set-vRAReservationPolicy','Set-vRAReservationStorage','Set-vRARoutedNetworkProfile','Set-vRAService','Set-vRAStorageReservationPolicy','Set-vRATenant','Set-vRATenantDirectory','Set-vRAUserPrincipal','Test-vRAPackage') +FunctionsToExport = @('Add-vRAPrincipalToTenantRole','Add-vRAReservationNetwork','Add-vRAReservationStorage','Connect-vRAServer','Disconnect-vRAServer','Export-vRAIcon','Export-vRAPackage','Get-vRAApplianceServiceStatus','Get-vRAAuthorizationRole','Get-vRABlueprint','Get-vRABusinessGroup','Get-vRACatalogItem','Get-vRACatalogItemRequestTemplate','Get-vRACatalogPrincipal','Get-vRAComponentRegistryService','Get-vRAComponentRegistryServiceEndpoint','Get-vRAComponentRegistryServiceStatus','Get-vRAContent','Get-vRAContentData','Get-vRAContentType','Get-vRAEntitledCatalogItem','Get-vRAEntitledService','Get-vRAEntitlement','Get-vRAExternalNetworkProfile','Get-vRAGroupPrincipal','Get-vRAIcon','Get-vRANATNetworkProfile','Get-vRANetworkProfileIPAddressList','Get-vRANetworkProfileIPRangeSummary','Get-vRAPackage','Get-vRAPackageContent','Get-vRAPropertyDefinition','Get-vRARequest','Get-vRARequestDetail','Get-vRAReservation','Get-vRAReservationComputeResource','Get-vRAReservationComputeResourceMemory','Get-vRAReservationComputeResourceNetwork','Get-vRAReservationComputeResourceResourcePool','Get-vRAReservationComputeResourceStorage','Get-vRAReservationPolicy','Get-vRAReservationTemplate','Get-vRAReservationType','Get-vRAResource','Get-vRAResourceAction','Get-vRAResourceActionRequestTemplate','Get-vRAResourceMetric','Get-vRAResourceOperation','Get-vRAResourceType','Get-vRARoutedNetworkProfile','Get-vRAService','Get-vRAServiceBlueprint','Get-vRASourceMachine','Get-vRAStorageReservationPolicy','Get-vRATenant','Get-vRATenantDirectory','Get-vRATenantDirectoryStatus','Get-vRATenantRole','Get-vRAUserPrincipal','Get-vRAUserPrincipalGroupMembership','Get-vRAVersion','Import-vRAIcon','Import-vRAPackage','Invoke-vRADataCollection','Invoke-vRARestMethod','New-vRABusinessGroup','New-vRAEntitlement','New-vRAExternalNetworkProfile','New-vRAGroupPrincipal','New-vRANATNetworkProfile','New-vRANetworkProfileIPRangeDefinition','New-vRAPackage','New-vRAPropertyDefinition','New-vRAReservation','New-vRAReservationNetworkDefinition','New-vRAReservationPolicy','New-vRAReservationStorageDefinition','New-vRARoutedNetworkProfile','New-vRAService','New-vRAStorageReservationPolicy','New-vRATenant','New-vRATenantDirectory','New-vRAUserPrincipal','Remove-vRABusinessGroup','Remove-vRAExternalNetworkProfile','Remove-vRAGroupPrincipal','Remove-vRAIcon','Remove-vRANATNetworkProfile','Remove-vRAPackage','Remove-vRAPrincipalFromTenantRole','Remove-vRAPropertyDefinition','Remove-vRAReservation','Remove-vRAReservationNetwork','Remove-vRAReservationPolicy','Remove-vRAReservationStorage','Remove-vRARoutedNetworkProfile','Remove-vRAService','Remove-vRAStorageReservationPolicy','Remove-vRATenant','Remove-vRATenantDirectory','Remove-vRAUserPrincipal','Request-vRACatalogItem','Request-vRAResourceAction','Set-vRABusinessGroup','Set-vRACatalogItem','Set-vRAEntitlement','Set-vRAExternalNetworkProfile','Set-vRANATNetworkProfile','Set-vRAReservation','Set-vRAReservationNetwork','Set-vRAReservationPolicy','Set-vRAReservationStorage','Set-vRARoutedNetworkProfile','Set-vRAService','Set-vRAStorageReservationPolicy','Set-vRATenant','Set-vRATenantDirectory','Set-vRATenantDirectorySync','Set-vRAUserPrincipal','Test-vRAPackage') # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = @()