我有在Azure Cloud中为Azure DevOps管道URL创建的服务主帐户。如何对URL进行休息?

发布于 2025-02-06 09:03:24 字数 255 浏览 2 评论 0 原文

I have the follwing url for triggering azure devops pipiline url https://dev.azure.com/xxx/xxx/xxx.This url registered in azure cloud service principal account. previously I used pat token for authentication. now I want to use service principal account. I have clint id and cliend secret of the service principal account. Now How can I make call to the pipeline url through post man or using logic apps. any documentation or something will be really helpfull for me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

丑丑阿 2025-02-13 09:03:24

您可以使用 curl 对URL进行休息。您可以在链接中了解有关卷曲的更多信息。

由于您创建了服务主帐户,因此

首先您需要请求访问令牌。

curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' 
https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token 
-d 'client_id=<client-id>' 
-d 'grant_type=client_credentials' 
-d 'scope=<scope.default>' 
-d 'client_secret=<client-secret>'

然后,您可以使用 bearer令牌来调用Azure REST API:

curl -X GET \
    -H 'Authorization: Bearer <access-token>' \
    https://{instance}/{collection}/{team-project}/_apis/{area}/{resource}?api-version={version}

You can use curl to make a rest call to the url. You can learn more about curl in the link.

Since you have service principal account created,

First you need to request the Access Token.

curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' 
https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token 
-d 'client_id=<client-id>' 
-d 'grant_type=client_credentials' 
-d 'scope=<scope.default>' 
-d 'client_secret=<client-secret>'

Then you can call Azure REST API using Bearer Token to be authorized:

curl -X GET \
    -H 'Authorization: Bearer <access-token>' \
    https://{instance}/{collection}/{team-project}/_apis/{area}/{resource}?api-version={version}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文