From 9a068bdfa033bb293deb5bd53c663d7d32347feb Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Thu, 19 Sep 2024 13:28:00 +0000 Subject: [PATCH 01/17] Adding deletion age output. --- .../Get-EntraBetaDeletedApplication.md | 18 +++++++++++++++++ .../Get-EntraDeletedApplication.md | 20 ++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeletedApplication.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeletedApplication.md index 526bb9c51..845a5f156 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeletedApplication.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaDeletedApplication.md @@ -135,6 +135,24 @@ TestApp1 aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb bbbbbbbb-1111-2222-3333-ccccccc This cmdlet retrieves deleted applications having specified display name. +### Example 6: Get deleted applications with deletion age in days + +```powershell +Connect-Entra -Scopes 'Application.Read.All' +Get-EntraBetaDeletedApplication | + Select-Object DisplayName, Id, AppId, SignInAudience, PublisherDomain, DeletedDateTime, + @{Name='DeletionAgeInDays'; Expression={(Get-Date) - $_.DeletedDateTime | Select-Object -ExpandProperty Days}} | + Format-Table -AutoSize +``` + +```Output +DisplayName Id AppId SignInAudience PublisherDomain DeletedDateTime DeletionAgeInDays +----------- -- ----- -------------- --------------- --------------- ----------------- +Entra PowerShell App aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb bbbbbbbb-1111-2222-3333-cccccccccccc AzureADMyOrg contoso.com 9/18/2024 7:41:44 AM 1 +``` + +This cmdlet retrieves deleted applications with deletion age in days. + ## Parameters ### -All diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeletedApplication.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeletedApplication.md index c89144c78..74cdce0fb 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeletedApplication.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraDeletedApplication.md @@ -133,7 +133,25 @@ DisplayName Id AppId TestApp1 aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb bbbbbbbb-1111-2222-3333-cccccccccccc AzureADMyOrg contoso.com ``` -This cmdlet retrieves deleted applications having specified display name. +This cmdlet retrieves deleted applications having specified display name. + +### Example 6: Get deleted applications with deletion age in days + +```powershell +Connect-Entra -Scopes 'Application.Read.All' +Get-EntraDeletedApplication | + Select-Object DisplayName, Id, AppId, SignInAudience, PublisherDomain, DeletedDateTime, + @{Name='DeletionAgeInDays'; Expression={(Get-Date) - $_.DeletedDateTime | Select-Object -ExpandProperty Days}} | + Format-Table -AutoSize +``` + +```Output +DisplayName Id AppId SignInAudience PublisherDomain DeletedDateTime DeletionAgeInDays +----------- -- ----- -------------- --------------- --------------- ----------------- +Entra PowerShell App aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb bbbbbbbb-1111-2222-3333-cccccccccccc AzureADMyOrg contoso.com 9/18/2024 7:41:44 AM 1 +``` + +This cmdlet retrieves deleted applications with deletion age in days. ## Parameters From 5691abd69abd3ae36fcf7ad7f63489f54eb476aa Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:10:02 +0000 Subject: [PATCH 02/17] Added an example to Retrieve all users assigned a specific license --- .../Get-EntraBetaSubscribedSku.md | 24 +++++++++++++++++- .../Get-EntraSubscribedSku.md | 25 +++++++++++++++++-- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaSubscribedSku.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaSubscribedSku.md index e181b45d0..f4c0b9a6d 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaSubscribedSku.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaSubscribedSku.md @@ -82,7 +82,29 @@ This example demonstrates how to retrieve specified subscribed SKUs to Microsoft - `-ObjectId` parameter specifies the ID of the SKU (Stock Keeping Unit). -### Example 3: Get a list of users, their assigned licenses, and licensing source +### Example 3: Retrieve all users assigned a specific license + +```powershell +Connect-Entra -Scopes 'Organization.Read.All' +$sku = Get-EntraBetaSubscribedSku | Where-Object { $_.SkuPartNumber -eq 'DEVELOPERPACK_E5' } +$skuId = $sku.SkuId +$usersWithDeveloperPackE5 = Get-EntraBetaUser -All | Where-Object { + $_.AssignedLicenses -and ($_.AssignedLicenses.SkuId -contains $skuId) +} +$usersWithDeveloperPackE5 | Select-Object Id, DisplayName, UserPrincipalName, AccountEnabled, UserType | Format-Table -AutoSize +``` + +```Output +Id DisplayName UserPrincipalName AccountEnabled UserType +-- ----------- ----------------- -------------- -------- +cccccccc-2222-3333-4444-dddddddddddd Angel Brown AngelB@contoso.com True Member +dddddddd-3333-4444-5555-eeeeeeeeeeee Avery Smith AveryS@contoso.com True Member +eeeeeeee-4444-5555-6666-ffffffffffff Sawyer Miller SawyerM@contoso.com True Member +``` + +This example demonstrates how to retrieve all users assigned a specific license. + +### Example 4: Get a list of users, their assigned licenses, and licensing source ```powershell Connect-Entra -Scopes 'Organization.Read.All','User.Read.All','Group.Read.All' diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraSubscribedSku.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraSubscribedSku.md index 948ebb73f..98cc125dd 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraSubscribedSku.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraSubscribedSku.md @@ -2,7 +2,6 @@ title: Get-EntraSubscribedSku description: This article provides details on the Get-EntraSubscribedSku command. - ms.topic: reference ms.date: 06/26/2024 ms.author: eunicewaweru @@ -81,7 +80,29 @@ This example demonstrates how to retrieve specified subscribed SKUs to Microsoft - `-ObjectId` parameter specifies the ID of the SKU (Stock Keeping Unit). -### Example 3: Get a list of users, their assigned licenses, and licensing source +### Example 3: Retrieve all users assigned a specific license + +```powershell +Connect-Entra -Scopes 'Organization.Read.All' +$sku = Get-EntraSubscribedSku | Where-Object { $_.SkuPartNumber -eq 'DEVELOPERPACK_E5' } +$skuId = $sku.SkuId +$usersWithDeveloperPackE5 = Get-EntraUser -All | Where-Object { + $_.AssignedLicenses -and ($_.AssignedLicenses.SkuId -contains $skuId) +} +$usersWithDeveloperPackE5 | Select-Object Id, DisplayName, UserPrincipalName, AccountEnabled, UserType | Format-Table -AutoSize +``` + +```Output +Id DisplayName UserPrincipalName AccountEnabled UserType +-- ----------- ----------------- -------------- -------- +cccccccc-2222-3333-4444-dddddddddddd Angel Brown AngelB@contoso.com True Member +dddddddd-3333-4444-5555-eeeeeeeeeeee Avery Smith AveryS@contoso.com True Member +eeeeeeee-4444-5555-6666-ffffffffffff Sawyer Miller SawyerM@contoso.com True Member +``` + +This example demonstrates how to retrieve all users assigned a specific license. + +### Example 4: Get a list of users, their assigned licenses, and licensing source ```powershell Connect-Entra -Scopes 'Organization.Read.All','User.Read.All','Group.Read.All' From 8a629cb0afb0bd187d241f921a480375a49e3716 Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:31:50 +0000 Subject: [PATCH 03/17] Added an example to retrieve users based in a country. --- .../Get-EntraBetaUser.md | 16 ++++++++++++++++ .../Microsoft.Graph.Entra/Get-EntraUser.md | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md index 60bdfec49..f087e53de 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md @@ -175,6 +175,22 @@ New User cccccccc-2222-3333-4444-dddddddddddd NewUser@tenant.com This example demonstrates how to retrieve all users with disabled accounts. +### Example 8: List users based in India + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$usersInIndia = Get-EntraUser -Filter "Country eq 'India'" +$usersInIndia | Select-Object Id, DisplayName, UserPrincipalName, OfficeLocation, Country | Format-Table -AutoSize +``` + +```Output +Id DisplayName UserPrincipalName OfficeLocation Country +-- ----------- ----------------- -------------- ------- +cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com 23/2102 India +``` + +This example demonstrates how to retrieve all users based in India. + ## Parameters ### -All diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md index 10e5f3a7d..4c3422a1b 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md @@ -174,6 +174,22 @@ New User cccccccc-2222-3333-4444-dddddddddddd NewUser@tenant.com This example demonstrates how to retrieve all users with disabled accounts. +### Example 8: List users based in India + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$usersInIndia = Get-EntraUser -Filter "Country eq 'India'" +$usersInIndia | Select-Object Id, DisplayName, UserPrincipalName, OfficeLocation, Country | Format-Table -AutoSize +``` + +```Output +Id DisplayName UserPrincipalName OfficeLocation Country +-- ----------- ----------------- -------------- ------- +cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com 23/2102 India +``` + +This example demonstrates how to retrieve all users based in India. + ## Parameters ### -All From e618b7a36eeb627692f23c69863f418fab1fef63 Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Fri, 20 Sep 2024 16:00:51 +0000 Subject: [PATCH 04/17] Added an example for user count per department --- .../Get-EntraBetaUser.md | 28 +++++++++++++++++++ .../Microsoft.Graph.Entra/Get-EntraUser.md | 28 +++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md index f087e53de..133f73bc2 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md @@ -191,6 +191,34 @@ cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com 23/ This example demonstrates how to retrieve all users based in India. +### Example 9: List user count per department + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$departmentCounts = Get-EntraBetaUser -All | Group-Object -Property Department | Select-Object Name, @{Name="MemberCount"; Expression={$_.Count}} +$departmentCounts | Format-Table Name, MemberCount -AutoSize +``` + +```Output +Name MemberCount +---- ----------- + 7 +Engineering 2 +Executive Management 1 +Finance 1 +HR 1 +Legal 1 +Manufacturing 1 +Marketing 2 +Operations 1 +R&D 2 +Retail 2 +Sales 1 +Sales & Marketing 1 +``` + +This example demonstrates how to retrieve user count in each department. + ## Parameters ### -All diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md index 4c3422a1b..30dbc79ac 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md @@ -190,6 +190,34 @@ cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com 23/ This example demonstrates how to retrieve all users based in India. +### Example 9: List user count per department + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$departmentCounts = Get-EntraUser -All | Group-Object -Property Department | Select-Object Name, @{Name="MemberCount"; Expression={$_.Count}} +$departmentCounts | Format-Table Name, MemberCount -AutoSize +``` + +```Output +Name MemberCount +---- ----------- + 7 +Engineering 2 +Executive Management 1 +Finance 1 +HR 1 +Legal 1 +Manufacturing 1 +Marketing 2 +Operations 1 +R&D 2 +Retail 2 +Sales 1 +Sales & Marketing 1 +``` + +This example demonstrates how to retrieve user count in each department. + ## Parameters ### -All From a6acce1754cd00418afa9269289fccf82bd3f33f Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Fri, 20 Sep 2024 16:28:20 +0000 Subject: [PATCH 05/17] Added an example to retrieve disabled users with active licenses. --- .../Get-EntraBetaUser.md | 18 ++++++++++++++++++ .../Microsoft.Graph.Entra/Get-EntraUser.md | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md index 133f73bc2..c3dcfc7f0 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md @@ -219,6 +219,24 @@ Sales & Marketing 1 This example demonstrates how to retrieve user count in each department. +### Example 10: List disabled users with active licenses + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$disabledUsersWithLicenses = Get-EntraBetaUser -Filter "accountEnabled eq false" -All | Where-Object { + $_.AssignedLicenses -ne $null -and $_.AssignedLicenses.Count -gt 0 +} +$disabledUsersWithLicenses | Select-Object Id, DisplayName, UserPrincipalName, AccountEnabled | Format-Table -AutoSize +``` + +```Output +Id DisplayName UserPrincipalName AccountEnabled +-- ----------- ----------------- -------------- +cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com False +``` + +This example demonstrates how to retrieve disabled users with active licenses. + ## Parameters ### -All diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md index 30dbc79ac..a574227ec 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md @@ -218,6 +218,24 @@ Sales & Marketing 1 This example demonstrates how to retrieve user count in each department. +### Example 10: List disabled users with active licenses + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$disabledUsersWithLicenses = Get-EntraUser -Filter "accountEnabled eq false" -All | Where-Object { + $_.AssignedLicenses -ne $null -and $_.AssignedLicenses.Count -gt 0 +} +$disabledUsersWithLicenses | Select-Object Id, DisplayName, UserPrincipalName, AccountEnabled | Format-Table -AutoSize +``` + +```Output +Id DisplayName UserPrincipalName AccountEnabled +-- ----------- ----------------- -------------- +cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com False +``` + +This example demonstrates how to retrieve disabled users with active licenses. + ## Parameters ### -All From c70db5318f6292f5b379ea880e3e54d28228a3e8 Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Sat, 21 Sep 2024 16:55:14 +0000 Subject: [PATCH 06/17] Added an example to retrieve guest users with active licenses. --- .../Get-EntraBetaUser.md | 26 +++++++++++++++++++ .../Microsoft.Graph.Entra/Get-EntraUser.md | 26 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md index c3dcfc7f0..c9af1ed26 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md @@ -237,6 +237,32 @@ cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com F This example demonstrates how to retrieve disabled users with active licenses. +### Example 11: Retrieve guest users with active licenses + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$guestUsers = Get-EntraBetaUser -Filter "userType eq 'Guest'" -All +$guestUsersWithLicenses = foreach ($guest in $guestUsers) { + if ($guest.AssignedLicenses.Count -gt 0) { + [pscustomobject]@{ + Id = $guest.Id + DisplayName = $guest.DisplayName + UserPrincipalName = $guest.UserPrincipalName + AssignedLicenses = ($guest.AssignedLicenses | ForEach-Object { $_.SkuId }) -join ", " + } + } +} +$guestUsersWithLicenses | Format-Table Id, DisplayName, UserPrincipalName, AssignedLicenses -AutoSize +``` + +```Output +Id DisplayName UserPrincipalName AssignedLicenses +-- ----------- ----------------- ---------------- +cccccccc-2222-3333-4444-dddddddddddd Sawyer Miller sawyerm_gmail.com#EXT#@contoso.com c42b9cae-ea4f-4ab7-9717-81576235ccac +``` + +This example demonstrates how to retrieve guest users with active licenses. + ## Parameters ### -All diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md index a574227ec..b1ee57cea 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md @@ -236,6 +236,32 @@ cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com F This example demonstrates how to retrieve disabled users with active licenses. +### Example 11: Retrieve guest users with active licenses + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$guestUsers = Get-EntraUser -Filter "userType eq 'Guest'" -All +$guestUsersWithLicenses = foreach ($guest in $guestUsers) { + if ($guest.AssignedLicenses.Count -gt 0) { + [pscustomobject]@{ + Id = $guest.Id + DisplayName = $guest.DisplayName + UserPrincipalName = $guest.UserPrincipalName + AssignedLicenses = ($guest.AssignedLicenses | ForEach-Object { $_.SkuId }) -join ", " + } + } +} +$guestUsersWithLicenses | Format-Table Id, DisplayName, UserPrincipalName, AssignedLicenses -AutoSize +``` + +```Output +Id DisplayName UserPrincipalName AssignedLicenses +-- ----------- ----------------- ---------------- +cccccccc-2222-3333-4444-dddddddddddd Sawyer Miller sawyerm_gmail.com#EXT#@contoso.com c42b9cae-ea4f-4ab7-9717-81576235ccac +``` + +This example demonstrates how to retrieve guest users with active licenses. + ## Parameters ### -All From 90ac7ebf88070bc8753d6481d3f3d162e5a2c759 Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Sat, 21 Sep 2024 17:21:31 +0000 Subject: [PATCH 07/17] Added an example to retrieve users without managers --- .../Get-EntraBetaUser.md | 27 +++++++++++++++++++ .../Microsoft.Graph.Entra/Get-EntraUser.md | 27 +++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md index c9af1ed26..7cfcac6da 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md @@ -263,6 +263,33 @@ cccccccc-2222-3333-4444-dddddddddddd Sawyer Miller sawyerm_gmail.com#EXT#@contos This example demonstrates how to retrieve guest users with active licenses. +### Example 12: Retrieve users without managers + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$allUsers = Get-EntraBetaUser -All +$usersWithoutManagers = foreach ($user in $allUsers) { + $manager = Get-EntraBetaUserManager -ObjectId $user.Id -ErrorAction SilentlyContinue + if (-not $manager) { + [pscustomobject]@{ + Id = $user.Id + DisplayName = $user.DisplayName + UserPrincipalName = $user.UserPrincipalName + } + } +} +$usersWithoutManagers | Format-Table Id, DisplayName, UserPrincipalName -AutoSize +``` + +```Output +Id DisplayName UserPrincipalName +-- ----------- ----------------- +cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com +bbbbbbbb-1111-2222-3333-cccccccccccc Sawyer Miller SawyerM@contoso.com +``` + +This example demonstrates how to retrieve users without managers. + ## Parameters ### -All diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md index b1ee57cea..161ec8a02 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md @@ -262,6 +262,33 @@ cccccccc-2222-3333-4444-dddddddddddd Sawyer Miller sawyerm_gmail.com#EXT#@contos This example demonstrates how to retrieve guest users with active licenses. +### Example 12: Retrieve users without managers + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$allUsers = Get-EntraUser -All +$usersWithoutManagers = foreach ($user in $allUsers) { + $manager = Get-EntraUserManager -ObjectId $user.Id -ErrorAction SilentlyContinue + if (-not $manager) { + [pscustomobject]@{ + Id = $user.Id + DisplayName = $user.DisplayName + UserPrincipalName = $user.UserPrincipalName + } + } +} +$usersWithoutManagers | Format-Table Id, DisplayName, UserPrincipalName -AutoSize +``` + +```Output +Id DisplayName UserPrincipalName +-- ----------- ----------------- +cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com +bbbbbbbb-1111-2222-3333-cccccccccccc Sawyer Miller SawyerM@contoso.com +``` + +This example demonstrates how to retrieve users without managers. + ## Parameters ### -All From 31a08589f3ef3da3a2d3c076de4c9376eb5b1e94 Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Sat, 21 Sep 2024 17:23:53 +0000 Subject: [PATCH 08/17] Added example to list users without managers --- .../Get-EntraBetaUserManager.md | 27 +++++++++++++++++++ .../Get-EntraUserManager.md | 27 +++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserManager.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserManager.md index a7b9cfe0d..09c4f63db 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserManager.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserManager.md @@ -64,6 +64,33 @@ This example demonstrates how to retrieve the manager of a specific user. - `-ObjectId` Parameter specifies ObjectID or User Principal Name of User. +### Example 2: Retrieve users without managers + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$allUsers = Get-EntraBetaUser -All +$usersWithoutManagers = foreach ($user in $allUsers) { + $manager = Get-EntraBetaUserManager -ObjectId $user.Id -ErrorAction SilentlyContinue + if (-not $manager) { + [pscustomobject]@{ + Id = $user.Id + DisplayName = $user.DisplayName + UserPrincipalName = $user.UserPrincipalName + } + } +} +$usersWithoutManagers | Format-Table Id, DisplayName, UserPrincipalName -AutoSize +``` + +```Output +Id DisplayName UserPrincipalName +-- ----------- ----------------- +cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com +bbbbbbbb-1111-2222-3333-cccccccccccc Sawyer Miller SawyerM@contoso.com +``` + +This example demonstrates how to retrieve users without managers. + ## Parameters ### -ObjectId diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserManager.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserManager.md index 522c0b4df..660358aa1 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserManager.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserManager.md @@ -64,6 +64,33 @@ This example demonstrates how to retrieve the manager of a specific user. - `-ObjectId` Parameter specifies ObjectID or User Principal Name of User. +### Example 2: Retrieve users without managers + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$allUsers = Get-EntraUser -All +$usersWithoutManagers = foreach ($user in $allUsers) { + $manager = Get-EntraUserManager -ObjectId $user.Id -ErrorAction SilentlyContinue + if (-not $manager) { + [pscustomobject]@{ + Id = $user.Id + DisplayName = $user.DisplayName + UserPrincipalName = $user.UserPrincipalName + } + } +} +$usersWithoutManagers | Format-Table Id, DisplayName, UserPrincipalName -AutoSize +``` + +```Output +Id DisplayName UserPrincipalName +-- ----------- ----------------- +cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com +bbbbbbbb-1111-2222-3333-cccccccccccc Sawyer Miller SawyerM@contoso.com +``` + +This example demonstrates how to retrieve users without managers. + ## Parameters ### -ObjectId From bbe478010e2321cbc83203fef7e5725647c1b6e3 Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Sat, 21 Sep 2024 17:59:21 +0000 Subject: [PATCH 09/17] Added an example to List groups that a user is a member of --- .../Get-EntraBetaUserMembership.md | 16 ++++++++++++++++ .../Get-EntraUserMembership.md | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserMembership.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserMembership.md index 83cd1682f..5f39f434f 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserMembership.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUserMembership.md @@ -123,6 +123,22 @@ Id DeletedDateTime This example demonstrates how to retrieve users top three memberships in Microsoft Entra ID. +### Example 5: List groups that Sawyer Miller is a member of + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$groups = Get-EntraBetaUserMembership -ObjectId 'SawyerM@contoso.com' +$groups | Select-Object DisplayName, Id, GroupTypes, Visibility | Format-Table -AutoSize +``` + +```Output +DisplayName Id GroupTypes Visibility +----------- -- ---------- ---------- +Contoso Group bbbbbbbb-1111-2222-3333-cccccccccccc {Unified} Public +``` + +This example demonstrates how to retrieve the groups that a user is a member of. + ## Parameters ### -All diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserMembership.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserMembership.md index 641f56f67..49a7811e2 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserMembership.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUserMembership.md @@ -123,6 +123,22 @@ Id DeletedDateTime This example demonstrates how to retrieve users top three memberships in Microsoft Entra ID. +### Example 5: List groups that Sawyer Miller is a member of + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$groups = Get-EntraUserMembership -ObjectId 'SawyerM@contoso.com' +$groups | Select-Object DisplayName, Id, GroupTypes, Visibility | Format-Table -AutoSize +``` + +```Output +DisplayName Id GroupTypes Visibility +----------- -- ---------- ---------- +Contoso Group bbbbbbbb-1111-2222-3333-cccccccccccc {Unified} Public +``` + +This example demonstrates how to retrieve the groups that a user is a member of. + ## Parameters ### -All From 11ac0b524d40c3fd7eee3042dbd04f5b773faa4b Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Sat, 21 Sep 2024 18:25:56 +0000 Subject: [PATCH 10/17] Added an example to List failed sign-ins for a user --- .../Get-EntraBetaAuditSignInLog.md | 10 ++++++++++ .../Get-EntraBetaUser.md | 18 ++++++++++-------- .../Get-EntraAuditSignInLog.md | 10 ++++++++++ .../Microsoft.Graph.Entra/Get-EntraUser.md | 18 ++++++++++-------- 4 files changed, 40 insertions(+), 16 deletions(-) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAuditSignInLog.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAuditSignInLog.md index 74b487d58..173005657 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAuditSignInLog.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaAuditSignInLog.md @@ -105,6 +105,16 @@ Get-EntraBetaAuditSignInLog -Filter "createdDateTime ge 2024-07-01T00:00:00Z and This example shows how to retrieve sign-in logs between dates. +### Example 5: List failed sign-ins for a user + +```powershell +Connect-Entra -Scopes 'AuditLog.Read.All','Directory.Read.All' +$failedSignIns = Get-EntraBetaAuditSignInLog -Filter "userPrincipalName eq 'SawyerM@contoso.com' and status/errorCode ne 0" +$failedSignIns | Select-Object UserPrincipalName, CreatedDateTime, Status, IpAddress, ClientAppUsed | Format-Table -AutoSize +``` + +This example demonstrates how to retrieve failed sign-ins for a user. + ## Parameters ### -All diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md index 7cfcac6da..c65b4a07d 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md @@ -207,14 +207,6 @@ Engineering 2 Executive Management 1 Finance 1 HR 1 -Legal 1 -Manufacturing 1 -Marketing 2 -Operations 1 -R&D 2 -Retail 2 -Sales 1 -Sales & Marketing 1 ``` This example demonstrates how to retrieve user count in each department. @@ -290,6 +282,16 @@ bbbbbbbb-1111-2222-3333-cccccccccccc Sawyer Miller SawyerM@contoso.com This example demonstrates how to retrieve users without managers. +### Example 13: List failed sign-ins for a user + +```powershell +Connect-Entra -Scopes 'AuditLog.Read.All','Directory.Read.All' +$failedSignIns = Get-EntraBetaAuditSignInLog -Filter "userPrincipalName eq 'SawyerM@contoso.com' and status/errorCode ne 0" +$failedSignIns | Select-Object UserPrincipalName, CreatedDateTime, Status, IpAddress, ClientAppUsed | Format-Table -AutoSize +``` + +This example demonstrates how to retrieve failed sign-ins for a user. + ## Parameters ### -All diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAuditSignInLog.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAuditSignInLog.md index d56ec818a..409b8604e 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAuditSignInLog.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraAuditSignInLog.md @@ -104,6 +104,16 @@ Get-EntraAuditSignInLog -Filter "createdDateTime ge 2024-07-01T00:00:00Z and cre This example shows how to retrieve sign-in logs between dates. +### Example 5: List failed sign-ins for a user + +```powershell +Connect-Entra -Scopes 'AuditLog.Read.All','Directory.Read.All' +$failedSignIns = Get-EntraAuditSignInLog -Filter "userPrincipalName eq 'SawyerM@contoso.com' and status/errorCode ne 0" +$failedSignIns | Select-Object UserPrincipalName, CreatedDateTime, Status, IpAddress, ClientAppUsed | Format-Table -AutoSize +``` + +This example demonstrates how to retrieve failed sign-ins for a user. + ## Parameters ### -All diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md index 161ec8a02..ebb24b870 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md @@ -206,14 +206,6 @@ Engineering 2 Executive Management 1 Finance 1 HR 1 -Legal 1 -Manufacturing 1 -Marketing 2 -Operations 1 -R&D 2 -Retail 2 -Sales 1 -Sales & Marketing 1 ``` This example demonstrates how to retrieve user count in each department. @@ -289,6 +281,16 @@ bbbbbbbb-1111-2222-3333-cccccccccccc Sawyer Miller SawyerM@contoso.com This example demonstrates how to retrieve users without managers. +### Example 13: List failed sign-ins for a user + +```powershell +Connect-Entra -Scopes 'AuditLog.Read.All','Directory.Read.All' +$failedSignIns = Get-EntraAuditSignInLog -Filter "userPrincipalName eq 'SawyerM@contoso.com' and status/errorCode ne 0" +$failedSignIns | Select-Object UserPrincipalName, CreatedDateTime, Status, IpAddress, ClientAppUsed | Format-Table -AutoSize +``` + +This example demonstrates how to retrieve failed sign-ins for a user. + ## Parameters ### -All From 6067871adedaa66744c2dc56e0aab727eb0cef73 Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Sat, 21 Sep 2024 18:40:08 +0000 Subject: [PATCH 11/17] Add example to List all guest users --- .../Get-EntraBetaUser.md | 16 ++++++++++++++++ .../Microsoft.Graph.Entra/Get-EntraUser.md | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md index c65b4a07d..a87976217 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md @@ -292,6 +292,22 @@ $failedSignIns | Select-Object UserPrincipalName, CreatedDateTime, Status, IpAdd This example demonstrates how to retrieve failed sign-ins for a user. +### Example 14: List all guest users + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$guestUsers = Get-EntraBetaUser -Filter "userType eq 'Guest'" -All +$guestUsers | Select-Object DisplayName, UserPrincipalName, Id, createdDateTime, creationType, accountEnabled, UserState | Format-Table -AutoSize +``` + +```Output +DisplayName UserPrincipalName Id CreatedDateTime CreationType AccountEnabled UserState +----------- ----------------- -- --------------- ------------ -------------- --------- +Sawyer Miller sawyerm_gmail.com#EXT#@contoso.com bbbbbbbb-1111-2222-3333-cccccccccccc 9/13/2024 6:37:33 PM Invitation True Accepted +``` + +This example demonstrates how to retrieve list all guest users. + ## Parameters ### -All diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md index ebb24b870..f179203f4 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md @@ -291,6 +291,22 @@ $failedSignIns | Select-Object UserPrincipalName, CreatedDateTime, Status, IpAdd This example demonstrates how to retrieve failed sign-ins for a user. +### Example 14: List all guest users + +```powershell +Connect-Entra -Scopes 'User.Read.All' +$guestUsers = Get-EntraUser -Filter "userType eq 'Guest'" -All +$guestUsers | Select-Object DisplayName, UserPrincipalName, Id, createdDateTime, creationType, accountEnabled, UserState | Format-Table -AutoSize +``` + +```Output +DisplayName UserPrincipalName Id CreatedDateTime CreationType AccountEnabled UserState +----------- ----------------- -- --------------- ------------ -------------- --------- +Sawyer Miller sawyerm_gmail.com#EXT#@contoso.com bbbbbbbb-1111-2222-3333-cccccccccccc 9/13/2024 6:37:33 PM Invitation True Accepted +``` + +This example demonstrates how to retrieve list all guest users. + ## Parameters ### -All From d42f5fe2d6dac75b3e2875db11c4f495041d4b0b Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:39:57 +0000 Subject: [PATCH 12/17] Fixing Beta command for listing users based in a country. --- .../Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md index a87976217..87fe8b02f 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md @@ -179,7 +179,7 @@ This example demonstrates how to retrieve all users with disabled accounts. ```powershell Connect-Entra -Scopes 'User.Read.All' -$usersInIndia = Get-EntraUser -Filter "Country eq 'India'" +$usersInIndia = Get-EntraBetaUser -Filter "Country eq 'India'" $usersInIndia | Select-Object Id, DisplayName, UserPrincipalName, OfficeLocation, Country | Format-Table -AutoSize ``` From dd362aa4207b0995d15687c4a102d1c4919dc5ff Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Sun, 22 Sep 2024 17:42:11 +0000 Subject: [PATCH 13/17] Minor edits to users in a specific country example. --- .../Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md | 10 +++++----- .../Microsoft.Graph.Entra/Get-EntraUser.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md index 87fe8b02f..fa2640f96 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaUser.md @@ -175,21 +175,21 @@ New User cccccccc-2222-3333-4444-dddddddddddd NewUser@tenant.com This example demonstrates how to retrieve all users with disabled accounts. -### Example 8: List users based in India +### Example 8: List users based in a specific country ```powershell Connect-Entra -Scopes 'User.Read.All' -$usersInIndia = Get-EntraBetaUser -Filter "Country eq 'India'" -$usersInIndia | Select-Object Id, DisplayName, UserPrincipalName, OfficeLocation, Country | Format-Table -AutoSize +$usersInCanada = Get-EntraBetaUser -Filter "Country eq 'Canada'" +$usersInCanada | Select-Object Id, DisplayName, UserPrincipalName, OfficeLocation, Country | Format-Table -AutoSize ``` ```Output Id DisplayName UserPrincipalName OfficeLocation Country -- ----------- ----------------- -------------- ------- -cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com 23/2102 India +cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com 23/2102 Canada ``` -This example demonstrates how to retrieve all users based in India. +This example demonstrates how to retrieve all users based in Canada. ### Example 9: List user count per department diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md index f179203f4..443eb9ec2 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraUser.md @@ -174,21 +174,21 @@ New User cccccccc-2222-3333-4444-dddddddddddd NewUser@tenant.com This example demonstrates how to retrieve all users with disabled accounts. -### Example 8: List users based in India +### Example 8: List users based in a specific country ```powershell Connect-Entra -Scopes 'User.Read.All' -$usersInIndia = Get-EntraUser -Filter "Country eq 'India'" -$usersInIndia | Select-Object Id, DisplayName, UserPrincipalName, OfficeLocation, Country | Format-Table -AutoSize +$usersInCanada = Get-EntraUser -Filter "Country eq 'Canada'" +$usersInCanada | Select-Object Id, DisplayName, UserPrincipalName, OfficeLocation, Country | Format-Table -AutoSize ``` ```Output Id DisplayName UserPrincipalName OfficeLocation Country -- ----------- ----------------- -------------- ------- -cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com 23/2102 India +cccccccc-2222-3333-4444-dddddddddddd New User NewUser@tenant.com 23/2102 Canada ``` -This example demonstrates how to retrieve all users based in India. +This example demonstrates how to retrieve all users based in Canada. ### Example 9: List user count per department From 7266cd8f360013fa7e53d74fa876d50e13700632 Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Mon, 30 Sep 2024 08:51:05 +0000 Subject: [PATCH 14/17] Adding an example to list apps without user assignment enabled --- .../Get-EntraBetaServicePrincipal.md | 15 +++++++++++++++ .../Get-EntraServicePrincipal.md | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md index 558ad2c2d..7b072dfad 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md @@ -220,6 +220,21 @@ Global secure access app 00001111-aaaa-2222-bbbb-3333cccc4444 33334444-dddd- This example demonstrates how to retrieve all Global secure access apps. +### Example 11: List all applications without user assignment + +```powershell +Connect-Entra -Scopes 'Application.Read.All' +Get-EntraBetaServicePrincipal -All | Where-Object {$_.appRoleAssignmentRequired -ne 'true'} +``` + +```Output +DisplayName Id AppId SignInAudience ServicePrincipalType +----------- -- ----- -------------- -------------------- +App without user assignment 00001111-aaaa-2222-bbbb-3333cccc4444 33334444-dddd-5555-eeee-6666ffff7777 Application +``` + +This example demonstrates how to retrieve all applications without user assignment. + ## Parameters ### -All diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md index 40465f020..a97140f9f 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md @@ -220,6 +220,21 @@ Global secure access app 00001111-aaaa-2222-bbbb-3333cccc4444 33334444-dddd- This example demonstrates how to retrieve all Global secure access apps. +### Example 11: List all applications without user assignment + +```powershell +Connect-Entra -Scopes 'Application.Read.All' +Get-EntraServicePrincipal -All | Where-Object {$_.appRoleAssignmentRequired -ne 'true'} +``` + +```Output +DisplayName Id AppId SignInAudience ServicePrincipalType +----------- -- ----- -------------- -------------------- +App without user assignment 00001111-aaaa-2222-bbbb-3333cccc4444 33334444-dddd-5555-eeee-6666ffff7777 Application +``` + +This example demonstrates how to retrieve all applications without user assignment. + ## Parameters ### -All From 915da807b1a237085a14af05661e1b1816d3ba2f Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Tue, 1 Oct 2024 19:35:34 +0000 Subject: [PATCH 15/17] Add SAML based applications example --- .../Get-EntraBetaServicePrincipal.md | 16 ++++++++++++++++ .../Get-EntraServicePrincipal.md | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md index 7b072dfad..cd5efeca2 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md @@ -235,6 +235,22 @@ App without user assignment 00001111-aaaa-2222-bbbb-3333cccc4444 33334444-dd This example demonstrates how to retrieve all applications without user assignment. +### Example 12: List all SAML application details + +```powershell +Connect-Entra -Scopes 'Application.Read.All' +$servicePrincipal = Get-EntraServicePrincipal -Filter "PreferredSingleSignOnMode eq 'saml'" +$servicePrincipal | Select-Object Id, DisplayName, AccountEnabled, AppId, PreferredSingleSignOnMode, AppRoleAssignmentRequired, SignInAudience, NotificationEmailAddresses, PreferredTokenSigningKeyEndDateTime, PreferredTokenSigningKeyValid, ReplyUrls,LoginUrl, LogoutUrl | Format-Table -AutoSize +``` + +```Output +Id DisplayName AccountEnabled AppId PreferredSingleSignOnMode AppRoleAssignmentRequired SignInAudience NotificationEmailAddresses +-- ----------- -------------- ----- ------------------------- ------------------------- -------------- -------------- +00001111-aaaa-2222-bbbb-3333cccc4444 SAML App True 33334444-dddd-5555-eeee-6666ffff7777 saml True AzureADMyOrg {admin@Contos} +``` + +This example demonstrates how to retrieve all SAML application details. + ## Parameters ### -All diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md index a97140f9f..2a7adc992 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md @@ -235,6 +235,22 @@ App without user assignment 00001111-aaaa-2222-bbbb-3333cccc4444 33334444-dd This example demonstrates how to retrieve all applications without user assignment. +### Example 12: List all SAML application details + +```powershell +Connect-Entra -Scopes 'Application.Read.All' +$servicePrincipal = Get-EntraServicePrincipal -Filter "PreferredSingleSignOnMode eq 'saml'" +$servicePrincipal | Select-Object Id, DisplayName, AccountEnabled, AppId, PreferredSingleSignOnMode, AppRoleAssignmentRequired, SignInAudience, NotificationEmailAddresses, PreferredTokenSigningKeyEndDateTime, PreferredTokenSigningKeyValid, ReplyUrls,LoginUrl, LogoutUrl | Format-Table -AutoSize +``` + +```Output +Id DisplayName AccountEnabled AppId PreferredSingleSignOnMode AppRoleAssignmentRequired SignInAudience NotificationEmailAddresses +-- ----------- -------------- ----- ------------------------- ------------------------- -------------- -------------- +00001111-aaaa-2222-bbbb-3333cccc4444 SAML App True 33334444-dddd-5555-eeee-6666ffff7777 saml True AzureADMyOrg {admin@Contos} +``` + +This example demonstrates how to retrieve all SAML application details. + ## Parameters ### -All From c9c7721ecb35f1796b9156709cef1733045de43a Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:09:53 +0300 Subject: [PATCH 16/17] Update module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md Co-authored-by: Kennedy Kang'ethe --- .../Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md index cd5efeca2..9baf1c6c0 100644 --- a/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md +++ b/module/docs/entra-powershell-beta/Microsoft.Graph.Entra.Beta/Get-EntraBetaServicePrincipal.md @@ -246,7 +246,7 @@ $servicePrincipal | Select-Object Id, DisplayName, AccountEnabled, AppId, Prefer ```Output Id DisplayName AccountEnabled AppId PreferredSingleSignOnMode AppRoleAssignmentRequired SignInAudience NotificationEmailAddresses -- ----------- -------------- ----- ------------------------- ------------------------- -------------- -------------- -00001111-aaaa-2222-bbbb-3333cccc4444 SAML App True 33334444-dddd-5555-eeee-6666ffff7777 saml True AzureADMyOrg {admin@Contos} +00001111-aaaa-2222-bbbb-3333cccc4444 SAML App True 33334444-dddd-5555-eeee-6666ffff7777 saml True AzureADMyOrg {admin@Contoso} ``` This example demonstrates how to retrieve all SAML application details. From c07debb920b572b031e4aa432f7c5bfbe17ed72b Mon Sep 17 00:00:00 2001 From: Steve Mutungi <132555836+SteveMutungi254@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:10:06 +0300 Subject: [PATCH 17/17] Update module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md Co-authored-by: Kennedy Kang'ethe --- .../Microsoft.Graph.Entra/Get-EntraServicePrincipal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md index 2a7adc992..9a82a3802 100644 --- a/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md +++ b/module/docs/entra-powershell-v1.0/Microsoft.Graph.Entra/Get-EntraServicePrincipal.md @@ -246,7 +246,7 @@ $servicePrincipal | Select-Object Id, DisplayName, AccountEnabled, AppId, Prefer ```Output Id DisplayName AccountEnabled AppId PreferredSingleSignOnMode AppRoleAssignmentRequired SignInAudience NotificationEmailAddresses -- ----------- -------------- ----- ------------------------- ------------------------- -------------- -------------- -00001111-aaaa-2222-bbbb-3333cccc4444 SAML App True 33334444-dddd-5555-eeee-6666ffff7777 saml True AzureADMyOrg {admin@Contos} +00001111-aaaa-2222-bbbb-3333cccc4444 SAML App True 33334444-dddd-5555-eeee-6666ffff7777 saml True AzureADMyOrg {admin@Contoso} ``` This example demonstrates how to retrieve all SAML application details.