We figured out the issue. We're using the hyperscale service tier which apparently doesn't support SHRINKFILE. This is from the official Microsoft documentation:
"DBCC SHRINKDATABASE or DBCC SHRINKFILE isn't currently supported for Hyperscale databases."
It doesn't mention anything about an alternative option, so I'm not sure if this is even possible with the hyperscale service tier.
If anyone is interested, here's the documentation page where we found the answer:
Thanks for your help.