Since you have already tried the group policy part, will suggest few additional ones
You can try enabling RDP keep-alive at the network level
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v "KeepAliveEnable" /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v "KeepAliveInterval" /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v "KeepAliveTimeout" /t REG_DWORD /d 60000 /f
Here the keep-alive interval is set to 60 seconds. You can increase it as long as your service needs to run
Apart from this you can disable user account auto-logoff
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "InactivityTimeoutSecs" /t REG_DWORD /d 0 /f
Restart the VM to apply the changes

As per the MS documentation- Remote Desktop disconnects frequently in Azure VM - Virtual Machines | Microsoft Learn
Below things are suggested. Check if you have tried them all
Check the turn off display setting

This one you already tried

Modify the group policies accordingly under gpedit.msc
- Set time limit for disconnected sessions- Enabled, set to Never
- Set time limit for active but idle Remote Desktop Services sessions- Enabled, set to Never
- End session when time limits are reached- Disabled




Configure keep-alive connection interval- turn it to Enabled, set it to 1

then disable session timeouts and enable keep-alive
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v "MaxDisconnectionTime" /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v "MaxIdleTime" /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v "MaxConnectionTime" /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v "KeepAliveTimeout" /t REG_DWORD /d 1 /f

Update Local Security Policy under secpol.msc -> Local Policies > Security Options

This should fix your logout issue.
Reference