Is there someone else, perhaps in your household, (or maybe a friend) that has an Apple Music Account that you, or they, could try to add their account to your Sonos system using another iOS device, just on a temporary basis, as a quick test?
I’m wondering if it’s perhaps either an Apple account issue, or maybe problems with your controller device/software when authorising Apple Music. Maybe try another device, if that’s practicable, or consider a ‘reset’ of your Sonos controller App.
I have AM working okay here, so I’m thinking it’s unlikely a Sonos software issue (generally speaking) but maybe a ‘glitch’ on your controller device …and it does appear that no one else is chipping in here to complain about the same/similar matter either.
It’s weird because it’s worked fine for 2 years, but now I just get the error. Nothing in the household has changed since the error started appearing.
I’ve tried using a couple of iOS devices and my laptop and I still get the issue. I’ve tried resetting my wifi, resetting my Sonos app, removing and re-adding my Apple Music account from Sonos, removing and reinstalling both the Sonos & Apple Music apps from my phone. Nothing seems to work.
Maybe go onto submit a Sonos diagnostic report immediately after failing to setup the AM service and note it’s reference and then contact/chat to Sonos Support Staff via this LINK to see if they can assist you to resolve the matter.
Hope you are able to get the matter sorted.