我有一個名為devtest. 我想使用或從IAM -> Role assignments刀片中獲取串列:azure cliREST API

如何以編程方式檢索該資訊(等)group-id?display name是否可以獲得有權訪問資源的用戶和組的串列?
例如,使用graphim allowed 獲取簽名用戶所屬的組:
POST https://graph.microsoft.com/v1.0/me/getMemberGroups
Request Body:
{
"securityEnabledOnly": true
}
Response:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(Edm.String)",
"value": [
// group ids here
]
}
但是如何為資源做類似的事情并獲取在該資源中具有角色的用戶和組的串列?
編輯:
當我們去Role Assignments刀片時,Azure呼叫端點:
POST https://graph.windows.net/{subscriptionId}/getObjectsByObjectIds
Request body:
{ "objectIds":[ "bunch unknown ids here" ],"includeDirectoryObjectReferences":true }
我得到這樣的回應:

這與我在Role assignments選項卡中看到的內容有關,但并非所有職位都回傳。在這個回復中,我們沒有關于role如何挖掘它們的資訊?
uj5u.com熱心網友回復:
您可以使用以下 cmdlet 列出資源的所有角色分配及其各自的組(如果角色分配的物件型別不是用戶,它不會給您任何輸出)。
這是腳本:
connect-azuread # Manadatory to authenticate with azuread & to further run Get-azureadusermembership cmdlet
$rbac=Get-AzRoleAssignment -ResourceGroupName '<RgName>' -ResourceName '<ResourceName>' -ResourceType 'Microsoft.KeyVault/vaults' | Where-Object -Property ObjectType -EQ User| select -Property SignInName,ObjectId,RoleDefinitionName
Write-output $rbac
foreach($item in $rbac)
{
Get-AzureADUserMembership -ObjectId $item.ObjectId | select -Property *
}
以下是供參考的示例輸出:


轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/434768.html
標籤:天蓝色 天蓝色活动目录 微软图形 API 天蓝色广告图 API 天蓝色的cli
