Improved ASP.NET view state security and key management - SharePoint Server (original) (raw)

APPLIES TO: no-img-132013 yes-img-162016 yes-img-192019 yes-img-seSubscription Edition no-img-sopSharePoint in Microsoft 365

Note

SharePoint Server Subscription Edition encrypts the machineKey section of its web.config files by default. This prevents attackers from reading your ASP.NET view state encryption and validation keys, even if they gain access to those web.config files.

If you are running SharePoint Server Subscription Edition or SharePoint Server 2016/2019 editions, the platform secures your sensitive data by regularly updating the machine encryption keys. This process is done manually using PowerShell cmdlets, which updates the decryption and validation keys within a web application. This security practice helps to mitigate potential vulnerabilities if a key is compromised. For more information, see PowerShell cmdlets.

Starting from SharePoint Server Subscription Edition Version 25H1 and the September 2025 Public Update for SharePoint Server 2016 and 2019, you would be able to automatically update machine keys without manual intervention. For more information, see Automatic machine key rotation.

Automatic machine key rotation

Automatic machine key rotation feature aims to improve security by automating the periodic updating of machine keys, thereby minimizing the risk of key compromise. This feature ensures seamless and automatic rotation of machine keys while maintaining high availability and reliability of SharePoint services during key rotation.

The feature incorporates a Key Management Service that handles storage, retrieval and distribution of machine keys using a timer job called Machine Key Rotation Job. The timer job is configured to run automatically on the Sunday of every week by default.

If you need to update the machine keys manually, you can trigger the Machine Key Rotation timer job by performing the following steps:

  1. Navigate to the Central Administration site.
  2. Go to Monitoring -> Review job definition.
  3. Search for Machine Key Rotation Job and select Run Now.

When the job is completed, there should be no noticeable change to the administrators of the farm.

Using the following new PowerShell cmdlets, you can change the ASP.NET view state decryption and validation keys of a SharePoint web application, thus allowing you to rotate those keys in your farm.

PowerShell cmdlets

  1. Set-SPMachineKey
    Configures the ASP.NET view state decryption and validation keys of a web application.

Syntax

Set-SPMachineKey -WebApplication <SPWebApplicationPipeBind> [-DecryptionKey <String>] [-ValidationKey <String>] [-Local] [<CommonParameters>]  

Parameters

  1. Update-SPMachineKey
    Deploys ASP.NET view state decryption and validation keys to servers in the farm.

Syntax

Update-SPMachineKey -WebApplication <SPWebApplicationPipeBind> [-Local] [<CommonParameters>]  

Parameters