diff --git a/CHANGELOG.md b/CHANGELOG.md index 8209d6bd..3171f937 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ - Added `Invoke-UndoInvSolutionInterop` cmdlet to perform the removal of solution interoperability configuration for Intelligent Network Visibility. - Added `Invoke-CbwSolutionInterop` cmdlet to perform solution interoperability configuration for Cloud-Based Workload Protection. - Added `Invoke-UndoCbwSolutionInterop` cmdlet to perform the removal of solution interoperability configuration for Cloud-Based Workload Protection. +- Added `Remove-AriaNetworksDataSource` cmdlet to remove a data source from VMware Aria Operations for Networks. +- Added `New-AriaNetworksvCenterDataSource` cmdlet to add a vCenter Server in VMware Aria Operations for Networks. - Fixed `Invoke-IamDeployment` and `Invoke-UndoIamDeployment` cmdlets where it was not discovering the NSX service accounts correctly. - Enhanced `config.PowerValidatedSolutions` configuration file to include VMware Cloud Foundation 5.2 support. - Enhanced `Install-vRSLCMCertificate` cmdlet to perform additional checks that a Microsoft Certificate Authority is configured in SDDC Manager. diff --git a/PowerValidatedSolutions.psd1 b/PowerValidatedSolutions.psd1 index 20284878..20f911db 100644 --- a/PowerValidatedSolutions.psd1 +++ b/PowerValidatedSolutions.psd1 @@ -11,7 +11,7 @@ RootModule = 'PowerValidatedSolutions.psm1' # Version number of this module. - ModuleVersion = '2.11.0.1007' + ModuleVersion = '2.11.0.1008' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/PowerValidatedSolutions.psm1 b/PowerValidatedSolutions.psm1 index 0eb3d6fe..12c355d7 100644 --- a/PowerValidatedSolutions.psm1 +++ b/PowerValidatedSolutions.psm1 @@ -18456,7 +18456,7 @@ Function Update-vROPSAdapterCollecterGroup { $json | Add-Member -notepropertyname 'collectorGroupId' -notepropertyvalue $collectorGroupId $json | ConvertTo-Json -Depth 4 | Out-File .\updateAdapter.json Set-vROPSAdapter -json .\updateAdapter.json | Out-Null - if ((Get-vROPSAdapter -id $json.id).collectorGroupId -eq $collectorGroupId) { + if ((Get-vROPSAdapter -id $json.id).collectorGroupId -eq $collectorGroupId) { Write-Output "Assigning Collector Group ($collectorGroupName) to instance ($($adapter.resourceKey.name)): SUCCESSFUL" } else { Write-Error "Assigning Collector Group ($collectorGroupName) to instance ($($adapter.resourceKey.name)): POST_VALIDATION_FAILED" @@ -50288,6 +50288,121 @@ Function Get-AriaNetworksDataSource { } Export-ModuleMember -Function Get-AriaNetworksDataSource +Function Remove-AriaNetworksDataSource { + <# + .SYNOPSIS + Remove a data source from a VMware Aria Operations for Networks deployment. + + .DESCRIPTION + The Remove-AriaNetworksDataSource cmdlet removes a data source from a VMware Aria Operations for Networks deployment. + + .PARAMETER dataSourceType + The type of the data source, in one of nsxt or vcenter. + + .PARAMETER id + The id of the data source in the VMware Aria Operations for Networks deployment. + + .EXAMPLE + Remove-AriaNetworksDataSource -dataSourceType vcenter -id 15832:902:2623605245375371420 + This example removes the vCenter Server which is configured as a data source in a VMware Aria Operations for Networks deployment with a specific ID. + + #> + + Param ( + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$id, + [Parameter (Mandatory = $true)] [ValidateSet('vcenter', 'nsxt')] [ValidateNotNullOrEmpty()] [String]$dataSourceType + ) + + Try { + if ($ariaNetworksAppliance) { + if ($dataSourceType -eq 'vcenter') { + $uri = "https://$ariaNetworksAppliance/api/ni/data-sources/vcenters/$id" + (Invoke-RestMethod -Method 'DEL' -Uri $uri -Headers $ariaNetworksHeader).results + } elseif($dataSourceType -eq 'nsxt') { + $uri = "https://$ariaNetworksAppliance/api/ni/data-sources/nsxt-managers/$id" + (Invoke-RestMethod -Method 'DEL' -Uri $uri -Headers $ariaNetworksHeader).results + } else { + Write-Error "Not connected to VMware Aria Operations for Networks, run Request-AriaNetworksToken and try again" + } + } + } Catch { + Write-Error $_.Exception.Message + } +} +Export-ModuleMember -Function Remove-AriaNetworksDataSource + +Function New-AriaNetworksvCenterDataSource { + <# + .SYNOPSIS + Add a new vCenter Server data source to VMware Aria Operations for Networks. + + .DESCRIPTION + The New-AriaNetworksvCenterDataSource cmdlet allows a user to add in a vCenter Server as a new data source in VMware Aria Operations for Networks in order to collect network flow data. + + .EXAMPLE + New-AriaNetworksvCenterDataSource -fqdn sfo-m01-vc01.sfo.rainpole.io -username svc-inv-vsphere -password VMw@re1! -nickname "sfo-m01-vc01 - Management Domain vCenter Server" -CollectorId 15832:901:1711011916294613031 -enabled true + This example adds a vCenter Server as a new data source in VMware Aria Operations for Networks. + + .PARAMETER fqdn + The fqdn of the vCenter Server to add as a data source. + + .PARAMETER username + The username to use for authentication. + + .PARAMETER password + The password to use for authentication. + + .PARAMETER nickname + The nickname to use for this data source in VMware Aria Operations for Networks. + + .PARAMETER collectorId + The id of the VMware Aria Operations for Networks collector node where the vCenter data source will be connected. + + .PARAMETER enabled + The parameter to enable the datasource. + #> + + Param ( + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$fqdn, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$username, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$password, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$nickname, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$collectorId, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$enabled + ) + + if ( -not $PsBoundParameters.ContainsKey("fqdn") -or ( -not $PsBoundParameters.ContainsKey("username") -or ( -not $PsBoundParameters.ContainsKey("password") -or ( -not $PsBoundParameters.ContainsKey("nickname") -or ( -not $PsBoundParameters.ContainsKey("collectorId") -or ( -not $PsBoundParameters.ContainsKey("enabled"))))))){ + Write-Error "Please Provide the necessary parameters and try again" + } + + Try { + $uri = "https://$ariaNetworksAppliance/api/ni/data-sources/vcenters" + $body = '{ + "fqdn": "'+ $fqdn +'", + "proxy_id": "'+ $collectorId +'", + "nickname": "'+ $nickname +'", + "enabled": '+ $enabled +', + "credentials": { + "username": "'+ $username +'", + "password": "'+ $password +'" + }, + "ipfix_request": { + "enable_all": true + } + }' + + if ($PSEdition -eq 'Core') { + $DataSourceResponse = Invoke-RestMethod -Uri $uri -Method 'POST' -Headers $ariaNetworksHeader -Body $body -SkipCertificateCheck # PS Core has -SkipCertificateCheck implemented, PowerShell 5.x does not + } else { + $DataSourceResponse = Invoke-RestMethod -Uri $uri -Method 'POST' -Headers $ariaNetworksHeader -Body $body + Write-Output "Successfully added $vcenter to VMware Aria Operations for Networks as a Data Source" + } + } Catch { + Write-Error $_.Exception.Message + } +} +Export-ModuleMember -Function New-AriaNetworksvCenterDataSource + #EndRegion End VMware Aria Operations for Networks Functions ###### ################################################################################### diff --git a/docs/documentation/functions/aria-suite/aria-operations-networks/New-AriaNetworksvCenterDataSource.md b/docs/documentation/functions/aria-suite/aria-operations-networks/New-AriaNetworksvCenterDataSource.md new file mode 100644 index 00000000..00a161ba --- /dev/null +++ b/docs/documentation/functions/aria-suite/aria-operations-networks/New-AriaNetworksvCenterDataSource.md @@ -0,0 +1,145 @@ +# New-AriaNetworksvCenterDataSource + +## Syynopsis + +Add a new vCenter Server data source to VMware Aria Operations for Networks. + +## Syntax + +```powershell +New-AriaNetworksvCenterDataSource [-fqdn] [-username] [-password] + [-nickname] [-collectorId] [-enabled] [-ProgressAction ] + [] +``` + +## Description + +The `New-AriaNetworksvCenterDataSource` cmdlet allows a user to add in a vCenter Server as a new data source in VMware Aria Operations for Networks in order to collect network flow data. + +## Examples + +### Example 1 + +```powershell +New-AriaNetworksvCenterDataSource -fqdn sfo-m01-vc01.sfo.rainpole.io -username svc-inv-vsphere -password VMw@re1! -nickname "sfo-m01-vc01 - Management Domain vCenter Server" -CollectorId 15832:901:1711011916294613031 -enabled true +``` + +This example adds a vCenter Server as a new data source in VMware Aria Operations for Networks. + +## Parameters + +### -fqdn + +The fqdn of the vCenter Server to add as a data source. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -username + +The username to use for authentication. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -password + +The password to use for authentication. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -nickname + +The nickname to use for this data source in VMware Aria Operations for Networks. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 4 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -collectorId + +The id of the VMware Aria Operations for Networks collector node where the vCenter Server data source will be connected. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 5 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -enabled + +The parameter to enable the datasource. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 6 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction + +Progress action. + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### Common Parameters + +This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`, `-InformationAction`, `-InformationVariable`, `-OutVariable`, `-OutBuffer`, `-PipelineVariable`, `-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/docs/documentation/functions/aria-suite/aria-operations-networks/Remove-AriaNetworksDataSource.md b/docs/documentation/functions/aria-suite/aria-operations-networks/Remove-AriaNetworksDataSource.md new file mode 100644 index 00000000..874e605a --- /dev/null +++ b/docs/documentation/functions/aria-suite/aria-operations-networks/Remove-AriaNetworksDataSource.md @@ -0,0 +1,80 @@ +# Remove-AriaNetworksDataSource + +## Synopsis + +Remove a data source from a VMware Aria Operations for Networks deployment. + +## Syntax + +```powershell +Remove-AriaNetworksDataSource [-id] [-dataSourceType] [-ProgressAction ] + [] +``` + +## Description + +The `Remove-AriaNetworksDataSource` cmdlet removes a data source from a VMware Aria Operations for Networks deployment. + +## Examples + +### Example 1 + +```powershell +Remove-AriaNetworksDataSource -dataSourceType vcenter -id 15832:902:2623605245375371420 +``` + +This example removes the vCenter Server which is configured as a data source in a VMware Aria Operations for Networks deployment with a specific ID. + +## Parameters + +### -id + +The id of the data source in the VMware Aria Operations for Networks deployment. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -dataSourceType + +The type of the data source, in one of `nsxt` or `vcenter`. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction + +Progress action. + +```yaml +Type: ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### Common Parameters + +This cmdlet supports the common parameters: `-Debug`, `-ErrorAction`, `-ErrorVariable`, `-InformationAction`, `-InformationVariable`, `-OutVariable`, `-OutBuffer`, `-PipelineVariable`, `-Verbose`, `-WarningAction`, and `-WarningVariable`. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). diff --git a/mkdocs.yml b/mkdocs.yml index 338eba0e..0d9068ed 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -409,7 +409,9 @@ nav: - documentation/functions/aria-suite/aria-operations-networks/Export-AriaNetworksJsonSpec.md - documentation/functions/aria-suite/aria-operations-networks/Get-AriaNetworksDataSource.md - documentation/functions/aria-suite/aria-operations-networks/Get-AriaNetworksNodes.md + - documentation/functions/aria-suite/aria-operations-networks/New-AriaNetworksvCenterDataSource.md - documentation/functions/aria-suite/aria-operations-networks/New-AriaNetworksDeployment.md + - documentation/functions/aria-suite/aria-operations-networks/Remove-AriaNetworksDataSource.md - documentation/functions/aria-suite/aria-operations-networks/Request-AriaNetworksToken.md - documentation/functions/aria-suite/aria-operations-networks/Undo-AriaNetworksDeployment.md - Aria Suite Lifecycle: