如何显示Azure的UserID?

问题描述 投票:1回答:2

我想尝试以下API。

用户 - 获取共享访问令牌(API管理)https://docs.microsoft.com/en-us/rest/api/apimanagement/user/getsharedaccesstoken

但我无法发现我的用户ID。这可能是24个字符的字符串。我怎么能表明这一点?

azure azure-api-management
2个回答
2
投票

你可以通过powershell或rest api获得userId

1.使用powershell:Get-AzApiManagementUser

$ApiMgmtContext = New-AzApiManagementContext -ResourceGroupName "<ResourceGroupName >" -ServiceName "<API Management service name>"
Get-AzApiManagementUser -Context $ApiMgmtContext

该命令将列出所有用户,找到你想要的那个,结果中的UserId就是那个。

enter image description here

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就是你想要的。

enter image description here


1
投票

您可以使用qazxsw poi查找您的用户ID。

subscriptions-> your subscription-> resourceGroups - > your resource group - > providers - > Microsoft.ApiManagement - > service - > your ApiManagement service - > users

Resource Explorer

name标记是您的userID,1是默认的Administrator用户ID。

© www.soinside.com 2019 - 2024. All rights reserved.