Get-EntraUserOwnedObject

取得使用者擁有的物件。

語法

Default (預設值)

Get-EntraUserOwnedObject

    -UserId <String>
    [-All]
    [-Top <Int32>]
    [-Property <String[]>]
    [<CommonParameters>]

Description

這個 Get-EntraUserOwnedObject cmdlet 會取得 Microsoft Entra ID 中使用者擁有的物件。 指定 UserId 參數讓使用者擁有物件。

範例

範例 1:取得使用者擁有的物件

Connect-Entra -Scopes 'User.Read'
Get-EntraUserOwnedObject -UserId 'SawyerM@contoso.com' |
Select-Object Id, displayName, createdDateTime, '@odata.type' |
Format-Table -AutoSize
id                                    displayName                  createdDateTime           @odata.type
--                                    -----------                  ---------------           -----------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb  Helpdesk Application         10/17/2024 5:05:54 AM     #microsoft.graph.application
bbbbbbbb-1111-2222-3333-cccccccccccc  Contoso Group                10/21/2024 6:25:19 PM     #microsoft.graph.group
cccccccc-2222-3333-4444-dddddddddddd  ClaimIssuancePolicy                                    #microsoft.graph.tokenLifetimePolicy
ffffffff-4444-5555-6666-gggggggggggg  Contoso Marketing App        10/23/2024 3:17:14 PM     #microsoft.graph.application

此範例取用的是指定使用者擁有的物件。

  • -UserId Parameter 指定使用者的 ID 為 UserPrincipalName 或 UserId。

範例 2:取得使用者擁有的所有物件

Connect-Entra -Scopes 'User.Read'
Get-EntraUserOwnedObject -UserId 'SawyerM@contoso.com' -All |
Select-Object Id, displayName, createdDateTime, '@odata.type' |
Format-Table -AutoSize
id                                    displayName                  createdDateTime           @odata.type
--                                    -----------                  ---------------           -----------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb  Helpdesk Application         10/17/2024 5:05:54 AM     #microsoft.graph.application
bbbbbbbb-1111-2222-3333-cccccccccccc  Contoso Group                10/21/2024 6:25:19 PM     #microsoft.graph.group
cccccccc-2222-3333-4444-dddddddddddd  ClaimIssuancePolicy                                    #microsoft.graph.tokenLifetimePolicy
ffffffff-4444-5555-6666-gggggggggggg  Contoso Marketing App        10/23/2024 3:17:14 PM     #microsoft.graph.application

此範例會取得指定使用者擁有的所有物件。

  • -UserId 參數指定使用者的 ID 為 UserPrincipalName 或 UserID。

範例 3:取得使用者擁有的前三名物件

Connect-Entra -Scopes 'User.Read'
Get-EntraUserOwnedObject -UserId 'SawyerM@contoso.com' -Top 3 |
Select-Object Id, displayName, createdDateTime, '@odata.type' |
Format-Table -AutoSize
id                                    displayName                  createdDateTime           @odata.type
--                                    -----------                  ---------------           -----------
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb  Helpdesk Application         10/17/2024 5:05:54 AM     #microsoft.graph.application
bbbbbbbb-1111-2222-3333-cccccccccccc  Contoso Group                10/21/2024 6:25:19 PM     #microsoft.graph.group
cccccccc-2222-3333-4444-dddddddddddd  ClaimIssuancePolicy                                    #microsoft.graph.tokenLifetimePolicy

此範例取回指定使用者擁有的前三個物件。 您可以使用 -Limit 作為 -Top的別名。

  • -UserId 參數指定使用者的 ID 為 UserPrincipalName 或 UserID。

參數

-All

列出所有頁面。

參數屬性

類型:System.Management.Automation.SwitchParameter
預設值:False
支援萬用字元:False
不要顯示:False

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Property

指定要回傳的屬性。

參數屬性

類型:

System.String[]

預設值:None
支援萬用字元:False
不要顯示:False
別名:選取

參數集

(All)
Position:Named
必要:False
來自管線的值:False
來自管線按屬性名稱的值:False
來自剩餘引數的值:False

-Top

指定回傳的最大紀錄數量。

參數屬性

類型:System.Int32
預設值:None
支援萬用字元:False
不要顯示:False
別名:極限

參數集

(All)
Position:Named
必要:False
來自管線的值:True
來自管線按屬性名稱的值:True
來自剩餘引數的值:False

-UserId

在 Microsoft Entra ID 中指定使用者的 ID(作為使用者主體名稱或使用者 ID)。

參數屬性

類型:System.String
預設值:None
支援萬用字元:False
不要顯示:False
別名:ObjectId (物件識別碼), UPN, Identity, 使用者主要名稱 (UserPrincipalName)

參數集

(All)
Position:Named
必要:True
來自管線的值:True
來自管線按屬性名稱的值:True
來自剩餘引數的值:False

CommonParameters

此 Cmdlet 支援一般參數:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 如需詳細資訊,請參閱 about_CommonParameters。