Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.20.0 release - Enrich examples to boost example quality KPI - Batch 2 (users) #1189

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,24 +37,36 @@ Get-EntraBetaUserAppRoleAssignment

The `Get-EntraBetaUserAppRoleAssignment` cmdlet gets a user application role assignment.

To perform this operation in delegated scenarios using work or school accounts, the signed-in user must have one of the following least privileged roles, or a custom role with the necessary permissions:

- Guest Inviter - Read app role assignments for users only
- Directory Readers
- Directory Synchronization Accounts - for Microsoft Entra Connect and Microsoft Entra Cloud Sync services
- Directory Writer
- Hybrid Identity Administrator
- Identity Governance Administrator
- Privileged Role Administrator
- User Administrator
- Application Administrator
- Cloud Application Administrator

## Examples

### Example 1: Get a user application role assignment

```powershell
Connect-Entra -Scopes 'AppRoleAssignment.ReadWrite.All','Directory.Read.All'
$UserId = (Get-EntraBetaUser -Top 1).ObjectId
Get-EntraBetaUserAppRoleAssignment -ObjectId $UserId
$user = Get-EntraBetaUser -UserId '[email protected]'
Get-EntraBetaUserAppRoleAssignment -ObjectId $user.Id
```

```Output
DeletedDateTime Id AppRoleId CreatedDateTime PrincipalDisplayName PrincipalId PrincipalType ResourceDisplayName
--------------- -- --------- --------------- -------------------- ----------- ------------- -------------------
0ekrQWAUYUCO7cyiA_A1bC2dE3fH4i 00001111-aaaa-2222-bbbb-3333cccc4444 31-07-2023 04:29:57 Avery Smith aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-1
0ekrQWAUYUCO7cyiA_C2dE3fH4iJ5k 11112222-bbbb-3333-cccc-4444dddd5555 12-07-2023 10:09:17 Avery Smith aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-2
0ekrQWAUYUCO7cyiA_H4iJ5kL6mN7o 22223333-cccc-4444-dddd-5555eeee6666 13-09-2023 16:41:53 Avery Smith aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-5
0ekrQWAUYUCO7cyiA_J5kL6mN7oP8q 33334444-dddd-5555-eeee-6666ffff7777 13-09-2023 17:28:17 Avery Smith aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-7

DeletedDateTime Id AppRoleId CreatedDateTime PrincipalDisplayName PrincipalId PrincipalType ResourceDisplayName
--------------- -- --------- --------------- -------------------- ----------- ------------- -------------------
0ekrQWAUYUCO7cyiA_A1bC2dE3fH4i 00001111-aaaa-2222-bbbb-3333cccc4444 31-07-2023 04:29:57 Sawyer Miller aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-1
0ekrQWAUYUCO7cyiA_C2dE3fH4iJ5k 11112222-bbbb-3333-cccc-4444dddd5555 12-07-2023 10:09:17 Sawyer Miller aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-2
0ekrQWAUYUCO7cyiA_H4iJ5kL6mN7o 22223333-cccc-4444-dddd-5555eeee6666 13-09-2023 16:41:53 Sawyer Miller aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-5
0ekrQWAUYUCO7cyiA_J5kL6mN7oP8q 33334444-dddd-5555-eeee-6666ffff7777 13-09-2023 17:28:17 Sawyer Miller aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-7
```

This example retrieves a user application role assignment for the user in $UserId. You can use the comand `Get-EntraBetaUser` to get Service principal Object ID.
Expand All @@ -65,16 +77,17 @@ This example retrieves a user application role assignment for the user in $UserI

```powershell
Connect-Entra -Scopes 'AppRoleAssignment.ReadWrite.All','Directory.Read.All'
Get-EntraBetaUserAppRoleAssignment -ObjectId 'aaaaaaaa-bbbb-cccc-1111-222222222222' -All
$user = Get-EntraBetaUser -UserId '[email protected]'
Get-EntraBetaUserAppRoleAssignment -ObjectId $user.Id -All
```

