通过REST API为Azure API管理服务获取apim用户git secret [英] Attain apim user git secret through REST API for Azure API Management Service

查看:68
本文介绍了通过REST API为Azure API管理服务获取apim用户git secret的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在遵循文档之后,实际上没有一种明确的方法可以在azure门户网站UI之外生成用于API管理的Git用户'apim'秘密。 



一旦我收到租户用户的git凭证


GET  https://management.azure.com/subscriptions/sub#/resourceGroups/myrg/providers/Microsoft.ApiManagement/service/myservice/tenant/access/?api-version=2018- 06-01-preview



回复:


{

    " id":" integration",$
    " primaryKey":" key1",&
    " secondaryKey":" key2",&
    "启用":真实
}



为apim用户生成令牌的下一步是什么,然后接收克隆repo的url。

解决方案

为了生成令牌,我们需要在REST API调用下面使用 {userId}的值等于git


https://management.azure.com/subscriptions/ {subscriptionId} / resourceGroups / {resourceGroupName} /providers/Microsoft.ApiManagement/service/ {serviceName} / users / {userId} / token?api-version = 2018-06-01-preview


它记录在User - Get Shared Access Token。


https://docs.microsoft.com/en-us/rest/api/apimanagement/user/getsharedaccesstoken


After following the documentation there isn't really a clear way to generate Git user 'apim' secret for API management outside of the azure portal UI. 

Once I receive the git credentials for the tenant user

GET https://management.azure.com/subscriptions/sub#/resourceGroups/myrg/providers/Microsoft.ApiManagement/service/myservice/tenant/access/?api-version=2018-06-01-preview

Response:

{
    "id": "integration",
    "primaryKey": "key1",
    "secondaryKey": "key2",
    "enabled": true
}

What is the next step to generate the tokens for the apim user then receive the url to clone the repo.

解决方案

For generating the token we need to use below REST API call with value of {userId} equal to git.

https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}/token?api-version=2018-06-01-preview

It is documented under User - Get Shared Access Token.

https://docs.microsoft.com/en-us/rest/api/apimanagement/user/getsharedaccesstoken


这篇关于通过REST API为Azure API管理服务获取apim用户git secret的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