Public/ps1/Configuration/General/Install-ApprxrConfigurationBase.ps1
|
<#
.SYNOPSIS Installs the base configuration for Apprxr, including storing remote connection credentials and log settings. .DESCRIPTION Stores the provided tenant, credential, and log configuration values securely using Set-ApprxrConfigurationValue and Set-LogConfiguration. .PARAMETER Tenant The tenant name to store in the configuration. .PARAMETER Credential The PSCredential object containing the username and password to store securely. .PARAMETER LogFolder The folder path for log storage. .PARAMETER LogHours The number of hours to retain logs. .PARAMETER LogRetention The number of log files to retain. .EXAMPLE Install-ApprxrConfigurationBase -Tenant 'tenant1' -Credential (Get-Credential) -LogFolder 'C:\Logs' -LogHours 24 -LogRetention 7 Stores the configuration for the specified tenant and credentials. #> ### Storing the remote connection credentials in a secure way function Install-ApprxrConfigurationBase{ param( [Parameter(Mandatory)] [String]$Tenant, [Parameter(Mandatory)] [System.Management.Automation.PSCredential]$Credential, [String] $LogFolder, [int] $LogHours, [int] $LogRetention ) # Store the username in the configuration Set-ApprxrConfigurationValue -name UserName -value $Credential.UserName # Store the tenant in the configuration Set-ApprxrConfigurationValue -name Tenant -value $Tenant # Store the password securely (as encrypted string) Set-ApprxrConfigurationValue -name Password -value ($Credential.Password | ConvertFrom-SecureString) # Log configuration is now initialized separately using Install-ApprxrLogging } |