We use the Online Archive feature to free up space when the mailbox is full or archive emails older than a specific date.
I have prepared a script that includes all the steps you need to take, such as the retention tag and policy, while activating the Online Archive.
After running this script via Powershell, it will prompt you to specify the e-mail address of the relevant user and the retention period. That’s enough to enable in-place archive and assign a retention policy to the user.
You can download and use the script on GitHub by clicking here.