I faced the similar issue and found alternate option.
1, I have created a pwershell script inside the VM "C:\Scripts\winget.ps1" commands inside the script is
winget install mozilla.firefox --source winget
winget install -e --id Google.Chrome.EXE --source winget
2, I have created a task scheduler with below security option.
Click the radio button --> Run whether user is logged out or not
Check this box --> Do not store password
Check this box --> Run with highest privilege
3, Go to Azure VM Run Command Script and run schtasks /run /tn "taskname"
The packages are installed successfully