@HarshaRatnayaka-8891 Thanks for posting in our Q&A.
For this issue, I have done a lot of research. I find that someone has met this similar issue.
https://www.reddit.com/r/Intune/comments/nxo33g/esp_hangs_when_installing_microsoft_365_apps/
Note: Non-Microsoft link, just for the reference.
And he solved this issue when he packaged an Office 365 installation as a win32 app. Just as Nick said. We can refer to the following link to deploy office 365 as a win32 app:
https://campbell.scot/deploying-office-365-with-intune-as-a-win32-app/
Note: Non-Microsoft link, just for the reference.
If we deploy the win32 app, please make sure we don't mix the installation of Win32 apps and line-of-business apps. If we mix, the app installation may fail.
Hope the above information will help.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.