最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

azure - How to retrieve the owners of a deleted app registration without restoring it first? - Stack Overflow

programmeradmin7浏览0评论

I want to retrieve the owners of a deleted app registration without first restoring it, so I run the following PowerShell cmdlet:

(Get-MgDirectoryDeletedItemAsApplication -DirectoryObjectId 46617322-518d-4b76-9b69-f17d6b035ae4 -ExpandProperty Owners).Owners

While several properties are defined on the application object, I can't expand the owners property to retrieve the list of owners.

How to retrieve the owners of a deleted app registration without restoring it first?

I want to retrieve the owners of a deleted app registration without first restoring it, so I run the following PowerShell cmdlet:

(Get-MgDirectoryDeletedItemAsApplication -DirectoryObjectId 46617322-518d-4b76-9b69-f17d6b035ae4 -ExpandProperty Owners).Owners

While several properties are defined on the application object, I can't expand the owners property to retrieve the list of owners.

How to retrieve the owners of a deleted app registration without restoring it first?

Share Improve this question asked Feb 5 at 9:27 ShuzhengShuzheng 13.9k28 gold badges114 silver badges225 bronze badges 3
  • Try Get-MgApplicationOwner -ApplicationId $deletedApp.Id – Rukmini Commented Feb 5 at 9:33
  • That returns an error, as the application doesn't exist in a non-deleted state: Get-MgApplicationOwner_List: Resource 'xxxxxxxx-518d-4b76-9b69-f17d6b035ae4' does not exist or one of its queried reference-property objects are not present. – Shuzheng Commented Feb 5 at 9:46
  • AFAIK You can't directly fetch the owners of a deleted Azure AD application, you have to restore and then fetch – Rukmini Commented Feb 5 at 9:54
Add a comment  | 

1 Answer 1

Reset to default 1

No way to directly get owners of a soft-deleted application, but you can do just the opposite and retrieve a list of deleted applications owned by the specified user.

There is no PowerShell cmdlet for this, but you can use the Invoke-MgGraphRequest cmdlet.

$params = @{
    userId = 'user_guid'
    type = 'Application'
}

Invoke-MgGraphRequest -Uri 'https://graph.microsoft.com/v1.0/directory/deletedItems/getUserOwnedObjects' POST -Body $params

Iterate over all users and get a list of owned soft-deleted applications. Check if the specific application is included in the list for each user.

发布评论

评论列表(0)

  1. 暂无评论