```Output
DeletedDateTime Id AppRoleId CreatedDateTime PrincipalDisplayName PrincipalId PrincipalType ResourceDisplayName
--------------- -- --------- --------------- -------------------- ----------- ------------- -------------------
0ekrQWAUYUCO7cyiA_A1bC2dE3fH4i 00001111-aaaa-2222-bbbb-3333cccc4444 31-07-2023 04:29:57 Avery Smith aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-1
0ekrQWAUYUCO7cyiA_C2dE3fH4iJ5k 11112222-bbbb-3333-cccc-4444dddd5555 12-07-2023 10:09:17 Avery Smith aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-2
0ekrQWAUYUCO7cyiA_H4iJ5kL6mN7o 22223333-cccc-4444-dddd-5555eeee6666 13-09-2023 16:41:53 Avery Smith aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-5
0ekrQWAUYUCO7cyiA_J5kL6mN7oP8q 33334444-dddd-5555-eeee-6666ffff7777 13-09-2023 17:28:17 Avery Smith aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-7
DeletedDateTime Id AppRoleId CreatedDateTime PrincipalDisplayName PrincipalId PrincipalType ResourceDisplayName
--------------- -- --------- --------------- -------------------- ----------- ------------- -------------------
0ekrQWAUYUCO7cyiA_A1bC2dE3fH4i 00001111-aaaa-2222-bbbb-3333cccc4444 31-07-2023 04:29:57 Sawyer Miller aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-1
0ekrQWAUYUCO7cyiA_C2dE3fH4iJ5k 11112222-bbbb-3333-cccc-4444dddd5555 12-07-2023 10:09:17 Sawyer Miller aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-2
0ekrQWAUYUCO7cyiA_H4iJ5kL6mN7o 22223333-cccc-4444-dddd-5555eeee6666 13-09-2023 16:41:53 Sawyer Miller aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-5
0ekrQWAUYUCO7cyiA_J5kL6mN7oP8q 33334444-dddd-5555-eeee-6666ffff7777 13-09-2023 17:28:17 Sawyer Miller aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-7
```

