針對 Microsoft Intune 中的 VPN 配置文件問題進行疑難解答

原始產品版本:Microsoft Intune
原始 KB 編號: 4519426

簡介

本指南可協助您瞭解和疑難解答使用 Microsoft Intune 時可能發生的 VPN 配置文件問題。

本指南中的範例會使用簡單的憑證註冊通訊協定 (SCEP) 憑證驗證。 這些範例也假設受信任的根目錄和 SCEP 配置檔在裝置上正常運作。 在範例中,信任的根目錄和 SCEP 配置檔的命名如下:

設定檔類型 Android iOS Windows
受信任的根配置檔 AndroidRoot iOSRoot WindowsRoot2
SCEP 配置檔 AndroidSCEP iOSSCEP WindowsSCEP2

VPN 配置檔概觀

虛擬專用網 (VPN) 讓使用者安全地遠端訪問組織的網路。 裝置使用 VPN 連線設定檔來開始與 VPN 伺服器的連線。 在 Intune 中,VPN 配置檔會將 VPN 設定指派給組織中的使用者和裝置。 然後,用戶可以輕鬆且安全地連線到組織網路。

例如,如果您想要設定所有具有必要設定的 iOS 裝置,以連線到組織網路上的檔案共用,您可以建立包含這些設定的 VPN 設定檔,並將此設定檔指派給擁有 iOS 裝置的所有使用者。 之後,用戶可以在可用的網路清單中看到 VPN 連線,並以最少的精力進行連線。

您可以使用不同的 VPN 連線類型來建立 VPN 設定檔。

注意事項

您必須先安裝設定檔適用的 VPN 應用程式,才能使用指派給裝置的 VPN 設定檔。

如何建立 VPN 設定檔

若要建立 VPN 設定檔,請遵循 建立裝置設定檔中的步驟。

如需範例,請參閱下列螢幕快照:

注意事項

在範例中,Android 和 iOS VPN 配置檔的連線類型是 Cisco AnyConnect,而適用於 Windows 10 的連線類型是自動的。 VPN 設定檔會連結至 SCEP 設定檔。

顯示如何建立Android VPN 設定檔的螢幕快照。

如何指派 VPN 設定檔

建立 VPN 設定檔之後, 請將設定檔指派給 選取的群組。

注意事項

群組類型部署 (使用者群組或裝置群組) 很重要,而且必須與此資源原則 (受信任憑證、SCEP 和 VPN) 的所有原則保持一致。 這取決於您要部署的憑證類型。 如果您要部署用戶憑證,則所有部署都應該是使用者群組,反之亦然。 如果部署的憑證是第一個裝置類型,請使用裝置群組。

如需範例,請參閱下列螢幕快照:

顯示如何指派配置檔的螢幕快照。

成功的 VPN 設定文件外觀

此案例會使用註冊為個人擁有工作配置檔的 Android 裝置。 由於已在裝置上安裝受信任的根目錄和 SCEP 配置檔,因此系統不會提示您安裝 SCEP 憑證。

  1. 您會收到安裝公司 VPN 設定檔的通知:

    顯示安裝 VPN 設定檔通知的螢幕快照。

    如果您未收到通知,請點選 [ 變更設定 ] 按鈕,以在 AnyConnect 應用程式中啟用 [外部控制 ] 選項。 然後,您會收到通知。

    顯示 [變更設定] 按鈕的螢幕快照。

    顯示 [外部控制] 選項的螢幕快照。

    顯示已啟用 [外部控制] 選項的螢幕快照。

  2. 在 AnyConnect 應用程式中選取 SCEP 憑證:

    顯示選擇憑證頁面的螢幕快照。

    注意事項

    使用裝置系統管理員管理的 Android 裝置時,可能會有多個憑證,因為憑證不會在憑證配置檔變更或移除時撤銷或移除。 在此案例中,選取最新的憑證。 這通常是清單中顯示的最後一個憑證。

    這種情況不會發生在 Android Enterprise 和 Samsung Knox 裝置上。 如需詳細資訊,請參閱使用 Intune 管理 Android 工作配置檔裝置移除 Microsoft Intune 中的 SCEP 和 PKCS 憑證

  3. 已成功建立 VPN 連線。

    顯示已成功建立 VPN 連線的螢幕快照。

