How to resolve Windows servers should be configured to use secure communication protocols

MrFlinstone 641 Reputation points
2025-01-06T08:13:53.7966667+00:00

I have got an azure advisor alert concerning windows virtual machines.

These are standard VM's and they are reporting the following remediation steps. I have carried out the following to remediate the issue, the Os version is windows 2019. I have carried out step 1 and 3, since the Os version is windows 2019, according to the guideline below I don't need to enable TLS.

What is worrying is that some VM's are showing up as healthy, is there a way to work out where the advisor alert keeps coming up for some VM's.

Manual remediation: To ensure your windows server is using secure communication protocol:

  1. Enable Guest Configuration extension and system assigned identity: https://docs.microsoft.com/azure/virtual-machines/extensions/guest-configuration
  2. Enable TLS on your machine. For Windows Server 2008 R2, Windows Server 2012, or Windows 7, install the update at https://support.microsoft.com/help/3140245. For Windows 2012 R2 Server or later, no updates are necessary.
  3. Update the Windows and WinHTTP registry keys (or verify that they're correct) according to the information here: https://docs.microsoft.com/dotnet/framework/network-programming/tls#configuring-schannel-protocols-in-the-windows-registry.

The Azure resource graph query can be found below, I am trying to work out why exactly the machines are being classed as unhealthy, the precise reason so that I can tackle it from a different perspective.

securityresources
        | where type == "microsoft.security/assessments"
        | extend source = trim(' ', tolower(tostring(properties.resourceDetails.Source)))
                                          | extend resourceId = trim(' ', tolower(tostring(case(
                                                                                    source =~ "azure", properties.resourceDetails.Id,
                                                                                    source =~ "aws" and isnotempty(tostring(properties.resourceDetails.ConnectorId)), properties.resourceDetails.Id,
                                                                                   source =~ "gcp" and isnotempty(tostring(properties.resourceDetails.ConnectorId)), properties.resourceDetails.Id,
                                                                                    source =~ 'aws', properties.resourceDetails.AzureResourceId,
                                                                                    source =~ 'gcp', properties.resourceDetails.AzureResourceId,
                                                                                   extract('^(.+)/providers/Microsoft.Security/assessments/.+$',1,id)
                                                                                 ))))
        | extend status = trim(" ", tostring(properties.status.code))
        | extend cause = trim(" ", tostring(properties.status.cause))
        | extend assessmentKey = tostring(name)
        | where assessmentKey == "xxx"
        | where status == "Unhealthy"

The policy definition is as follows.

{
  "properties": {
    "displayName": "Windows machines should be configured to use secure communication protocols",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "To protect the privacy of information communicated over the Internet, your machines should use the latest version of the industry-standard cryptographic protocol, Transport Layer Security (TLS). TLS secures communications over a network by encrypting a connection between machines.",
    "metadata": {
      "version": "4.1.1",
      "category": "Guest Configuration",
      "requiredProviders": [
        "Microsoft.GuestConfiguration"
      ],
      "guestConfiguration": {
        "name": "AuditSecureProtocol",
        "version": "1.*",
        "configurationParameter": {
          "MinimumTLSVersion": "[SecureWebServer]s1;MinimumTLSVersion"
        }
      }
    },
    "version": "4.1.1",
    "parameters": {
      "IncludeArcMachines": {
        "type": "String",
        "metadata": {
          "displayName": "Include Arc connected servers",
          "description": "By selecting this option, you agree to be charged monthly per Arc connected machine.",
          "portalReview": "true"
        },
        "allowedValues": [
          "true",
          "false"
        ],
        "defaultValue": "false"
      },
      "MinimumTLSVersion": {
        "type": "String",
        "metadata": {
          "displayName": "Minimum TLS version",
          "description": "The minimum TLS protocol version that should be enabled. Windows machines with lower TLS versions will be marked as non-compliant."
        },
        "allowedValues": [
          "1.1",
          "1.2"
        ],
        "defaultValue": "1.2"
      },
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of this policy"
        },
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "defaultValue": "AuditIfNotExists"
      }
    },
    "policyRule": {
      "if": {
        "anyOf": [
          {
            "allOf": [
              {
                "field": "type",
                "equals": "Microsoft.Compute/virtualMachines"
              },
              {
                "anyOf": [
                  {
                    "field": "Microsoft.Compute/imagePublisher",
                    "in": [
                      "esri",
                      "incredibuild",
                      "MicrosoftDynamicsAX",
                      "MicrosoftSharepoint",
                      "MicrosoftVisualStudio",
                      "MicrosoftWindowsServerHPCPack"
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "field": "Microsoft.Compute/imagePublisher",
                        "equals": "MicrosoftWindowsServer"
                      },
                      {
                        "field": "Microsoft.Compute/imageSKU",
                        "notLike": "2008*"
                      }
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "field": "Microsoft.Compute/imagePublisher",
                        "equals": "MicrosoftSQLServer"
                      },
                      {
                        "field": "Microsoft.Compute/imageOffer",
                        "notLike": "SQL2008*"
                      }
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "field": "Microsoft.Compute/imagePublisher",
                        "equals": "microsoft-dsvm"
                      },
                      {
                        "field": "Microsoft.Compute/imageOffer",
                        "like": "dsvm-win*"
                      }
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "field": "Microsoft.Compute/imagePublisher",
                        "equals": "microsoft-ads"
                      },
                      {
                        "field": "Microsoft.Compute/imageOffer",
                        "in": [
                          "standard-data-science-vm",
                          "windows-data-science-vm"
                        ]
                      }
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "field": "Microsoft.Compute/imagePublisher",
                        "equals": "batch"
                      },
                      {
                        "field": "Microsoft.Compute/imageOffer",
                        "equals": "rendering-windows2016"
                      }
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "field": "Microsoft.Compute/imagePublisher",
                        "equals": "center-for-internet-security-inc"
                      },
                      {
                        "field": "Microsoft.Compute/imageOffer",
                        "like": "cis-windows-server-201*"
                      }
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "field": "Microsoft.Compute/imagePublisher",
                        "equals": "pivotal"
                      },
                      {
                        "field": "Microsoft.Compute/imageOffer",
                        "like": "bosh-windows-server*"
                      }
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "field": "Microsoft.Compute/imagePublisher",
                        "equals": "cloud-infrastructure-services"
                      },
                      {
                        "field": "Microsoft.Compute/imageOffer",
                        "like": "ad*"
                      }
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "anyOf": [
                          {
                            "field": "Microsoft.Compute/virtualMachines/osProfile.windowsConfiguration",
                            "exists": "true"
                          },
                          {
                            "field": "Microsoft.Compute/virtualMachines/storageProfile.osDisk.osType",
                            "like": "Windows*"
                          }
                        ]
                      },
                      {
                        "anyOf": [
                          {
                            "field": "Microsoft.Compute/imageSKU",
                            "exists": "false"
                          },
                          {
                            "allOf": [
                              {
                                "field": "Microsoft.Compute/imageSKU",
                                "notLike": "2008*"
                              },
                              {
                                "field": "Microsoft.Compute/imageOffer",
                                "notLike": "SQL2008*"
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  }
                ]
              }
            ]
          },
          {
            "allOf": [
              {
                "value": "[parameters('IncludeArcMachines')]",
                "equals": "true"
              },
              {
                "anyOf": [
                  {
                    "allOf": [
                      {
                        "field": "type",
                        "equals": "Microsoft.HybridCompute/machines"
                      },
                      {
                        "field": "Microsoft.HybridCompute/imageOffer",
                        "like": "windows*"
                      }
                    ]
                  },
                  {
                    "allOf": [
                      {
                        "field": "type",
                        "equals": "Microsoft.ConnectedVMwarevSphere/virtualMachines"
                      },
                      {
                        "field": "Microsoft.ConnectedVMwarevSphere/virtualMachines/osProfile.osType",
                        "like": "windows*"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.GuestConfiguration/guestConfigurationAssignments",
          "name": "AuditSecureProtocol",
          "existenceCondition": {
            "allOf": [
              {
                "field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/complianceStatus",
                "equals": "Compliant"
              },
              {
                "field": "Microsoft.GuestConfiguration/guestConfigurationAssignments/parameterHash",
                "equals": "[base64(concat('[SecureWebServer]s1;MinimumTLSVersion', '=', parameters('MinimumTLSVersion')))]"
              }
            ]
          }
        }
      }
    },
    "versions": [
      "4.1.1"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/xxxxxxxxxxxxxxxx",
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "xxxxxx-xxxxxxxxx-xxxxxxxxxxx-xxxxxxxx"
}


Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
941 questions
Azure Advisor
Azure Advisor
An Azure personalized recommendation engine that helps users follow best practices to optimize Azure deployments.
71 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Rahul Podila 1,070 Reputation points Microsoft Vendor
    2025-01-08T06:37:49.25+00:00

    Hi @MrFlinstone

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    The Guest Configuration extension is responsible for checking whether your VMs are compliant with security settings. Please make sure this extension is installed on all the affected VMs. If it's missing, you can install it easily through the Azure Portal or using Azure CLI.

    Your VMs need to use TLS 1.2 (the latest version of the security protocol), and older versions like TLS 1.0 and TLS 1.1 should be disabled. To check this, you can review the Windows registry on each VM or run a PowerShell script to ensure the proper settings are in place.

    The system-assigned managed identity should be enabled for the VMs to work with the Guest Configuration extension. You can enable this identity directly in the Azure Portal under the Identity section of your VM settings.

    Double-check that the Azure Policy related to secure communication is being applied. You can do this by looking at the Azure Policy section in the Portal to ensure your VMs are listed as compliant.

    If you're using custom images for your VMs, make sure those are also configured correctly with TLS settings. Custom setups sometimes interfere with the policy, so it’s worth reviewing them.

    After you’ve made these changes, try re-running the Azure Resource Graph query to see if the compliance status has updated to “healthy.”

    After applying the fixes, keep an eye on your VMs for the next few days. Once everything is in place, the alert should disappear, and your VMs will be marked as compliant.

    If you have any concern, please refer these link: -

    https://learn.microsoft.com/en-us/troubleshoot/entra/entra-id/ad-dmn-services/enable-support-tls-environment?tabs=azure-monitor

    https://learn.microsoft.com/en-us/azure/governance/resource-graph/changes/get-resource-changes?tabs=azure-cli

    If you have any further queries, do let us know


    If the answer is helpful, please click "Accept Answer" and "Upvote it"


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.