This example demonstrates how to retrieve all application role assignment for the specified user.
Expand All @@ -89,10 +102,10 @@ Get-EntraBetaUserAppRoleAssignment -ObjectId 'aaaaaaaa-bbbb-cccc-1111-2222222222
```

```Output
DeletedDateTime Id AppRoleId CreatedDateTime PrincipalDisplayName PrincipalId PrincipalType ResourceDisplayName
--------------- -- --------- --------------- -------------------- ----------- ------------- -------------------
0ekrQWAUYUCO7cyiA_A1bC2dE3fH4i 00001111-aaaa-2222-bbbb-3333cccc4444 31-07-2023 04:29:57 Avery Smith aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-1
0ekrQWAUYUCO7cyiA_C2dE3fH4iJ5k 11112222-bbbb-3333-cccc-4444dddd5555 12-07-2023 10:09:17 Avery Smith aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-2
DeletedDateTime Id AppRoleId CreatedDateTime PrincipalDisplayName PrincipalId PrincipalType ResourceDisplayName
--------------- -- --------- --------------- -------------------- ----------- ------------- -------------------
0ekrQWAUYUCO7cyiA_A1bC2dE3fH4i 00001111-aaaa-2222-bbbb-3333cccc4444 31-07-2023 04:29:57 Sawyer Miller aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-1
0ekrQWAUYUCO7cyiA_C2dE3fH4iJ5k 11112222-bbbb-3333-cccc-4444dddd5555 12-07-2023 10:09:17 Sawyer Miller aaaaaaaa-bbbb-cccc-1111-222222222222 User Test-App-2
```

This example demonstrates how to retrieve top two application role assignment for the specified user.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ The `Get-EntraBetaUserDirectReport` cmdlet gets the direct reports for a user in

```powershell
Connect-Entra -Scopes 'User.Read','User.Read.All'
Get-EntraBetaUserDirectReport -UserId '[email protected]'
Get-EntraBetaUserDirectReport -UserId '[email protected]' |
Select-Object Id, displayName, userPrincipalName, createdDateTime, accountEnabled, userType |
Format-Table -AutoSize
```

```Output
Id DeletedDateTime
-- ---------------
bbbbbbbb-1111-2222-3333-cccccccccccc
id displayName userPrincipalName createdDateTime accountEnabled userType
-- ----------- ----------------- --------------- -------------- --------
bbbbbbbb-1111-2222-3333-cccccccccccc Christie Cline [email protected] 10/7/2024 12:32:25 AM True Member
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Isaiah Langer [email protected] 10/7/2024 12:33:16 AM True Member
```

This example demonstrates how to retrieve direct reports for a user in Microsoft Entra ID.
Expand All @@ -60,14 +63,16 @@ This example demonstrates how to retrieve direct reports for a user in Microsoft

```powershell
Connect-Entra -Scopes 'User.Read','User.Read.All'
Get-EntraBetaUserDirectReport -UserId '[email protected]' -All
Get-EntraBetaUserDirectReport -UserId '[email protected]' -All |
Select-Object Id, displayName, userPrincipalName, createdDateTime, accountEnabled, userType |
Format-Table -AutoSize
```

```Output
Id DeletedDateTime
-- ---------------
bbbbbbbb-1111-2222-3333-cccccccccccc
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb
id displayName userPrincipalName createdDateTime accountEnabled userType
-- ----------- ----------------- --------------- -------------- --------
bbbbbbbb-1111-2222-3333-cccccccccccc Christie Cline [email protected] 10/7/2024 12:32:25 AM True Member
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Isaiah Langer [email protected] 10/7/2024 12:33:16 AM True Member
```

This example demonstrates how to retrieve all direct reports for a user in Microsoft Entra ID.
Expand All @@ -78,14 +83,16 @@ This example demonstrates how to retrieve all direct reports for a user in Micro

```powershell
Connect-Entra -Scopes 'User.Read','User.Read.All'
Get-EntraBetaUserDirectReport -UserId '[email protected]' -Top 2
Get-EntraBetaUserDirectReport -UserId '[email protected]' -Top 2 |
Select-Object Id, displayName, userPrincipalName, createdDateTime, accountEnabled, userType |
Format-Table -AutoSize
```

```Output
Id DeletedDateTime
-- ---------------
bbbbbbbb-1111-2222-3333-cccccccccccc
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb
id displayName userPrincipalName createdDateTime accountEnabled userType
-- ----------- ----------------- --------------- -------------- --------
bbbbbbbb-1111-2222-3333-cccccccccccc Christie Cline [email protected] 10/7/2024 12:32:25 AM True Member
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb Isaiah Langer [email protected] 10/7/2024 12:33:16 AM True Member
```

This example demonstrates how to retrieve top five direct reports for a user in Microsoft Entra ID.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ The `Get-EntraBetaUserExtension` cmdlet gets a user extension in Microsoft Entra

```powershell
Connect-Entra -Scopes 'User.Read'
$UserId = (Get-EntraBetaUser -ObjectId '[email protected]').ObjectId
Get-EntraBetaUserExtension -UserId $UserId
Get-EntraBetaUserExtension -UserId '[email protected]'
```

```Output
Expand All @@ -55,7 +54,7 @@ createdDateTime : 18/07/2024 05:13:40
userIdentities : {@{[email protected]; signInType=userPrincipalName; [email protected]}}
```

This example shows how to retrieve the extension attributes for a specified user. You can use the command `Get-EntraBetaUser` to get user object Id.
This example shows how to retrieve the extension attributes for a specified user.

- `-UserId` parameter specifies the user object Id.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ Get-EntraBetaUserLicenseDetail

This cmdlet retrieves license details for a user.

In delegated scenarios with work or school accounts, the signed-in user needs a supported Microsoft Entra role or a custom role with the `microsoft.directory/users/licenseDetails/read` permission. The following least privileged roles support this operation:

- Guest Inviter
- Directory Readers
- Directory Writers
- License Administrator
- User Administrator

## Examples

### Example 1: Retrieve user license details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,15 @@ The `Get-EntraBetaUserManager` cmdlet gets the manager of a user in Microsoft En

```powershell
Connect-Entra -Scopes 'User.Read.All'
Get-EntraBetaUserManager -UserId '[email protected]'
Get-EntraBetaUserManager -UserId '[email protected]' |
Select-Object Id, displayName, userPrincipalName, createdDateTime, accountEnabled, userType |
Format-Table -AutoSize
```

```Output
DeletedDateTime :
Id : 00aa00aa-bb11-cc22-dd33-44ee44ee44ee
@odata.context : https://graph.microsoft.com/beta/$metadata#directoryObjects/$entity
@odata.type : #microsoft.graph.user
accountEnabled : True
businessPhones : {+1 858 555 0109}
city : San Diego
createdDateTime : 2023-07-07T14:18:05Z
country : United States
department : Sales & Marketing
displayName : Sawyer Miller
id displayName userPrincipalName createdDateTime accountEnabled userType
-- ----------- ----------------- --------------- -------------- --------
00aa00aa-bb11-cc22-dd33-44ee44ee44ee Patti Fernandez [email protected] 10/7/2024 12:32:01 AM True Member
```

This example demonstrates how to retrieve the manager of a specific user.
Expand Down
Loading