成功部署 VPN 設定檔的 公司入口網站 記錄

在 Android 裝置上, Omadmlog.log 檔案會記錄 VPN 配置檔在裝置上處理時的詳細活動。 視 公司入口網站 應用程式的安裝時間長度而定,您最多可以有五個Omadmlog.log檔案,而上次同步處理的時間戳可協助您尋找相關專案。

下列範例會使用 CMTrace 讀取記錄並搜尋 android.vpn.client

此螢幕快照顯示使用CMTrace讀取記錄,並搜尋android.vpn.client的範例。

範例記錄:

<Date Time>    INFO    com.microsoft.omadm.platforms.android.vpn.client.IntentVpnProfileProvisionStateMachine    13229    00622    Notifying to provision vpn profile 'AnyConnect'.
<Date Time>    INFO    com.microsoft.omadm.platforms.android.vpn.client.IntentVpnProfileProvisionStateMachine    13229    00622    VPN Profile "AnyConnect" state changed from RECEIVED to PENDING_USER_INSTALL
<Date Time>    VERB    com.microsoft.omadm.platforms.android.vpn.client.VpnClient    13229    00002    Creating VPN Provision Intent: anyconnect://create/?host=VPN.contoso.com&name=AnyConnect&usecert=true&keychainalias=UserID
<Date Time>    INFO    com.microsoft.omadm.platforms.android.vpn.client.IntentVpnProfileProvisionStateMachine    13229    00002    Vpn profile 'AnyConnect' provisioned and complete.
<Date Time>    INFO    com.microsoft.omadm.platforms.android.vpn.client.IntentVpnProfileProvisionStateMachine    13229    00002    VPN Profile "AnyConnect" state changed from PENDING_USER_INSTALL to PROVISIONED

針對常見問題進行疑難解答

