Upgrade Azure Stack HCI operating system via PowerShell

Applies to: Azure Stack HCI, versions 23H2 and 22H2

Important

Azure Stack HCI, version 22H2 will reach end of service by May 2025. After that, you won't receive monthly security and quality updates that provide protection from the latest security threats. To continue receiving updates, we recommend updating your operating system to version 23H2.

If you're currently running an Azure Stack HCI, version 22H2 stretch cluster or managing Azure Stack HCI via System Center - Virtual Machine Manager, review the Supported workloads and configurations table for update timelines.

This article describes how to upgrade the Azure Stack HCI, version 22H2 Operating System (OS) to version 23H2, which is the latest generally available software, via PowerShell. Upgrade using PowerShell is the recommended method to upgrade the OS.

There are other methods to upgrade the OS that include using Windows Admin Center and the Server Configuration tool (SConfig). For more information about these methods, see Upgrade your Azure Stack HCI to new OS via Windows Admin Center and Upgrade your Azure Stack HCI to new OS using other methods.

Throughout this article, we refer to Azure Stack HCI, version 23H2 as the new version and Azure Stack HCI, version 22H2 as the old version.

High-level workflow for the OS upgrade

The Azure Stack HCI operating system update is available via the Windows Update and via the media that you can download from the Azure portal.

To upgrade the OS on your cluster, follow these high-level steps:

  1. Complete the prerequisites.
  2. Connect to the Azure Stack HCI, version 22H2 cluster.
  3. Check for the available updates using PowerShell.
  4. Install new OS using PowerShell.
  5. Check the status of the updates.
  6. After the OS is upgraded, perform post-OS upgrade steps.

Complete prerequisites

Before you begin, make sure that:

  • You have access to an Azure Stack HCI, version 22H2 cluster.
  • The cluster should be registered in Azure.
  • Make sure that all the nodes in your Azure Stack HCI, version 22H2 cluster are healthy and show as Online.
  • You have access to the Azure Stack HCI, version 23H2 OS software update. This update is available via Windows Update or as a downloadable media. The media is an ISO file that you can download from the Azure portal.
  • You have access to a client that can connect to your Azure Stack HCI cluster. This client should be running PowerShell 5.0 or later.

Note

The ISO file is only required if the cluster nodes do not have access to Windows Update to download the OS feature update. If using this method, after you Connect to the Azure Stack HCI, version 22H2 cluster, skip to step 6 under Step 2: Install new OS using PowerShell and perform the remaining steps.

Step 1: Connect to the Azure Stack HCI cluster

Follow these steps on your client to connect to one of the servers of your Azure Stack HCI cluster.

  1. Run PowerShell as Administrator on the client that you're using to connect to your cluster.

  2. Open a remote PowerShell session to a server on your Azure Stack HCI cluster. Run the following command and provide the credentials of your server when prompted:

    $cred = Get-Credential
    Enter-PSSession -ComputerName "<Computer IP>" -Credential $cred 
    

    Here's a sample output:

    PS C:\Users\Administrator> $cred = Get-Credential
    
    cmdlet Get-Credential at command pipeline position 1
    Supply values for the following parameters:
    Credential
    PS C:\Users\Administrator> Enter-PSSession -ComputerName "100.100.100.10" -Credential $cred 
    [100.100.100.10]: PS C:\Users\Administrator\Documents>
    

Step 2: Install new OS using PowerShell

To install new OS using PowerShell, follow these steps:

Note

The following steps require the Cluster-Aware Updating (CAU) role to be installed and enabled on the cluster. For information on how to install and enable this feature on your Azure Stack HCI cluster, see Cluster-Aware Updating overview.

  1. Run the following cmdlets on every server in the cluster:

    Set-WSManQuickConfig
    Enable-PSRemoting
    
  2. To test whether the cluster is properly set up to apply software updates using Cluster-Aware Updating (CAU), run the Test-CauSetup cmdlet, which notifies you of any warnings or errors:

    Test-CauSetup -ClusterName <Cluster name>
    
  3. Validate the cluster's hardware and settings by running the Test-Cluster cmdlet on one of the servers in the cluster. If any of the condition checks fail, resolve them before proceeding to the next step.

    Test-Cluster
    
  4. Check for the available updates:

    Invoke-CauScan -ClusterName <ClusterName> -CauPluginName "Microsoft.RollingUpgradePlugin" -CauPluginArguments @{'WuConnected'='true';} -Verbose | fl *
    

    Inspect the output of the above cmdlet and verify that each server is offered the same Feature Update, which should be the case.

  5. You need a separate server or VM outside the cluster to run the Invoke-CauRun cmdlet from. A separate server ensures that orchestration isn't interrupted when the nodes are rebooted.

    Important

    The system on which you run Invoke-CauRun must be running Windows Server 2022.

    Invoke-CauRun -ClusterName <ClusterName> -CauPluginName "Microsoft.RollingUpgradePlugin" -CauPluginArguments @{'WuConnected'='true';} -Verbose -EnableFirewallRules -Force
    
  6. If the cluster isn't connected to Windows Update and the Azure Stack HCI install media is available on a local share, CAU can also be used to upgrade the cluster. Be sure to update the 'PathToSetupMedia' parameter with the share path to the ISO image.

    Invoke-CauRun –ClusterName <ClusterName> -CauPluginName Microsoft.RollingUpgradePlugin -CauPluginArguments @{ 'WuConnected'='false';'PathToSetupMedia'='\some\path\'; 'UpdateClusterFunctionalLevel'='true'; } -Force
    
  7. Check for any further updates and install them.

Wait for the update to complete and check the status of the update.

Step 3: Check the status of an update

To get the summary information about an update in progress, run the Get-CauRun cmdlet:

Get-CauRun -ClusterName <ClusterName>

Here's a sample output:

RunId                   : <Run ID> 
RunStartTime            : 10/13/2024 1:35:39 PM 
CurrentOrchestrator     : NODE1 
NodeStatusNotifications : { 
Node      : NODE1 
Status    : Waiting 
Timestamp : 10/13/2024 1:35:49 PM 
} 
NodeResults             : { 
Node                     : NODE2 
Status                   : Succeeded 
ErrorRecordData          : 
NumberOfSucceededUpdates : 0 
NumberOfFailedUpdates    : 0 
InstallResults           : Microsoft.ClusterAwareUpdating.UpdateInstallResult[] 
}

You're now ready to perform the post-OS upgrade steps for your cluster.

Next steps