Please check the principal (user principal or service principal) have the following configured:
- Can use Fabric API --- (app.powerbi.com -> admin portal -- tenant settings)
- Be member of the workspace --- (app.powerbi.com -> managed access -> add people or groups)