管理开发人员门户所需的最少访问权限

问题描述

授予人员访问权限以更改开发者门户所需的最小安全设置是什么,但无权修改API Management服务中的其他对象?

解决方法

最低权限为Microsoft.ApiManagement/service/users/token/action

如果您想限制用户的访问权限,则可以使用上述权限创建一个custom RBAC role

以下是创建角色的powershell示例,请确保首先安装了Az powershell模块。

Import-Module Az 
Connect-AzAccount 
$contributorRole = Get-AzRoleDefinition "API Management Service Contributor" 
$customRole = $contributorRole 
$customRole.Id = $null
$customRole.Name = "APIM New Portal Admin" 
$customRole.Description = "This role gives the user ability to log in to the new Developer portal as administrator" 
$customRole.Actions = "Microsoft.ApiManagement/service/users/token/action" 
$customRole.IsCustom = $true 
$customRole.AssignableScopes.Clear() 
$customRole.AssignableScopes.Add('/subscriptions/<subscription-id>') 
New-AzRoleDefinition -Role $customRole 

创建角色后,将角色分配给用户,以下PowerShell命令演示如何在最低范围内将角色分配给用户user1以避免向用户授予不必要的权限:

New-AzRoleAssignment -SignInName "user1@contoso.com" -RoleDefinitionName "APIM New Portal Admin" -Scope "/subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.ApiManagement/service/<apim-service-name>/users/1" 

有关更多详细信息,请参见What permissions do I need to edit the developer portal