From 8697641586b630f79c47c7631af3676531f4bf22 Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Tue, 11 Apr 2023 20:56:58 -0400 Subject: [PATCH] refactor: remove `Invoke-VcfPasswordPolicy` and supporting content - **Breaking**: Removes `Invoke-VcfPasswordPolicy` and supporting functions. Please use the `VMware.CloudFoundation.PasswordManagement` module. - Bumps the module version to v2.0.0.1006. - Updates `CHANGELOG.md`. Signed-off-by: Ryan Johnson --- CHANGELOG.md | 11 +- VMware.CloudFoundation.Reporting.psd1 | 2 +- VMware.CloudFoundation.Reporting.psm1 | 300 +------------------------- 3 files changed, 12 insertions(+), 301 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9ab0943..4d52ae6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,13 +12,20 @@ Enhancement: Refactor: - **Breaking**: Updates `Invoke-VcfHealthReport` to use `-localUser` and `localPass` parameters instead of `-SddcManagerRootPass`. Examples use the local `vcf` user account for the SDDC Manager virtual appliance. [GH-113](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/113) -- **Breaking**: Updates `Publish-StorageCapacityHealth` to use `-localUser` and `localPass` parameters instead of `-rootPass`. Examples use the local `vcf` user account for the SDDC Manager virtual appliance. [GH-113](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/113) -- **Breaking**: Updates `Request-SddcManagerStorageHealth` to use `-localUser` and `localPass` parameters instead of `-rootPass`. Examples use the local `vcf` user account for the SDDC Manager virtual appliance. [GH-113](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/113) +- **Breaking**: Updates `Publish-StorageCapacityHealth` to use `-localUser` and `-localPass` parameters instead of `-rootPass`. Examples use the local `vcf` user account for the SDDC Manager virtual appliance. [GH-113](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/113) +- **Breaking**: Updates `Request-SddcManagerStorageHealth` to use `-localUser` and `-localPass` parameters instead of `-rootPass`. Examples use the local `vcf` user account for the SDDC Manager virtual appliance. [GH-113](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/113) +- **Breaking**: Removes `Invoke-VcfPasswordPolicy` and supporting functions. Please use the [`VMware.CloudFoundation.PasswordManagement`](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-password-management) module. [GH-118](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/118) - Updates `Request-SoSHealthJson` to use the API to retrieve the SoS Health Summary JSON results. [GH-102](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/102) - Updates `Publish-PasswordHealth` to return the results from the SoS Health Summary JSON data. [GH-111](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/111) - Updates `Invoke-VcfHealthReport` to use the `Publish-PasswordHealth` cmdlet. [GH-111](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/111) - Removes `Publish-LocalUserExpiry` in favor of the `Publish-PasswordHealth` cmdlet. [GH-111](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/111) +Chore: + +- Updates `PowerValidatedSolutions` from v2.0.1 to v2.2.0. [GH-117](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/117) +- Updates `VMware.PowerCLI` from v12.7.0 to v13.0.0. [GH-117](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/117) +- Updates `VMware.vSphere.SsoAdmin` from v1.3.8 to v1.3.9. [GH-117](htt + ## [v1.1.0](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/releases/tag/v1.1.0) > Release Date: 2023-02-28 diff --git a/VMware.CloudFoundation.Reporting.psd1 b/VMware.CloudFoundation.Reporting.psd1 index 64b9b672..ea1a4e56 100644 --- a/VMware.CloudFoundation.Reporting.psd1 +++ b/VMware.CloudFoundation.Reporting.psd1 @@ -12,7 +12,7 @@ RootModule = '.\VMware.CloudFoundation.Reporting.psm1' # Version number of this module. - ModuleVersion = '2.0.0.1005' + ModuleVersion = '2.0.0.1006' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/VMware.CloudFoundation.Reporting.psm1 b/VMware.CloudFoundation.Reporting.psm1 index 923106c0..138d4623 100644 --- a/VMware.CloudFoundation.Reporting.psm1 +++ b/VMware.CloudFoundation.Reporting.psm1 @@ -570,165 +570,6 @@ Function Invoke-VcfUpgradePrecheck { } Export-ModuleMember -Function Invoke-VcfUpgradePrecheck -Function Invoke-VcfPasswordPolicy { - <# - .SYNOPSIS - Generate a password policy report - - .DESCRIPTION - The Invoke-VcfPasswordPolicy runs a password policy report for a Workload Domain - - .EXAMPLE - Invoke-VcfPasswordPolicy -sddcManagerFqdn sfo-vcf01.sfo.rainpole.io -sddcManagerUser admin@local -sddcManagerPass VMw@re1!VMw@re1! -sddcRootPass VMw@re1! -reportPath F:\Reporting -allDomains - This example runs a password policy report for all Workload Domain within an SDDC Manager instance. - - .EXAMPLE - Invoke-VcfPasswordPolicy -sddcManagerFqdn sfo-vcf01.sfo.rainpole.io -sddcManagerUser admin@local -sddcManagerPass VMw@re1!VMw@re1! -sddcRootPass VMw@re1! -reportPath F:\Reporting -workloadDomain sfo-w01 - This example runs a password policy report for a specific Workload Domain within an SDDC Manager instance. - #> - - Param ( - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerFqdn, - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerUser, - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass, - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcRootPass, - [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$reportPath, - [Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains, - [Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain, - [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$darkMode, - [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$policyByProduct - ) - - Try { - Clear-Host; Write-Host "" - - if (Test-VCFConnection -server $sddcManagerFqdn) { - if (Test-VCFAuthentication -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass) { - $defaultReport = Start-CreateReportDirectory -path $reportPath -sddcManagerFqdn $sddcManagerFqdn -reportType policy # Setup Report Location and Report File - if (!(Test-Path -Path $reportPath)) {Write-Warning "Unable to locate report path $reportPath, enter a valid path and try again"; Write-Host ""; Break } - if ($PsBoundParameters.ContainsKey("allDomains")) { - $reportname = $defaultReport.Split('.')[0] + "-" + $sddcManagerFqdn.Split(".")[0] + ".htm" - $reportData = "

SDDC Manager: $sddcManagerFqdn

" - $workflowMessage = "VMware Cloud Foundation instance ($sddcManagerFqdn)" - $commandSwitch = "-allDomains" - } else { - $reportname = $defaultReport.Split('.')[0] + "-" + $workloadDomain + ".htm" - $reportData = "

Workload Domain: $workloadDomain

" - $workflowMessage = "Workload Domain ($workloadDomain)" - $commandSwitch = "-workloadDomain $workloadDomain" - } - Start-SetupLogFile -Path $reportPath -ScriptName $MyInvocation.MyCommand.Name # Setup Log Location and Log File - Write-LogMessage -Type INFO -Message "Starting the Process of Running a Password Policy Report for $workflowMessage." -Colour Yellow - Write-LogMessage -Type INFO -Message "Setting up the log file to path $logfile." - Write-LogMessage -Type INFO -Message "Setting up report folder and report $reportName." - - Write-LogMessage -Type INFO -Message "Collecting SDDC Manager Password Policies for $workflowMessage." - $sddcManagerPasswordExpirationHtml = Invoke-Expression "Publish-SddcManagerPasswordExpiration -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -sddcRootPass $sddcRootPass $($commandSwitch)" - $sddcManagerPasswordComplexityHtml = Invoke-Expression "Publish-SddcManagerPasswordComplexity -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -sddcRootPass $sddcRootPass $($commandSwitch)" - $sddcManagerAccountLockoutHtml = Invoke-Expression "Publish-SddcManagerAccountLockout -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -sddcRootPass $sddcRootPass $($commandSwitch)" - - Write-LogMessage -Type INFO -Message "Collecting vCenter Single Sign-On Password Policies for $workflowMessage." - $ssoPasswordExpirationHtml = Invoke-Expression "Publish-SsoPasswordPolicy -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -policy PasswordExpiration $($commandSwitch)" - $ssoPasswordComplexityHtml = Invoke-Expression "Publish-SsoPasswordPolicy -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -policy PasswordComplexity $($commandSwitch)" - $SsoAccountLockoutHtml = Invoke-Expression "Publish-SsoPasswordPolicy -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -policy AccountLockout $($commandSwitch)" - - Write-LogMessage -Type INFO -Message "Collecting vCenter Server Password Expiration Policy for $workflowMessage." - $vcenterPasswordExpirationHtml = Invoke-Expression "Publish-VcenterPasswordExpiration -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass $($commandSwitch)" - - Write-LogMessage -Type INFO -Message "Collecting vCenter Server (Local User) Password Policies for $workflowMessage." - $vcenterLocalPasswordExpirationHtml = Invoke-Expression "Publish-VcenterLocalPasswordExpiration -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass $($commandSwitch)" - $vcenterLocalPasswordComplexityHtml = Invoke-Expression "Publish-VcenterLocalPasswordComplexity -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass $($commandSwitch)" - $vcenterLocalAccountLockoutHtml = Invoke-Expression "Publish-VcenterLocalAccountLockout -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass $($commandSwitch)" - - Write-LogMessage -Type INFO -Message "Collecting NSX Manager Password Policies for $workflowMessage." - $nsxManagerPasswordExpirationHtml = Invoke-Expression "Publish-NsxManagerPasswordExpiration -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass $($commandSwitch)" - $nsxManagerPasswordComplexityHtml = Invoke-Expression "Publish-NsxManagerPasswordComplexity -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass $($commandSwitch)" - $nsxMangerAccountLockoutHtml = Invoke-Expression "Publish-NsxManagerAccountLockout -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass $($commandSwitch)" - - Write-LogMessage -Type INFO -Message "Collecting NSX Edge Password Policies for $workflowMessage." - $nsxEdgePasswordExpirationHtml = Invoke-Expression "Publish-NsxEdgePasswordExpiration -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass $($commandSwitch)" - $nsxEdgePasswordComplexityHtml = Invoke-Expression "Publish-NsxEdgePasswordComplexity -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass $($commandSwitch)" - $nsxEdgeAccountLockoutHtml = Invoke-Expression "Publish-NsxEdgeAccountLockout -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass $($commandSwitch)" - - Write-LogMessage -Type INFO -Message "Collecting ESXi Password Policies for $workflowMessage." - $esxiPasswordExpirationHtml = Invoke-Expression "Publish-EsxiPasswordPolicy -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -policy PasswordExpiration $($commandSwitch)" - $esxiPasswordComplexityHtml = Invoke-Expression "Publish-EsxiPasswordPolicy -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -policy PasswordComplexity $($commandSwitch)" - $esxiAccountLockoutHtml = Invoke-Expression "Publish-EsxiPasswordPolicy -server $sddcManagerFqdn -user $sddcManagerUser -pass $sddcManagerPass -policy AccountLockout $($commandSwitch)" - - if ($PsBoundParameters.ContainsKey("policyByProduct")) { - $reportData += $sddcManagerPasswordExpirationHtml - $reportData += $sddcManagerPasswordComplexityHtml - $reportData += $sddcManagerAccountLockoutHtml - $reportData += $ssoPasswordExpirationHtml - $reportData += $ssoPasswordComplexityHtml - $reportData += $ssoAccountLockoutHtml - $reportData += $vcenterPasswordExpirationHtml - $reportData += $vcenterLocalPasswordExpirationHtml - $reportData += $vcenterLocalPasswordComplexityHtml - $reportData += $vcenterLocalAccountLockoutHtml - $reportData += $nsxManagerPasswordExpirationHtml - $reportData += $nsxManagerPasswordComplexityHtml - $reportData += $nsxMangerAccountLockoutHtml - $reportData += $nsxEdgePasswordExpirationHtml - $reportData += $nsxEdgePasswordComplexityHtml - $reportData += $nsxEdgeAccountLockoutHtml - $reportData += $esxiPasswordExpirationHtml - $reportData += $esxiPasswordComplexityHtml - $reportData += $esxiAccountLockoutHtml - } else { - $reportData += $sddcManagerPasswordExpirationHtml - $reportData += $ssoPasswordExpirationHtml - $reportData += $vcenterPasswordExpirationHtml - $reportData += $vcenterLocalPasswordExpirationHtml - $reportData += $nsxManagerPasswordExpirationHtml - $reportData += $nsxEdgePasswordExpirationHtml - $reportData += $esxiPasswordExpirationHtml - $reportData += $sddcManagerPasswordComplexityHtml - $reportData += $ssoPasswordComplexityHtml - $reportData += $vcenterLocalPasswordComplexityHtml - $reportData += $nsxManagerPasswordComplexityHtml - $reportData += $nsxEdgePasswordComplexityHtml - $reportData += $esxiPasswordComplexityHtml - $reportData += $sddcManagerAccountLockoutHtml - $reportData += $ssoAccountLockoutHtml - $reportData += $vcenterLocalAccountLockoutHtml - $reportData += $nsxMangerAccountLockoutHtml - $reportData += $nsxEdgeAccountLockoutHtml - $reportData += $esxiAccountLockoutHtml - } - - if ($PsBoundParameters.ContainsKey("darkMode")) { - $reportHeader = Get-ClarityReportHeader -dark - } else { - $reportHeader = Get-ClarityReportHeader - } - if ($PsBoundParameters.ContainsKey("policyByProduct")) { - $reportNavigation = Get-ClarityReportNavigation -reportType policyByProduct - } else { - $reportNavigation = Get-ClarityReportNavigation -reportType policy - } - $reportFooter = Get-ClarityReportFooter - $report = $reportHeader - $report += $reportNavigation - $report += $reportData - $report += $reportFooter - - # Generate the report to an HTML file and then open it in the default browser - Write-LogMessage -Type INFO -Message "Generating the Final Report and Saving to ($reportName)." - $report | Out-File $reportName - if ($PSEdition -eq "Core" -and ($PSVersionTable.OS).Split(' ')[0] -ne "Linux") { - Invoke-Item $reportName - } elseif ($PSEdition -eq "Desktop") { - Invoke-Item $reportName - } - } - } - } Catch { - Debug-CatchWriter -object $_ - } -} -Export-ModuleMember -Function Invoke-VcfPasswordPolicy - Function Invoke-VcfOverviewReport { <# .SYNOPSIS @@ -8105,7 +7946,7 @@ Function Start-CreateReportDirectory { Param ( [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$path, [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerFqdn, - [Parameter (Mandatory = $true)] [ValidateSet("health","alert","config","upgrade","policy","overview")] [String]$reportType + [Parameter (Mandatory = $true)] [ValidateSet("health","alert","config","upgrade","overview")] [String]$reportType ) $filetimeStamp = Get-Date -Format "MM-dd-yyyy_hh_mm_ss" @@ -8113,7 +7954,6 @@ Function Start-CreateReportDirectory { if ($reportType -eq "alert") { $Global:reportFolder = $path + '\AlertReports\' } if ($reportType -eq "config") { $Global:reportFolder = $path + '\ConfigReports\' } if ($reportType -eq "upgrade") { $Global:reportFolder = $path + '\UpgradeReports\' } - if ($reportType -eq "policy") { $Global:reportFolder = $path + '\PolicyReports\' } if ($reportType -eq "overview") { $Global:reportFolder = $path + '\OverviewReports\' } if ($PSEdition -eq "Core" -and ($PSVersionTable.OS).Split(' ')[0] -eq "Linux") { $reportFolder = ($reportFolder).split('\') -join '/' | Split-Path -NoQualifier @@ -8503,7 +8343,7 @@ Export-ModuleMember -Function Get-ClarityReportHeader Function Get-ClarityReportNavigation { Param ( - [Parameter (Mandatory = $true)] [ValidateSet("health","alert","config","upgrade","policy","policyByProduct","overview")] [String]$reportType + [Parameter (Mandatory = $true)] [ValidateSet("health","alert","config","upgrade","overview")] [String]$reportType ) if ($reportType -eq "health") { # Define the Clarity Cascading Style Sheets (CSS) for a Health Report @@ -8677,142 +8517,6 @@ Function Get-ClarityReportNavigation { $clarityCssNavigation } - if ($reportType -eq "policyByProduct") { # Define the Clarity Cascading Style Sheets (CSS) for a Password Policy Report - $clarityCssNavigation = ' - -
- -
-
' - $clarityCssNavigation - } - - if ($reportType -eq "policy") { # Define the Clarity Cascading Style Sheets (CSS) for a Password Policy Report - $clarityCssNavigation = ' - -
- -
-
' - $clarityCssNavigation - } - if ($reportType -eq "overview") { # Define the Clarity Cascading Style Sheets (CSS) for a System Overview Report $clarityCssNavigation = '