te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>azure - Getting error while calling Fabric REST API's - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

azure - Getting error while calling Fabric REST API's - Stack Overflow

programmeradmin3浏览0评论

While testing Fabric API's with POSTMAN, For Get Call, getting below error

/****

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 /****/git/updateFromGit

Error:

"errorCode": "PrincipalTypeNotSupported",
"message": "The operation is not supported for the principal type"

Service Principal

While testing Fabric API's with POSTMAN, For Get Call, getting below error

https://api.fabric.microsoft/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/v1/workspaces/****/git/updateFromGit

Error:

"errorCode": "PrincipalTypeNotSupported",
"message": "The operation is not supported for the principal type"

Service Principal

Share Improve this question edited Feb 17 at 19:13 VLAZ 29.1k9 gold badges62 silver badges84 bronze badges asked Feb 17 at 14:15 SalmanSalman 1,8696 gold badges15 silver badges28 bronze badges 8
  • 1 Did you add service principal as a Admin or Contributor to the workspace? – Rukmini Commented Feb 17 at 14:30
  • 1 Note that the update git API cannot be called using client credential flow. You need to switch to interactive flow – Rukmini Commented Feb 17 at 15:17
  • There is only one user which is admin, Attached screenshot. How do I identify if its service principal – Salman Commented Feb 17 at 16:26
  • Whats the process of interactive flow? – Salman Commented Feb 17 at 16:28
  • 1 You have add your Microsoft Entra ID as contributor or admin. – Rukmini Commented Feb 17 at 16:28
 |  Show 3 more comments

1 Answer 1

Reset to default 0

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/TenantID/oauth2/v2.0/token

client_id:
client_secret: xxx
scope: https://api.fabric.microsoft/.default
grant_type: client_credentials

I am able to call the API successfully:

GET https://api.fabric.microsoft/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.

  • For sample, make use of Authorization code flow as detailed in this SO Thread by me.
  • You cannot use Service Principals due to API restrictions, but you can automate the process by using User-based Authentication once (via OAuth 2.0), and then store and use the access token in your Azure DevOps Pipeline for subsequent API calls.
  • Store the user access token securely. Use this token for subsequent automated API calls within the Azure DevOps pipeline.
  • You can also refresh the access token by implementing a script to refresh the access token before it expires.
发布评论

评论列表(0)

  1. 暂无评论