我是权利管理新手,我想通过使用访问包 ID 来列出访问包内的资源角色列表。有没有办法使用 powershell 来做到这一点?
我想查看与访问包关联的 AAD 组
我尝试使用 Get-MgBetaEntitlementManagementAccessPackageResource,但每次我添加一个我知道有效的访问包 ID 时,我都会收到错误,它为空
我有一个具有资源角色的访问包,其中有一个具有 Owner 角色的 Azure AD 组,如下所示:
要使用 Microsoft Graph PowerShell 获取这些资源角色,您可以使用以下示例脚本:
Connect-MgGraph -Scopes "EntitlementManagement.Read.All"
$accessPackageId = "61cx1bxx-bx3c-4dx8-8xx-xxxxxx"
$accessPackage = Get-MgEntitlementManagementAccessPackage -AccessPackageId $accessPackageId -ExpandProperty "resourceRoleScopes(`$expand=role,scope)"
if ($accessPackage) {
# Iterate through each resource role scope
foreach ($resourceRoleScope in $accessPackage.ResourceRoleScopes) {
$role = $resourceRoleScope.Role | Where-Object { $_ -ne $null } | Select-Object -Property Description, DisplayName, Id, OriginId, OriginSystem
$scope = $resourceRoleScope.Scope | Where-Object { $_ -ne $null } | Select-Object -Property Description, DisplayName, Id, IsRootScope, OriginId, OriginSystem
$modifiedObject = @{
Id = $resourceRoleScope.Id
Role = $role
Scope = $scope
}
$jsonResult = $modifiedObject | ConvertTo-Json
Write-Host $jsonResult
}
} else {
Write-Host "Access package not found."
}
回复:
要获取与访问包关联的组的详细信息,请运行以下命令,将上面响应中的
$groupId
替换为 OriginId:
Get-MgGroup -GroupId $groupId
回复: