While testing Fabric API's with POSTMAN, For Get Call, getting below error
https://api.fabric.microsoft.com/v1/workspaces/****
Error:
"errorCode": "InsufficientPrivileges", "message": "The caller does not have sufficient permissions to access the requested resource",
For Update Git API-POST call, getting below error https://api.fabric.microsoft.com/v1/workspaces/****/git/updateFromGit
Error:
"errorCode": "PrincipalTypeNotSupported", "message": "The operation is not supported for the principal type"
The error "The caller does not have sufficient permissions to access the requested resource" usually occurs if the Microsoft Entra ID application does not have proper permissions or role to call the API.
To resolve the error, you need to add Microsoft Entra ID application/Service Principal as Admin or contributor to the workspace:
Grant below API permission:
Generate access token:
https://login.microsoftonline.com/TenantID/oauth2/v2.0/token
client_id:
client_secret: xxx
scope: https://api.fabric.microsoft.com/.default
grant_type: client_credentials
I am able to call the API successfully:
GET https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}
Note that: The Update From Git API cannot be called using client credential flow. That is this API doesn't not support Service principal or managed identity. Refer this MsDoc
Hence you are getting the error "PrincipalTypeNotSupported" as you are generating access token from client credential flow and calling the API.
Hence to resolve the error, you need to switch to any user interactive flow and grant delegated API permission Workspace.GitUpdate.All
to the Microsoft Entra ID application.