Hi @PratikSavla,
IRM-protected documents cannot be encrypted in Office Online Server and Office Web Apps Server. This is because Office Online Server and Office Web Apps Server rely on the document host system, such as SharePoint, to communicate with Rights Management servers because it has no means to directly communicate with Rights Management servers. IRM protection prevents Office Online Server and Office Web Apps Server from allowing editing of IRM protected documents. Documents that have any IRM permissions modification or protection added from Office applications and are stored on a document management system can't be opened by Office Online Server and Office Web Apps Server. This is true with IRM protected documents that are stored on other third-party host systems. Therefore, IRM-protected files opening unencrypted in Office Online Server is expected behavior.
Reference: Office Online limitations and features with Information Rights Management (IRM).
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
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.