Skip to content

Adding 22H2 EOL Message In Az.StackHCI #27684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions src/StackHCI/StackHCI.Autorest/custom/stackhci.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ $ConfiguringCloudManagementClusterSvc = "Creating Cloud Management cluster resou
$StartingCloudManagementMessage = "Starting Cloud Management agent."
$RemoteSupportConsentText = "`r`n`r`nBy approving this request, the Microsoft support organization or the Azure engineering team supporting this feature ('Microsoft Support Engineer') will be given direct access to your device for troubleshooting purposes and/or resolving the technical issue described in the Microsoft support case. `r`n`r`nDuring a remote support session, a Microsoft Support Engineer may need to collect logs. By enabling remote support, you have agreed to a diagnostic logs collection by Microsoft Support Engineer to address a support case You also acknowledge and consent to the upload and retention of those logs in an Azure storage account managed and controlled by Microsoft. These logs may be accessed by Microsoft in the context of a support case and to improve the health of Azure Stack HCI. `r`n`r`nThe data will be used only to troubleshoot failures that are subject to a support ticket, and will not be used for marketing, advertising, or any other commercial purposes without your consent. The data may be retained for up to ninety (90) days and will be handled following our standard privacy practices (https://privacy.microsoft.com/en-US/). Any data previously collected with your consent will not be affected by the revocation of your permission."

$UpgradeOSMessage = "Your system is running Azure Local, version 22H2, and will no longer receive security updates and support after May 31, 2025. To continue receiving security updates and support, you must upgrade your operating system. Visit https://aka.ms/azlocal-os-upgrade to learn more."

$AlreadyLoggedFlag = "Already Logged"
#endregion

Expand Down Expand Up @@ -492,6 +494,30 @@ Function Print-FunctionParameters{
return "Parameters for {0} are: {1}" -f $Message, ($body | Out-String )
}

function Confirm-UserAcknowledgmentToUpgradeOS {
[CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = 'High')]
param(
[Parameter(Mandatory=$true)]
[System.Management.Automation.Runspaces.PSSession]
$ClusterNodeSession
)

$osVersionDetectoid = { $displayVersion = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").DisplayVersion; $buildNumber = (Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber; New-Object -TypeName PSObject -Property @{'DisplayVersion'=$displayVersion; 'BuildNumber'=$buildNumber} }
$osVersionInfo = Invoke-Command -Session $clusterNodeSession -ScriptBlock $osVersionDetectoid
$isOSVersion22H2 = ([Int]::Parse($osVersionInfo.BuildNumber) -le $22H2BuildNumber)

$doNotAbort = $true

if ($isOSVersion22H2)
{
$doNotAbort = $PSCmdlet.ShouldProcess("", "" ,$UpgradeOSMessage)
}
if( -not $doNotAbort)
{
throw "Aborting based on user input"
}
}

