Skip to content

Commit

Permalink
feat: add-inv-function (#663)
Browse files Browse the repository at this point in the history
Added `Update-AriaNetworksvCenterDataSourceCredentials` cmdlet to update the credentials for a vCenter Server in VMware Aria Operations for Networks.

Signed-off-by: Andy Beltz <[email protected]>
  • Loading branch information
andybeltz authored Jun 19, 2024
1 parent 133d99c commit e187dd6
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion PowerValidatedSolutions.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -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 = @()
Expand Down
72 changes: 68 additions & 4 deletions PowerValidatedSolutions.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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 }
Expand Down Expand Up @@ -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 ######
###################################################################################

Expand Down
Original file line number Diff line number Diff line change
@@ -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] <String> [-collectorId] <String> [[-fqdn] <String>] [-nickname] <String> [-username] <String> [-password] <String> [<CommonParameters>] [-nickname] <String> [-username] <String> [-password] <String> [<CommonParameters>]
```

## 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).
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e187dd6

Please sign in to comment.