Auto-Reconnect is not working in arm mode when the the bearer token is expired
Author: maordadushCreated Feb 20, 2025Updated Jun 30, 2026
Labelsfeaturewaiting-feedbackhelp-wantedaad
If you have an interruption in your connection to your AVD machine after an hour, the Auto-Reconnect will not work because the JWT bearer token is invalid(by default, access tokens are good for 1 hour). The ARM GW will then send you an HTTP_STATUS_DENIED [401] message.
xfreerdp SessionDesktop.rdpw /v:test-play-2 /sec:aad /log-level:debug /gateway:type:arm,bearer:<JWT> /d: /p:11111 /u:[email protected]> 16:26:02:501] [65277:0000fefe] [INFO][com.freerdp.client.common] - [client_auto_reconnect_ex]: Network disconnect!
> [16:26:02:501] [65277:0000fefe] [INFO][com.freerdp.client.common] - [client_auto_reconnect_ex]: Attempting reconnect (1 of 20)
> [16:26:02:501] [65277:0000fefe] [INFO][com.freerdp.client.common] - [client_common_retry_dialog]: [connection] retry 1/20, delaying 15000ms before next attempt
> [16:26:02:502] [65277:0000fefe] [DEBUG][com.freerdp.core.rdp] - [rdp_finalize_reset_flags][0x5dbc24c04640]: [CONNECTION_STATE_ACTIVE] reset finalize_sc_pdus
> [16:26:02:502] [65277:0000fefe] [DEBUG][com.freerdp.core.rdp] - [rdp_client_transition_to_state][0x5dbc24c04640]: CONNECTION_STATE_ACTIVE --> CONNECTION_STATE_INITIAL
> [16:26:02:503] [65277:0000ff50] [WARN][com.freerdp.channels.drdynvc.client] - [check_open_close_receive]: {Microsoft::Windows::RDS::Geometry::v08.01:12} OnOpen=(nil), OnClose=0x74300fe58ba0
> [16:26:02:509] [65277:0000fefe] [WARN][com.winpr.path.shell] - [GetKnownPath]: Path KNOWN_PATH_SYSTEM_CONFIG_HOME is 0x7430005e9270
> [16:26:02:511] [65277:0000fefe] [WARN][com.winpr.path.shell] - [GetKnownPath]: Path KNOWN_PATH_SYSTEM_CONFIG_HOME is 0x7430006032b0
> [16:26:02:569] [65277:0000fefe] [DEBUG][com.freerdp.core] - [freerdp_tcp_default_connect]: resetting error state
> [16:26:02:569] [65277:0000fefe] [DEBUG][com.freerdp.core] - [freerdp_tcp_default_connect]: connecting to peer 204.79.197.219
> [16:26:02:578] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [arm_tls_connect]: connecting to afdfp-rdgateway-r1.wvd.microsoft.com 443
> [16:26:02:812] [65277:0000fefe] [ERROR][com.freerdp.core.gateway.arm] - [http_response_log_error_status]: Unexpected HTTP status: HTTP_STATUS_DENIED [401]
> [16:26:02:812] [65277:0000fefe] [ERROR][com.freerdp.core.gateway.arm] - [http_response_print]: HTTP status: HTTP_STATUS_DENIED [401]
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [0] HTTP/1.1 401 Unauthorized
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [1] Content-Type: text/html
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [2] Set-Cookie: TiPMix
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [3] Set-Cookie: x-ms-routing-name
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [4] Set-Cookie: ARRAffinity
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [5] Set-Cookie: ARRAffinitySameSite
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [6] WWW-Authenticate: Claims:Authority=https://login.windows.net/common/;Client=a85cf173-4192-42f8-81fa-777a763e6e2c;Redirect=https://www.wvd.microsoft.com/webclient;Resource=https://www.wvd.microsoft.com;Site=501413
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [7] RD-InfraRole-Version: 24.8.13.329
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [8] x-ms-wvd-service-region: ILC
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [9] x-ms-lamport-ts: 7925181351
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [10] x-ms-correlation-id: a4393c4b-a52a-43a3-835c-87893d3f16ac
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [11] x-ms-request-id: f9c48bca-6aa4-4881-a302-b0e29578938d
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [12] X-Powered-By: ASP.NET
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [13] X-Content-Type-Options: nosniff
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [14] X-Cache: CONFIG_NOCACHE
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [15] X-MSEdge-Ref: Ref A: A1E54D6660084EB6AD4BCDCEBFF00240 Ref B: TLV30EDGE0121 Ref C: 2025-02-17T14:26:02Z
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [16] Date: Mon, 17 Feb 2025 14:26:01 GMT
> [16:26:02:812] [65277:0000fefe] [DEBUG][com.freerdp.core.gateway.arm] - [http_response_print]: [17] Content-Length: 0
> [16:26:02:812] [65277:0000fefe] [ERROR][com.freerdp.core.gateway.arm] - [http_response_print]: [reason] Unauthorized
> [16:26:02:813] [65277:0000fefe] [ERROR][com.freerdp.core.connection] - [rdp_client_connect]: error retrieving ARM configurationSource: FreeRDP/FreeRDP