$CheckNodeArcRegistrationStateScriptBlock = {
if(Test-Path -Path "C:\Program Files\AzureConnectedMachineAgent\azcmagent.exe")
{
Expand Down Expand Up @@ -2918,6 +2944,8 @@ param(

$regContext, $IsClusterRegistered, $clusterNodeSession, $_ = Get-SetupLoggingDetails -ComputerName $ComputerName -Credential $Credential -IsManagementNode $isManagementNode

Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession

$global:HCILogsDirectory = Setup-Logging -LogsDirectory $LogsDirectory -LogFilePrefix "RegisterHCI" -DebugEnabled ($DebugPreference -ne "SilentlyContinue") -IsClusterRegistered $IsClusterRegistered -ClusterNodeSession $clusterNodeSession

if($IsClusterRegistered -and !([string]::IsNullOrEmpty($LogsDirectory)))
Expand Down Expand Up @@ -4166,6 +4194,8 @@ param(

$regContext, $IsClusterRegistered, $clusterNodeSession, $_ = Get-SetupLoggingDetails -ComputerName $ComputerName -Credential $Credential -IsManagementNode $isManagementNode

Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession

$global:HCILogsDirectory = Setup-Logging -LogFilePrefix "UnregisterHCI" -DebugEnabled ($DebugPreference -ne "SilentlyContinue") -IsClusterRegistered $IsClusterRegistered -ClusterNodeSession $clusterNodeSession

Write-Progress -Id $MainProgressBarId -activity $UnregisterProgressActivityName -status $CheckingDependentModules -percentcomplete 1
Expand Down Expand Up @@ -4590,6 +4620,8 @@ param(
$clusterNodeSession = New-PSSession -ComputerName localhost
}

Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession

$logsDirectory = Get-LogsDirectoryHelper -ClusterNodeSession $clusterNodeSession | Out-String

if (![string]::IsNullOrEmpty($logsDirectory))
Expand Down Expand Up @@ -4780,6 +4812,8 @@ param(

$regContext, $IsClusterRegistered, $clusterNodeSession, $nodeSessionParams = Get-SetupLoggingDetails -ComputerName $ComputerName -Credential $Credential -IsManagementNode $isManagementNode

Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession

Setup-Logging -LogFilePrefix "SetAzStackHCI" -DebugEnabled ($DebugPreference -ne "SilentlyContinue") -IsClusterRegistered $IsClusterRegistered -ClusterNodeSession $clusterNodeSession | Out-Null

if($clusterNodeSession -ne $Null)
Expand Down Expand Up @@ -5443,6 +5477,10 @@ param(
$IsManagementNode = $True
}

$_, $_, $clusterNodeSession, $_ = Get-SetupLoggingDetails -Credential $Credential -ComputerName $ComputerName -IsManagementNode $IsManagementNode

Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession

$LogFilePrefix = "EnableAzStackHCIAttestation"
$DebugEnabled = $DebugPreference -ne "SilentlyContinue"
$date = Get-Date
Expand Down Expand Up @@ -5730,6 +5768,10 @@ param(
$IsManagementNode = $True
}

$_, $_, $clusterNodeSession, $_ = Get-SetupLoggingDetails -Credential $Credential -ComputerName $ComputerName -IsManagementNode $IsManagementNode

Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession

$LogFilePrefix = "DisableAzStackHCIAttestation"
$DebugEnabled = $DebugPreference -ne "SilentlyContinue"

Expand Down Expand Up @@ -5941,6 +5983,10 @@ param(

try
{

$_, $_, $clusterNodeSession, $_ = Get-SetupLoggingDetails
Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession

$LogFilePrefix = "AddAzStackHCIVMAttestation"
$DebugEnabled = $DebugPreference -ne "SilentlyContinue"
$date = Get-Date
Expand Down Expand Up @@ -6134,6 +6180,9 @@ param(

try
{
$_, $_, $clusterNodeSession, $_ = Get-SetupLoggingDetails
Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession

$LogFilePrefix = "RemoveAzStackHCIVMAttestation"
$DebugEnabled = $DebugPreference -ne "SilentlyContinue"

Expand Down Expand Up @@ -6259,6 +6308,9 @@ param(
{
try
{
$_, $_, $clusterNodeSession, $_ = Get-SetupLoggingDetails
Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession

$getImdsOutputList = [System.Collections.ArrayList]::new()

$SessionParams = @{
Expand Down Expand Up @@ -6504,6 +6556,8 @@ function Install-AzStackHCIRemoteSupport{

$_, $IsClusterRegistered, $clusterNodeSession, $_ = Get-SetupLoggingDetails

Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession

$IsClusterRegistered = $regContext.RegistrationStatus -eq [RegistrationStatus]::Registered
Setup-Logging -LogFilePrefix "AzStackHCIRemoteSupportInstall" -DebugEnabled ($DebugPreference -ne "SilentlyContinue") -ClusterNodeSession $clusterNodeSession -IsClusterRegistered $IsClusterRegistered | Out-Null
if ($Null -ne $clusterNodeSession)
Expand Down Expand Up @@ -6541,6 +6595,7 @@ function Remove-AzStackHCIRemoteSupport{
param()

$_, $IsClusterRegistered, $clusterNodeSession, $_ = Get-SetupLoggingDetails
Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession
Setup-Logging -LogFilePrefix "AzStackHCIRemoteSupportRemove" -DebugEnabled ($DebugPreference -ne "SilentlyContinue") -ClusterNodeSession $clusterNodeSession -IsClusterRegistered $IsClusterRegistered | Out-Null
if ($Null -ne $clusterNodeSession)
{
Expand Down Expand Up @@ -6607,6 +6662,9 @@ function Enable-AzStackHCIRemoteSupport{
$AgreeToRemoteSupportConsent
)

$_, $_, $clusterNodeSession, $_ = Get-SetupLoggingDetails
Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession

if ($AgreeToRemoteSupportConsent -ne $true)
{
if($PSCmdlet.ShouldContinue("`r`nProceed with enabling remote support?", $RemoteSupportConsentText))
Expand Down Expand Up @@ -6650,6 +6708,10 @@ function Disable-AzStackHCIRemoteSupport{
[CmdletBinding(SupportsShouldProcess)]
[OutputType([Boolean])]
param()

$_, $_, $clusterNodeSession, $_ = Get-SetupLoggingDetails
Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession

$agentInstallType = (Get-ItemProperty -Path "HKLM:\SYSTEM\Software\Microsoft\AzureStack\Observability\RemoteSupport" -ErrorAction SilentlyContinue).InstallType
$observabilityStackPresent = Assert-IsObservabilityStackPresent

Expand Down Expand Up @@ -6695,6 +6757,9 @@ function Get-AzStackHCIRemoteSupportAccess{
$IncludeExpired
)

$_, $_, $clusterNodeSession, $_ = Get-SetupLoggingDetails
Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession

$agentInstallType = (Get-ItemProperty -Path "HKLM:\SYSTEM\Software\Microsoft\AzureStack\Observability\RemoteSupport" -ErrorAction SilentlyContinue).InstallType
$observabilityStackPresent = Assert-IsObservabilityStackPresent

Expand Down Expand Up @@ -6794,6 +6859,9 @@ function Get-AzStackHCIRemoteSupportSessionHistory{
$FromDate = (Get-Date).AddDays(-7)
)

$_, $_, $clusterNodeSession, $_ = Get-SetupLoggingDetails
Confirm-UserAcknowledgmentToUpgradeOS -ClusterNodeSession $clusterNodeSession

$agentInstallType = (Get-ItemProperty -Path "HKLM:\SYSTEM\Software\Microsoft\AzureStack\Observability\RemoteSupport" -ErrorAction SilentlyContinue).InstallType
$observabilityStackPresent = Assert-IsObservabilityStackPresent

Expand Down
1 change: 1 addition & 0 deletions src/StackHCI/StackHCI/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
- Additional information about change #1
-->
## Upcoming Release
* Added EOL Message for 22H2

## Version 2.5.0
* Upgraded nuget package to signed package.
Expand Down
Loading