From e187dd6815443090dbd0e65c1e3f440ffbe8890d Mon Sep 17 00:00:00 2001 From: Andy Beltz Date: Tue, 18 Jun 2024 18:11:53 -0600 Subject: [PATCH] feat: add-inv-function (#663) Added `Update-AriaNetworksvCenterDataSourceCredentials` cmdlet to update the credentials for a vCenter Server in VMware Aria Operations for Networks. Signed-off-by: Andy Beltz --- CHANGELOG.md | 1 + PowerValidatedSolutions.psd1 | 2 +- PowerValidatedSolutions.psm1 | 72 +++++++++- ...riaNetworksvCenterDataSourceCredentials.md | 134 ++++++++++++++++++ mkdocs.yml | 1 + 5 files changed, 205 insertions(+), 5 deletions(-) create mode 100644 docs/documentation/functions/aria-suite/aria-operations-networks/Update-AriaNetworksvCenterDataSourceCredentials.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0aebd1ff..7da7fb43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ - 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. - Added `New-AriaNetworksNsxtDataSource` cmdlet to add a NSX Manager in VMware Aria Operations for Networks. +- Added `Update-AriaNetworksvCenterDataSourceCredentials` cmdlet to update the credentials for a vCenter Server in VMware Aria Operations for Networks. - Added `Test-PrereqStretchedCluster` cmdlet to check for the existence of the vSphere VM Group for stretched clusters. - Added `Undo-SsoUser` cmdlet to support removing a user from vCenter Single Sign-On. - Fixed `Invoke-IamDeployment` and `Invoke-UndoIamDeployment` cmdlets where it was not discovering the NSX service accounts correctly. diff --git a/PowerValidatedSolutions.psd1 b/PowerValidatedSolutions.psd1 index 3d5eab90..5b2246f3 100644 --- a/PowerValidatedSolutions.psd1 +++ b/PowerValidatedSolutions.psd1 @@ -11,7 +11,7 @@ RootModule = 'PowerValidatedSolutions.psm1' # Version number of this module. - ModuleVersion = '2.11.0.1023' + ModuleVersion = '2.11.0.1024' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/PowerValidatedSolutions.psm1 b/PowerValidatedSolutions.psm1 index fc514d35..99daacae 100644 --- a/PowerValidatedSolutions.psm1 +++ b/PowerValidatedSolutions.psm1 @@ -2720,7 +2720,7 @@ Function Export-PdrJsonSpec { if ($pnpProtectedWorkbook.Workbook.Names["intelligent_operations_result"].Value -eq "Included") { $jsonObject | Add-Member -notepropertyname 'vmFolderOperations' -notepropertyvalue $pnpProtectedWorkbook.Workbook.Names["xreg_vrops_vm_folder"].Value $jsonObject | Add-Member -notepropertyname 'vmNameOperationsNodeA' -notepropertyvalue $pnpProtectedWorkbook.Workbook.Names["xreg_vrops_nodea_hostname"].Value - + $jsonObject | Add-Member -notepropertyname 'vmNameOperationsNodeB' -notepropertyvalue $pnpProtectedWorkbook.Workbook.Names["xreg_vrops_nodeb_hostname"].Value $jsonObject | Add-Member -notepropertyname 'vmNameOperationsNodeC' -notepropertyvalue $pnpProtectedWorkbook.Workbook.Names["xreg_vrops_nodec_hostname"].Value $jsonObject | Add-Member -notepropertyname 'vmListOperations' -notepropertyvalue ($pnpProtectedWorkbook.Workbook.Names["xreg_vrops_nodea_hostname"].Value + "," + $pnpProtectedWorkbook.Workbook.Names["xreg_vrops_nodeb_hostname"].Value + "," + $pnpProtectedWorkbook.Workbook.Names["xreg_vrops_nodec_hostname"].Value) @@ -3377,7 +3377,7 @@ Function Invoke-PdrDeployment { if (!$failureDetected) { Show-PowerValidatedSolutionsOutput -type NOTE -message "Performing Recovery Site Configuration Tasks for $solutionName" - + if (!$failureDetected) { Show-PowerValidatedSolutionsOutput -message "Create Anti-Affinity Rules for the Placeholder Virtual Machines in the Recovery VMware Cloud Foundation Instance" if (($wsaVmNames).Count -gt 1) { @@ -3408,7 +3408,7 @@ Function Invoke-PdrDeployment { $StatusMsg = Add-VmStartupRule -server $jsonInput.recovery.sddcManagerFqdn -user $jsonInput.recovery.sddcManagerUser -pass $jsonInput.recovery.sddcManagerPass -domain $jsonInput.recovery.mgmtSddcDomainName -ruleName $jsonInput.vmToVmRuleNameIdentity -vmGroup $jsonInput.drsGroupNameOperations -dependOnVmGroup $jsonInput.drsGroupNameIdentity -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) { $failureDetected = $true } } - + if ($ariaAutomationPresent) { $StatusMsg = Add-ClusterGroup -server $jsonInput.recovery.sddcManagerFqdn -user $jsonInput.recovery.sddcManagerUser -pass $jsonInput.recovery.sddcManagerPass -domain $jsonInput.recovery.mgmtSddcDomainName -drsGroupName $jsonInput.drsGroupNameAutomation -drsGroupVMs $jsonInput.vmListAutomation -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) { $failureDetected = $true } @@ -3506,7 +3506,7 @@ Function Invoke-UndoPdrDeployment { $StatusMsg = Undo-ClusterGroup -server $jsonInput.recovery.sddcManagerFqdn -user $jsonInput.recovery.sddcManagerUser -pass $jsonInput.recovery.sddcManagerPass -domain $jsonInput.recovery.mgmtSddcDomainName -drsGroupName $jsonInput.drsGroupNameOperations -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) { $failureDetected = $true } } - + if ($ariaAutomationPresent) { $StatusMsg = Undo-VmStartupRule -server $jsonInput.recovery.sddcManagerFqdn -user $jsonInput.recovery.sddcManagerUser -pass $jsonInput.recovery.sddcManagerPass -domain $jsonInput.recovery.mgmtSddcDomainName -ruleName $jsonInput.vmToVmRuleNameAutomation -WarningAction SilentlyContinue -ErrorAction SilentlyContinue -WarningVariable WarnMsg -ErrorVariable ErrorMsg messageHandler -statusMessage $StatusMsg -warningMessage $WarnMsg -errorMessage $ErrorMsg; if ($ErrorMsg) { $failureDetected = $true } @@ -51698,6 +51698,70 @@ Function New-AriaNetworksNsxtDataSource { } } Export-ModuleMember -Function New-AriaNetworksNsxtDataSource + +Function Update-AriaNetworksvCenterDataSourceCredentials { + <# + .SYNOPSIS + Update credentials for a vCenter Server data source credentials in VMware Aria Operations for Networks. + + .DESCRIPTION + The Update-AriaNetworksvCenterDataSourceCredentials cmdlet allows a user to update credentials for a vCenter Server data source in VMware Aria Operations for Networks. + + .EXAMPLE + Update-AriaNetworksvCenterDataSourceCredentials -id 15832:902:2623605245375371420 -CollectorId 15832:901:1711011916294613031 -fqdn sfo-m01-vc01.sfo.rainpole.io -username svc-inv-vsphere -password VMw@re1! -nickname "sfo-m01-vc01 - Management Domain vCenter Server" + This example updates the credentials for vCenter Server data source in VMware Aria Operations for Networks. + + .PARAMETER id + The id of the vCenter Server to update. + + .PARAMETER collectorId + The id of the VMware Aria Operations for Networks collector node where the vCenter Server data source is connected. + + .PARAMETER fqdn + The fully qualified domain name of the vCenter Server to update. + + .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. + #> + + Param ( + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$id, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$collectorId, + [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$fqdn, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$nickname, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$username, + [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$password + ) + + Try { + if ($ariaNetworksAppliance) { + $uri = "https://$ariaNetworksAppliance/api/ni/data-sources/vcenters/$id" + $body = @{ + entity_id = $id + proxy_id = $collectorId + fqdn = $fqdn + nickname = $nickname + credentials = @{ + username = $username + password = $password + } + } | ConvertTo-Json + Invoke-RestMethod -Uri $uri -Method 'PUT' -Headers $ariaNetworksHeader -Body $body -SkipCertificateCheck + } 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 Update-AriaNetworksvCenterDataSourceCredentials + #EndRegion End VMware Aria Operations for Networks Functions ###### ################################################################################### diff --git a/docs/documentation/functions/aria-suite/aria-operations-networks/Update-AriaNetworksvCenterDataSourceCredentials.md b/docs/documentation/functions/aria-suite/aria-operations-networks/Update-AriaNetworksvCenterDataSourceCredentials.md new file mode 100644 index 00000000..7b70177a --- /dev/null +++ b/docs/documentation/functions/aria-suite/aria-operations-networks/Update-AriaNetworksvCenterDataSourceCredentials.md @@ -0,0 +1,134 @@ +# Update-AriaNetworksvCenterDataSourceCredentials + +## Synopsis + +Update credentials for a vCenter Server data source credentials in VMware Aria +Operations for Networks. + +## Syntax + +```powershell +Update-AriaNetworksvCenterDataSourceCredentials [-id] [-collectorId] [[-fqdn] ] [-nickname] [-username] [-password] [] [-nickname] [-username] [-password] [] +``` + +## Description + +The `Update-AriaNetworksvCenterDataSourceCredentials` cmdlet allows a user to +update credentials for a vCenter Server data source in VMware Aria Operations +for Networks. + +## Examples + +### Example 1 + +```powershell +Update-AriaNetworksvCenterDataSourceCredentials -id 15832:902:2623605245375371420 -CollectorId 15832:901:1711011916294613031 -fqdn sfo-m01-vc01.sfo.rainpole.io -username svc-inv-vsphere -password VMw@re1! -nickname "sfo-m01-vc01 - Management Domain vCenter Server" +``` + +This example updates a configured vCenter Server with updated credentials as +supplied in VMware Aria Operations for Networks. + +### -id + +The id of the vCenter Server to update. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +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 is connected. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -fqdn + +The fully qualified domain name of the vCenter Server to update. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +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 +``` + +### -username + +The username to use for authentication. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 5 +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: 6 +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 ddf23a99..9bdd2e38 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -415,6 +415,7 @@ nav: - 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 + - documentation/functions/aria-suite/aria-operations-networks/Update-AriaNetworksvCenterDataSourceCredentials.md - Aria Suite Lifecycle: - documentation/functions/aria-suite/aria-suite-lifecycle/Add-vRSLCMApplianceNtpConfig.md - documentation/functions/aria-suite/aria-suite-lifecycle/Add-vRSLCMDatacenter.md