Forum Discussion
Why does the API call stop working when used as written in the documentation with Service Principal?
- 1 year ago
Hi SergikitoDZ , The issue arises because Service Principals (SPs) are restricted to workspace-scoped API calls, while admin-level and organization-wide APIs require delegated user authentication. This explains why calling /groups/{workspaceId}/datasets/{datasetId}/datasources works with an SP, but calling /datasets/{datasetId}/datasources directly results in a 403 Forbidden error, as it is an organization-wide endpoint not accessible to applications. Similarly, the admin API (/admin/users/{userId}/artifactAccess) fails with a 401 Unauthorized error because SPs lack delegated permissions, which are required for tenant-wide admin operations. To resolve this, you should use a user account with delegated permissions for admin APIs, while keeping SPs for workspace-level interactions. This is a security limitation set by Microsoft to prevent SPs from performing broad administrative actions across the tenant.
Hi SergikitoDZ ,
Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.
Regards,
Xiaoxin Sheng