@@ -135,6 +135,8 @@ $ConfiguringCloudManagementClusterSvc = "Creating Cloud Management cluster resou
135135$StartingCloudManagementMessage = " Starting Cloud Management agent."
136136$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."
137137
138+ $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."
139+
138140$AlreadyLoggedFlag = " Already Logged"
139141# endregion
140142
@@ -492,6 +494,30 @@ Function Print-FunctionParameters{
492494 return " Parameters for {0} are: {1}" -f $Message , ($body | Out-String )
493495}
494496
497+ function Confirm-UserAcknowledgmentToUpgradeOS {
498+ [CmdletBinding (SupportsShouldProcess = $true , ConfirmImpact = ' High' )]
499+ param (
500+ [Parameter (Mandatory = $true )]
501+ [System.Management.Automation.Runspaces.PSSession ]
502+ $ClusterNodeSession
503+ )
504+
505+ $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 } }
506+ $osVersionInfo = Invoke-Command - Session $clusterNodeSession - ScriptBlock $osVersionDetectoid
507+ $isOSVersion22H2 = ([Int ]::Parse($osVersionInfo.BuildNumber ) -le $22H2BuildNumber )
508+
509+ $doNotAbort = $true
510+
511+ if ($isOSVersion22H2 )
512+ {
513+ $doNotAbort = $PSCmdlet.ShouldProcess (" " , " " , $UpgradeOSMessage )
514+ }
515+ if ( -not $doNotAbort )
516+ {
517+ throw " Aborting based on user input"
518+ }
519+ }
520+
495521$CheckNodeArcRegistrationStateScriptBlock = {
496522 if (Test-Path - Path " C:\Program Files\AzureConnectedMachineAgent\azcmagent.exe" )
497523 {
@@ -2918,6 +2944,8 @@ param(
29182944
29192945 $regContext , $IsClusterRegistered , $clusterNodeSession , $_ = Get-SetupLoggingDetails - ComputerName $ComputerName - Credential $Credential - IsManagementNode $isManagementNode
29202946
2947+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
2948+
29212949 $global :HCILogsDirectory = Setup- Logging - LogsDirectory $LogsDirectory - LogFilePrefix " RegisterHCI" - DebugEnabled ($DebugPreference -ne " SilentlyContinue" ) - IsClusterRegistered $IsClusterRegistered - ClusterNodeSession $clusterNodeSession
29222950
29232951 if ($IsClusterRegistered -and ! ([string ]::IsNullOrEmpty($LogsDirectory )))
@@ -4166,6 +4194,8 @@ param(
41664194
41674195 $regContext , $IsClusterRegistered , $clusterNodeSession , $_ = Get-SetupLoggingDetails - ComputerName $ComputerName - Credential $Credential - IsManagementNode $isManagementNode
41684196
4197+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
4198+
41694199 $global :HCILogsDirectory = Setup- Logging - LogFilePrefix " UnregisterHCI" - DebugEnabled ($DebugPreference -ne " SilentlyContinue" ) - IsClusterRegistered $IsClusterRegistered - ClusterNodeSession $clusterNodeSession
41704200
41714201 Write-Progress - Id $MainProgressBarId - activity $UnregisterProgressActivityName - status $CheckingDependentModules - percentcomplete 1
@@ -4590,6 +4620,8 @@ param(
45904620 $clusterNodeSession = New-PSSession - ComputerName localhost
45914621 }
45924622
4623+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
4624+
45934625 $logsDirectory = Get-LogsDirectoryHelper - ClusterNodeSession $clusterNodeSession | Out-String
45944626
45954627 if (! [string ]::IsNullOrEmpty($logsDirectory ))
@@ -4780,6 +4812,8 @@ param(
47804812
47814813 $regContext , $IsClusterRegistered , $clusterNodeSession , $nodeSessionParams = Get-SetupLoggingDetails - ComputerName $ComputerName - Credential $Credential - IsManagementNode $isManagementNode
47824814
4815+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
4816+
47834817 Setup- Logging - LogFilePrefix " SetAzStackHCI" - DebugEnabled ($DebugPreference -ne " SilentlyContinue" ) - IsClusterRegistered $IsClusterRegistered - ClusterNodeSession $clusterNodeSession | Out-Null
47844818
47854819 if ($clusterNodeSession -ne $Null )
@@ -5443,6 +5477,10 @@ param(
54435477 $IsManagementNode = $True
54445478 }
54455479
5480+ $_ , $_ , $clusterNodeSession , $_ = Get-SetupLoggingDetails - Credential $Credential - ComputerName $ComputerName - IsManagementNode $IsManagementNode
5481+
5482+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
5483+
54465484 $LogFilePrefix = " EnableAzStackHCIAttestation"
54475485 $DebugEnabled = $DebugPreference -ne " SilentlyContinue"
54485486 $date = Get-Date
@@ -5730,6 +5768,10 @@ param(
57305768 $IsManagementNode = $True
57315769 }
57325770
5771+ $_ , $_ , $clusterNodeSession , $_ = Get-SetupLoggingDetails - Credential $Credential - ComputerName $ComputerName - IsManagementNode $IsManagementNode
5772+
5773+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
5774+
57335775 $LogFilePrefix = " DisableAzStackHCIAttestation"
57345776 $DebugEnabled = $DebugPreference -ne " SilentlyContinue"
57355777
@@ -5941,6 +5983,10 @@ param(
59415983
59425984 try
59435985 {
5986+
5987+ $_ , $_ , $clusterNodeSession , $_ = Get-SetupLoggingDetails
5988+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
5989+
59445990 $LogFilePrefix = " AddAzStackHCIVMAttestation"
59455991 $DebugEnabled = $DebugPreference -ne " SilentlyContinue"
59465992 $date = Get-Date
@@ -6134,6 +6180,9 @@ param(
61346180
61356181 try
61366182 {
6183+ $_ , $_ , $clusterNodeSession , $_ = Get-SetupLoggingDetails
6184+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
6185+
61376186 $LogFilePrefix = " RemoveAzStackHCIVMAttestation"
61386187 $DebugEnabled = $DebugPreference -ne " SilentlyContinue"
61396188
@@ -6259,6 +6308,9 @@ param(
62596308 {
62606309 try
62616310 {
6311+ $_ , $_ , $clusterNodeSession , $_ = Get-SetupLoggingDetails
6312+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
6313+
62626314 $getImdsOutputList = [System.Collections.ArrayList ]::new()
62636315
62646316 $SessionParams = @ {
@@ -6504,6 +6556,8 @@ function Install-AzStackHCIRemoteSupport{
65046556
65056557 $_ , $IsClusterRegistered , $clusterNodeSession , $_ = Get-SetupLoggingDetails
65066558
6559+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
6560+
65076561 $IsClusterRegistered = $regContext.RegistrationStatus -eq [RegistrationStatus ]::Registered
65086562 Setup- Logging - LogFilePrefix " AzStackHCIRemoteSupportInstall" - DebugEnabled ($DebugPreference -ne " SilentlyContinue" ) - ClusterNodeSession $clusterNodeSession - IsClusterRegistered $IsClusterRegistered | Out-Null
65096563 if ($Null -ne $clusterNodeSession )
@@ -6541,6 +6595,7 @@ function Remove-AzStackHCIRemoteSupport{
65416595 param ()
65426596
65436597 $_ , $IsClusterRegistered , $clusterNodeSession , $_ = Get-SetupLoggingDetails
6598+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
65446599 Setup- Logging - LogFilePrefix " AzStackHCIRemoteSupportRemove" - DebugEnabled ($DebugPreference -ne " SilentlyContinue" ) - ClusterNodeSession $clusterNodeSession - IsClusterRegistered $IsClusterRegistered | Out-Null
65456600 if ($Null -ne $clusterNodeSession )
65466601 {
@@ -6607,6 +6662,9 @@ function Enable-AzStackHCIRemoteSupport{
66076662 $AgreeToRemoteSupportConsent
66086663 )
66096664
6665+ $_ , $_ , $clusterNodeSession , $_ = Get-SetupLoggingDetails
6666+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
6667+
66106668 if ($AgreeToRemoteSupportConsent -ne $true )
66116669 {
66126670 if ($PSCmdlet.ShouldContinue (" `r`n Proceed with enabling remote support?" , $RemoteSupportConsentText ))
@@ -6650,6 +6708,10 @@ function Disable-AzStackHCIRemoteSupport{
66506708 [CmdletBinding (SupportsShouldProcess )]
66516709 [OutputType ([Boolean ])]
66526710 param ()
6711+
6712+ $_ , $_ , $clusterNodeSession , $_ = Get-SetupLoggingDetails
6713+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
6714+
66536715 $agentInstallType = (Get-ItemProperty - Path " HKLM:\SYSTEM\Software\Microsoft\AzureStack\Observability\RemoteSupport" - ErrorAction SilentlyContinue).InstallType
66546716 $observabilityStackPresent = Assert-IsObservabilityStackPresent
66556717
@@ -6695,6 +6757,9 @@ function Get-AzStackHCIRemoteSupportAccess{
66956757 $IncludeExpired
66966758 )
66976759
6760+ $_ , $_ , $clusterNodeSession , $_ = Get-SetupLoggingDetails
6761+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
6762+
66986763 $agentInstallType = (Get-ItemProperty - Path " HKLM:\SYSTEM\Software\Microsoft\AzureStack\Observability\RemoteSupport" - ErrorAction SilentlyContinue).InstallType
66996764 $observabilityStackPresent = Assert-IsObservabilityStackPresent
67006765
@@ -6794,6 +6859,9 @@ function Get-AzStackHCIRemoteSupportSessionHistory{
67946859 $FromDate = (Get-Date ).AddDays(-7 )
67956860 )
67966861
6862+ $_ , $_ , $clusterNodeSession , $_ = Get-SetupLoggingDetails
6863+ Confirm-UserAcknowledgmentToUpgradeOS - ClusterNodeSession $clusterNodeSession
6864+
67976865 $agentInstallType = (Get-ItemProperty - Path " HKLM:\SYSTEM\Software\Microsoft\AzureStack\Observability\RemoteSupport" - ErrorAction SilentlyContinue).InstallType
67986866 $observabilityStackPresent = Assert-IsObservabilityStackPresent
67996867
0 commit comments