問題 1:VPN 配置檔未部署至裝置

  1. 確認 VPN 設定檔已指派給正確的群組。

    在 Intune 入口網站中,選取 [裝置組態>配置檔],然後選取配置檔,然後選取 [指派] 以確認選取的群組。

    顯示Android群組指派 VPN 設定檔的螢幕快照。

  2. 檢查 [疑難解答] 窗格上的 [上次簽入時間],確認裝置可以與 Intune 同步。

    顯示 [Android 疑難解答] 窗格上 [上次簽入時間] 的螢幕快照。

  3. 如果 VPN 設定檔連結至受信任的根目錄和 SCEP 設定檔,請確認這兩個設定檔都已部署至裝置。 VPN 設定檔相依於這些配置檔。

    如果裝置上未安裝受信任的根目錄和 SCEP 配置檔,您會在 公司入口網站 記錄檔中看到下列專案 (Omadmlog.log) :

    <Date Time> INFO com.microsoft.omadm.platforms.android.vpn.client.IntentVpnProfileProvisionStateMachine 14210 00948 Waiting for required certificates for vpn profile 'androidVPN'.

    注意事項

    即使受信任的根目錄和 SCEP 配置檔在裝置上且符合規範,VPN 配置檔仍然不在裝置上。 當來自 公司入口網站 應用程式的CertificateSelector提供者找不到符合指定準則的憑證時,就會發生此問題。 特定準則可以在證書範本或 SCEP 設定檔中。 如果找不到相符的憑證,將會排除裝置上的憑證。 因此,將會略過 VPN 配置檔,因為它沒有正確的憑證。 在此案例中,您會在 公司入口網站 記錄檔中看到下列專案 (Omadmlog.log) :

    Waiting for required certificates for vpn profile 'androidVPN'.

    下列範例記錄顯示憑證已排除,因為已指定 任何目的 擴充密鑰使用 (EKU) 準則。 不過,指派給裝置的憑證沒有該 EKU:

    <Date Time>    VERB     com.microsoft.omadm.utils.CertUtils      14210    00948    Excluding cert with alias User<ID1> and requestId <requestID1> as it does not have any purpose EKU.
    <Date Time>    VERB     com.microsoft.omadm.utils.CertUtils      14210    00948    Excluding cert with alias User<ID2> and requestId <requestID2> as it does not have any purpose EKU.
    <Date Time>    VERB     com.microsoft.omadm.utils.CertUtils      14210    00948    0 cert(s) matched criteria:
    <Date Time>    VERB     com.microsoft.omadm.utils.CertUtils      14210    00948    2 cert(s) excluded by criteria:
    <Date Time>    INFO     com.microsoft.omadm.platforms.android.vpn.client.IntentVpnProfileProvisionStateMachine       14210     00948    Waiting for required certificates for vpn profile '<profile name>'.
    

    下列範例顯示 SCEP 配置檔具有指定 [ 任何用途 EKU] 的選項。 不過,在證書頒發機構單位的證書範本中並未指定它, (CA) 。 若要修正此問題,請將 [ 任何目的] 選項新增至證書範本,或從 SCEP 配置檔中移除 [ 任何目的] 選項。

    顯示如何新增 [任何用途] 選項的螢幕快照。

    顯示 [任何用途] 選項的螢幕快照。

  4. 確認已啟用 AnyConnect 的 [外部控制 ] 選項。

    在建立配置檔之前,必須先啟用 [外部控制 ] 選項。 當配置檔推送至裝置時,系統會提示用戶啟用 [外部控制] 選項。

    顯示如何檢查 [外部控制] 選項的螢幕快照。

    顯示已啟用 [外部控制] 選項的螢幕快照。

  5. 確認完整憑證鏈結中的所有必要憑證都位於裝置上。 否則,您會在 公司入口網站 記錄檔中看到下列專案 (Omadmlog.log) :

    Waiting for required certificates for vpn profile 'androidVPN'.

    如需詳細資訊,請 參閱遺漏中繼證書頒發機構單位

問題 2:VPN 配置檔已部署至裝置,但裝置無法連線到網路

一般而言,此聯機問題不是 Intune 問題,而且有許多原因。 下列項目可協助您了解問題並進行疑難解答:

  • 您可以使用 VPN 設定檔中具有相同準則的憑證,手動連線到網路嗎?

    如果可以,請檢查您在手動連線中使用的憑證屬性,並變更 Intune VPN 設定檔。

  • 針對 Android 和 iOS 裝置,VPN 用戶端應用程式記錄是否顯示裝置嘗試連線到 VPN 設定檔?

    通常,連線錯誤會記錄在 VPN 用戶端應用程式記錄中。

  • 針對 Windows 裝置,Radius 伺服器記錄檔是否顯示裝置嘗試連線到 VPN 設定檔?

    線上錯誤通常會記錄在 Radius 伺服器記錄中。

如何在 AnyConnect 應用程式中檢視記錄

若要檢視記錄,請參閱下列兩個適用於Android和iOS裝置的範例。

範例 1:檢視 Android 裝置上的記錄

  1. 選取 [功能表>診斷]

    顯示 Diagnostics 函式的螢幕快照。

  2. 若要檢視憑證,請選取 [ 憑證管理]

    顯示憑證管理函式的螢幕快照。

    顯示憑證信息的螢幕快照。

  3. 若要檢視記錄以分析 AnyConnect 問題,請選取 [記錄] 和 [系統資訊>偵錯]

    顯示記錄和系統資訊函式的螢幕快照。

    顯示偵錯資訊的螢幕快照。

  4. 若要傳送記錄,請選取 [功能表>] [將記錄>報告傳送給系統管理員]

    顯示傳送記錄函式的螢幕快照。

    顯示 [向系統管理員報告] 函式的螢幕快照。

  5. 取得偵錯記錄之後,請檢查 debug_logs_unfiltered.txt 檔案,以取得配置檔建立和聯機資訊。

建立 VPN 的範例記錄:

<Date Time> I/AnyConnect(14530): URIHandlerActivity: Received command: anyconnect://create?host=VPN.Contoso.com&name=AnyConnect&usecert=true&keychainalias=UserID
<Date Time> I/AnyConnect(14530): VpnService: VpnService is being created.

VPN 連線失敗的範例記錄:

<Date Time> I/vpnapi  (14530): Message type information sent to the user: Contacting VPN.Contoso.com.
<Date Time> I/vpnapi  (14530): Initiating VPN connection to the secure gateway https://VPN.Contoso.com
<Date Time> I/acvpnagent(14592): Using default preferences. Some settings (e.g. certificate matching) may not function as expected if a local profile is expected to be used. Verify that the selected host is in the server list section of the profile and that the profile is configured on the secure gateway.
<Date Time> I/acvpnagent(14592): Function: processConnectNotification File: MainThread.cpp Line: 14616 Received connect notification (host VPN.Contoso.com, profile N/A)
<Date Time> W/acvpnagent(14592): Function: getHostIPAddrByName File: SocketSupport.cpp Line: 344 Invoked Function: ::getaddrinfo Return Code: 11 (0x0000000B) Description: unknown 
<Date Time> W/acvpnagent(14592): Function: resolveHostName File: HostLocator.cpp Line: 710 Invoked Function: CSocketSupport::getHostIPAddrByName Return Code: -31129588 (0xFE25000C) Description: SOCKETSUPPORT_ERROR_GETADDRINFO 
<Date Time> W/acvpnagent(14592): Function: ResolveHostname File: HostLocator.cpp Line: 804 Invoked Function: CHostLocator::resolveHostName Return Code: -31129588 (0xFE25000C) Description: SOCKETSUPPORT_ERROR_GETADDRINFO failed to resolve host name VPN.Contoso.com to IPv4 address
<Date Time> I/vpnapi  (14530): Message type warning sent to the user: Connection attempt has failed.
<Date Time> E/vpnapi  (14530): Function: processIfcData File: ConnectMgr.cpp Line: 3399 Content type (unknown) received. Response type (DNS resolution failed) from VPN.Contoso.com: DNS resolution failed
<Date Time> I/vpnapi  (14530): Message type warning sent to the user: Unable to contact VPN.Contoso.com.
<Date Time> E/vpnapi  (14530): Function: processIfcData File: ConnectMgr.cpp Line: 3535 Unable to contact VPN.Contoso.com DNS resolution failed
<Date Time> I/vpnapi  (14530): Message type error sent to the user: The VPN connection failed due to unsuccessful domain name resolution.

範例 2:檢視 iOS 裝置上的記錄

  1. 若要檢視用戶憑證,請選取 [診斷憑證>]

    顯示匯入憑證的螢幕快照。

  2. 若要檢視記錄訊息,請選取 [診斷],啟用 [VPN 偵錯記錄 ] 選項以啟用記錄,然後選取 [ 記錄]

    • 若要顯示服務偵錯記錄訊息,請選取 [服務]
    • 若要顯示應用程式偵錯記錄訊息,請選取 [應用程式]

    顯示 [VPN 偵錯記錄] 選項的螢幕快照。

  3. 若要傳送記錄,請在 [診斷] 視窗中選取 [共享記錄],輸入問題的相關信息,然後選取 [傳送]

    顯示共享記錄函式的螢幕快照。

  4. 取得偵錯記錄之後,請檢查檔案中是否有配置檔建立和聯機資訊。

    顯示具有偵錯記錄檔之資料夾的螢幕快照。

顯示 VPN 設定檔的 AnyConnect_App_Debug_Logs.txt 檔案範例記錄:

