SOLVED: Azure HCI Stack Deploy Cluster - "AzStackHci_Hardware_Test_Tpm_Certificate_Properties" error Checking TPM for desired properties on VMware Workstation or ESXi

If you try and setup an Azure HCI cluster on VMware workstation or vSphere the cluster setup fails and you see the error:

   {
     "Name": "AzStackHci_Hardware_Test_Tpm_Certificate_Properties",
     "DisplayName": "Test TPM DEMO-HCI-01",
     "Tags": {},
     "Title": "Test TPM Certificate Properties",
     "Status": 1,
     "Severity": 2,
     "Description": "Checking TPM for desired properties",
     "Remediation": "https://learn.microsoft.com/en-us/azure-stack/hci/deploy/deployment-tool-prerequisites",
     "TargetResourceID": "Machine: DEMO-HCI-01, Class: TpmCertificates, Subject: TPMVersion=id:00020065, TPMModel=VMware TPM2, TPMManufacturer=id:564D5700, Thumprint: 42E5DC85B4ABC9C7C64BBA3868A2C100017F3E8B",
     "TargetResourceName": "Machine: DEMO-HCI-01, Class: TpmCertificates, Subject: TPMVersion=id:00020065, TPMModel=VMware TPM2, TPMManufacturer=id:564D5700, Thumprint: 42E5DC85B4ABC9C7C64BBA3868A2C100017F3E8B",
     "TargetResourceType": "TpmEndorsementKeyInfo",
     "Timestamp": "\/Date(1726841836019)\/",
     "AdditionalData": {
       "Detail": "TPM certificate 42E5DC85B4ABC9C7C64BBA3868A2C100017F3E8B, valid = False\r Issuer: TPMVersion=id:00020065, TPMModel=VMware TPM2, TPMManufacturer=id:564D5700\r Subject: TPMVersion=id:00020065, TPMModel=VMware TPM2, TPMManufacturer=id:564D5700\r Key Usage: Endorsement Key Certificate, valid = True\r Valid from: 09/20/2024 12:08:28 to 09/20/2074 12:08:28, valid = False\r Algorithm: sha256RSA, valid = True",
       "Status": "FAILURE",
       "TimeStamp": "09/20/2024 14:17:16",
       "Resource": "Current: False. Valid Algorithm: True. Valid Key Usage: True.",
       "Source": "42E5DC85B4ABC9C7C64BBA3868A2C100017F3E8B"
     },
     "HealthCheckSource": "Deployment\\Hardware\\de63689d"
   },


The function being run is 

Test-TpmCertificates

This tests whether the TPM is valid however one of the lines of code is incorrect.

$currentCert = $sinceIssued.Days -gt 0 -and $untilExpired.Days -gt 0

It checks if the certificate of the TPM is at least 1 day old - which means if you create a new virtual machine to host a test HCI host then the TPM is not yet valid, the solution being to try again the following day!

Realistically Microsoft should use the line of code for "greater than or equal to" to allow a TPM that was generated today.
$currentCert = $sinceIssued.Days -ge 0 -and $untilExpired.Days -gt 0


You can check when your TPM will be valid according to Microsoft by running the Get-TpmEndorsementKeyInfo cmdlet on the Azure HCI stack host.

The Not Before property needs to be at least 24 hours in the past.


Comments

Popular posts from this blog

Windows Server 2016, 2019, 2022, Windows 10 and Windows 11: Date and time "Some settings are managed by your organization".

TFTPD32 or TFTPD64 reports Bind error 10013 An attempt was made to access a socket in a way forbidden by its access permissions.

Windows Server 2019 desktop icons such as My Computer, Windows cannot access the specified device, path, or file.