我想尝试以下API。
用户 - 获取共享访问令牌(API管理)https://docs.microsoft.com/en-us/rest/api/apimanagement/user/getsharedaccesstoken
但我无法发现我的用户ID。这可能是24个字符的字符串。我怎么能表明这一点?
你可以通过powershell或rest api获得userId
。
1.使用powershell:Get-AzApiManagementUser
$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "<ResourceGroupName >" -ServiceName "<API Management service name>"
Get-AzApiManagementUser -Context $ApiMgmtContext
该命令将列出所有用户,找到你想要的那个,结果中的UserId
就是那个。
2.使用休息api:User - List By Service
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users?api-version=2018-06-01-preview
结果中的name
就是你想要的。
您可以使用qazxsw poi查找您的用户ID。
subscriptions-> your subscription-> resourceGroups - > your resource group - > providers - > Microsoft.ApiManagement - > service - > your ApiManagement service - > users
name标记是您的userID,1是默认的Administrator用户ID。