[<Date Time>] Info: Function: SaveSettings File: AppleVpnConfig.mm Line: 198 SaveSettings {type = mutable dict, count = 3, entries => 0 : {contents = "RemoteAddress"} = {contents = "Contoso.com"} 1 : {contents = "AuthenticationMethod"} = {contents = "Certificate"} 2 : {contents = "LocalCertificate"} = <69646e74 00000000 000002d3> }
[<Date Time>] Info: Function: GetSettings File: AppleVpnConfig.mm Line: 175 GetSettings { AuthenticationMethod = Certificate; LocalCertificate = <69646e74 00000000 000002d3>; RemoteAddress = "Contoso.com"; }
[<Date Time>] Info: Function: -[AppleVpnConfigBatch startBatchSaveToSystem] File: AppleVpnConfigBatch.mm Line: 43 Invoking save to system with 0x28202fd60
[<Date Time>] Info: Function: saveToSystem_block_invoke File: AxtVpnConfig.mm Line: 222 Successfully saved profile for Contoso.com
[<Date Time>] Info: Function: -[AppleVpnConfigBatch startBatchSaveToSystem] File: AppleVpnConfigBatch.mm Line: 36 completed!.

顯示 VPN 連線 失敗的AnyConnect_Messages.txt 檔案範例記錄:

[<Date Time>] [VPN] - Contacting Contoso.com.
[<Date Time>] [VPN] - Connection attempt has failed.
[<Date Time>] [VPN] - Unable to contact CoolBreeze.com.
[<Date Time>] [VPN] - Connection attempt has timed out. Please verify Internet connectivity.

顯示 VPN 連線 失敗的AnyConnect_Plugin_Debug_Logs.txt 檔案範例記錄:

[<Date Time>] Info: Message type information sent to the user: Contacting Contoso.com.
[<Date Time>] Info: Initiating VPN connection to the secure gateway https://Contoso.com
[<Date Time>] Info: Function: NoticeCB File: AnyConnectAuthenticator.cpp Line: 2116 Sending notice Contacting Contoso.com. to App
[<Date Time>] Error: Function: SendRequest File: CTransportCurlStatic.cpp Line: 2046 Invoked Function: curl_easy_perform Return Code: -29949904 (0xFE370030) Description: CTRANSPORT_ERROR_TIMEOUT 28 : Error
[<Date Time>] Error: Function: TranslateStatusCode File: ConnectIfc.cpp Line: 3169 Invoked Function: TranslateStatusCode Return Code: -29949904 (0xFE370030) Description: CTRANSPORT_ERROR_TIMEOUT Connection attempt has timed out. Please verify Internet connectivity.
[<Date Time>] Error: Function: doConnectIfcConnect File: ConnectMgr.cpp Line: 2442 Invoked Function: ConnectIfc::connect Return Code: -29949904 (0xFE370030) Description: CTRANSPORT_ERROR_TIMEOUT 
[<Date Time>] Info: Message type warning sent to the user: Connection attempt has failed.
[<Date Time>] Error: Function: processIfcData File: ConnectMgr.cpp Line: 3407 Content type (unknown) received. Response type (host unreachable) from Contoso.com: 
[<Date Time>] Info: Message type warning sent to the user: Unable to contact Contoso.com.
[<Date Time>] Info: Function: NoticeCB File: AnyConnectAuthenticator.cpp Line: 2116 Sending notice Connection attempt has failed. to App
[<Date Time>] Error: Function: processIfcData File: ConnectMgr.cpp Line: 3543 Unable to contact Contoso.com 
[<Date Time>] Info: Function: NoticeCB File: AnyConnectAuthenticator.cpp Line: 2116 Sending notice Unable to contact Contoso.com. to App
[<Date Time>] Info: Message type error sent to the user: Connection attempt has timed out. Please verify Internet connectivity.

其他相關資訊

如果您仍在尋找相關問題的解決方案,或如果您想要有關 Microsoft Intune 的詳細資訊,請在 Microsoft Intune 論壇中張貼問題。 許多支持工程師、MVP 和開發小組成員造訪論壇。 因此,您很有可能可以找到具有所需信息的人員。

如果您想要向 Microsoft Intune 產品支援小組提出支援要求,請參閱如何取得 Microsoft Intune 的支援

如需有關 Intune 中 VPN 設定檔的詳細資訊,請參閱下列文章:

如需所有最新消息、信息和技術秘訣,請造訪官方部落格: