Apologies if it's a bit obvious but probably the first thing to check is that you've actually granted permission for your app to access Apple Music on your Mac.
i.e. in the System Preferences app, Security & Privacy -> Privacy -> Media & Apple Music. Is your app listed there and is access enabled?
Just to confirm, this call is working Ok for me on Ventura (unlike any of the newer MusicKit functions).
Topic:
Media Technologies
SubTopic:
General
Tags: