大网数据广告活动
域与目录服务

Microsoft Entra Applications Using TLS 1.0/1.1 Fail to Authenticate

· 52CE 我爱测

Provides solutions to authentication errors that occur with Microsoft Entra applications using TLS version 1.0 or 1.1.

Summary

This article provides solutions to authentication errors that occur with Microsoft Entra-integrated applications targeting versions earlier than Microsoft .NET Framework 4.7.

Symptoms

Applications using an older version of the .NET Framework might encounter authentication failures with one of the following error messages:

  • AADSTS1002016: You are using TLS version 1.0, 1.1 and/or 3DES cipher which are deprecated to improve the security posture of Azure AD

  • IDX20804: Unable to retrieve document from: '[PII is hidden]'

  • IDX20803: Unable to obtain configuration from: '[PII is hidden]'

  • IDX10803: Unable to create to obtain configuration from: 'https://login.microsoftonline.com/{Tenant-ID}/.well-known/openid-configuration'

  • IDX20807: Unable to retrieve document from: 'System.String'

  • System.Net.Http.Headers.HttpResponseHeaders RequestMessage {Method: POST, RequestUri: '<request-uri>', Version: 1.1, Content: System.Net.Http.FormUrlEncodedContent, Headers: { Content-Type: application/x-www-form-urlencoded Content-Length: 970 }} System.Net.Http.HttpRequestMessage StatusCode UpgradeRequired This service requires use of the TLS-1.2 protocol

Cause

Starting January 31, 2022, Microsoft enforced the use of the TLS 1.2 protocol for client applications connecting to Microsoft Entra services on the Microsoft Identity Platform to ensure compliance with security and industry standards. For more information about this change, see Enable support for TLS 1.2 in your environment for Microsoft Entra TLS 1.1 and 1.0 deprecation and Act fast to secure your infrastructure by moving to TLS 1.2!

Applications running on older platforms or using older .NET Framework versions might not have TLS 1.2 enabled. Therefore, they can't retrieve the OpenID Connect metadata document, resulting in failed authentication.

Solution 1: Upgrade the .NET Framework

Upgrade the application to use .NET Framework 4.7 or later, where TLS 1.2 is enabled by default.

Solution 2: Enable TLS 1.2 programmatically

If upgrading the .NET Framework isn't feasible, you can enable TLS 1.2 by adding the following code to the Global.asax.cs file in your application:

using System.Net;

protected void Application_Start()
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Ssl3; // only allow TLS 1.2 and SSL 3
// The rest of your startup code goes here
}

Solution 3: Change web.config to enable TLS 1.2

If .NET Framework 4.7.2 is available, you can enable TLS 1.2 by adding the following configuration to the web.config file:

<system.web>
    <httpRuntime targetFramework="4.7.2" />
</system.web>

Note: If using .NET Framework 4.7.2 causes breaking changes to your app, this solution might not work.

Solution 4: Enable TLS 1.2 before running PowerShell commands

If you encounter the AADSTS1002016 error while running the PowerShell command Connect-MSolService, Connect-AzureAD, or Connect-MSGraph (from the Microsoft Intune PowerShell SDK module), set the security protocol to TLS 1.2 before executing the commands:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

References

Transport Layer Security (TLS) best practices with .NET Framework

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 05/09/2025
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。