Skip to content

Conversation

DButoyez
Copy link
Collaborator

@DButoyez DButoyez commented Apr 11, 2025

Description
This is a small POC PR which introduces using .psmx1 formating file to improve console display for our commands. It defines a table view by default, that shows the most common user properties (Display Name, ID, and Description) when working with User objects returned by "Microsoft.EntraBeta.Users" commands.

Changes

Added Users.format.ps1xml with table view definition
Modified relevant functions to apply custom type name to returned objects

Testing

Verified format is applied correctly to objects from Get-EntraBetaUser, Get-EntraBetaUserSponsor command
Tested in PowerShell 5.1 and PowerShell 7.3
Confirmed format works in both console and ISE

Implementation Details
The format file uses a custom type name approach with:

EntraBeta.Users type applied to user objects

Formatting Strategy Approach.

Group related Objects with similar properties.

For example, under the ‘Microsoft.Entra.Beta.Users’ module, different commands such as Get-EntraBetaUser, Get-EntraBetaUserSponsor, Get-EntraBetaDeletedUser return different objects which share similar properties like Id, Name, Description. We can group these related objects by inserting a similar custom type name to each of the command response, For example:

$object.PSTypeNames.Insert(0, "EntraBeta.UserSponsor.Users")

This technique allows us to create a custom format file which targets functions which return different response objects but still share similar properties.

How to load custom formart:

Update-FormatData -AppendPath (Join-Path $PSScriptRoot "Users.format.ps1xml")

Copy link

Learn Build status updates of commit 676044d:

✅ Validation status: passed

File Status Preview URL Details
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Users.format.ps1xml ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

Copy link

Learn Build status updates of commit 8f48182:

✅ Validation status: passed

File Status Preview URL Details
module/Entra/Microsoft.Entra/Users/Users.format.ps1xml ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Users.format.ps1xml ✅Succeeded
src/EntraModuleBuilder.ps1 ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

Copy link

Learn Build status updates of commit b54f788:

✅ Validation status: passed

File Status Preview URL Details
module/Entra/Microsoft.Entra/Users/Users.format.ps1xml ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Users.format.ps1xml ✅Succeeded
src/EntraModuleBuilder.ps1 ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

Copy link

Learn Build status updates of commit 4bcab4a:

❌ Validation status: errors

Please follow instructions here which may help to resolve issue.

File Status Preview URL Details
❌Error Details

  • Line 0, Column 0: [Error: download-failed] Download failed for file 'https://opdhsblobprod04.blob.core.windows.net/contents/4da76285517d424e9edd429dfb0f9a9d/69602807c7186ed7ee3a91b875771d00'. Try closing and reopening the PR. If you get this Error again, file an issue.

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

For any questions, please:

Copy link

@DButoyez DButoyez added the Ready For Review The PR Ready for Review label May 6, 2025
Copy link

Copy link

Copy link

Learn Build status updates of commit 19f29db:

✅ Validation status: passed

File Status Preview URL Details
module/Entra/Microsoft.Entra/Applications/Microsoft.Entra.Applications.format.ps1xml ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserDirectReport.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserManager.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserSponsor.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Microsoft.Entra.Users.format.ps1xml ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Applications/ApplicationsBeta.format.ps1xml ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Applications/Get-EntraBetaApplicationProxyConnector.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Applications/Microsoft.Entra.Beta.Applications.format.ps1xml ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.Entra.Beta.Users.format.ps1xml ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.EntraBeta.Users.format.ps1xml ✅Succeeded
src/EntraModuleBuilder.ps1 ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

Copy link

@DButoyez DButoyez marked this pull request as ready for review May 8, 2025 05:59
@DButoyez DButoyez requested a review from a team as a code owner May 8, 2025 05:59
Copy link

Learn Build status updates of commit 4781552:

✅ Validation status: passed

File Status Preview URL Details
module/Entra/Microsoft.Entra/Applications/Microsoft.Entra.Applications.format.ps1xml ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUser.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserDirectReport.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserManager.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserSponsor.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Microsoft.Entra.Users.format.ps1xml ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Applications/Get-EntraBetaApplicationProxyConnector.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Applications/Microsoft.Entra.Beta.Applications.format.ps1xml ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.Entra.Beta.Users.format.ps1xml ✅Succeeded
src/EntraModuleBuilder.ps1 ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

Copy link

Learn Build status updates of commit a32b193:

✅ Validation status: passed

File Status Preview URL Details
module/Entra/Microsoft.Entra/Applications/Microsoft.Entra.Applications.format.ps1xml ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUser.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserDirectReport.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserManager.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserSponsor.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Microsoft.Entra.Users.format.ps1xml ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Applications/Get-EntraBetaApplicationProxyConnector.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Applications/Microsoft.Entra.Beta.Applications.format.ps1xml ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.Entra.Beta.Users.format.ps1xml ✅Succeeded
src/EntraModuleBuilder.ps1 ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

Copy link
Collaborator Author

@DButoyez DButoyez May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get-EntraBetaUserOwnedObject -UserId derrickb@****

Id Display Name Type


f566f8d5-8ab7-** MSFT
d0397901-7da2-4e7e-f All Company
d62b6974-e18c-4290-b8a4-Digital Initiative Public Relations
3bc8d7e5-9b66-4aba-b60a-Mark 8 Project Team
86104f39-7c71-4ef8-898e- Retail
ab27ebdc-486c-4de9-900b- Sales and Marketing
db96973e-f16c-4e2c-9f38-
U.S. Sales
60d04b5c-4c66-4b3e-8182-*** test

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get-EntraUserManager -UserId derrickb@7***

Id Display Name UPN Created Enabled Type SID


79984fce-9e33-497a-a5a2-**** Alex Wilber Ale***.onmicrosoft.com 28/10/2024 09:50:46 True Member S-1-12-1-2040025038-1232772659-3367215781-***

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Get-EntraUser -UserId derrickb@7svz8d.***

Id Display Name Type


8abd2e2d-1649-43f8-bb99-d95f00*** Derrick B Member

Copy link

Learn Build status updates of commit a5a0220:

✅ Validation status: passed

File Status Preview URL Details
module/Entra/Microsoft.Entra/Applications/Microsoft.Entra.Applications.format.ps1xml ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUser.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserDirectReport.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserManager.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserSponsor.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Microsoft.Entra.Users.format.ps1xml ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Applications/Get-EntraBetaApplicationProxyConnector.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Applications/Microsoft.Entra.Beta.Applications.format.ps1xml ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.Entra.Beta.Users.format.ps1xml ✅Succeeded
src/EntraModuleBuilder.ps1 ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

Copy link

Learn Build status updates of commit 7166412:

✅ Validation status: passed

File Status Preview URL Details
module/Entra/Microsoft.Entra/Applications/Microsoft.Entra.Applications.format.ps1xml ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUser.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserDirectReport.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserManager.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Get-EntraUserSponsor.ps1 ✅Succeeded
module/Entra/Microsoft.Entra/Users/Microsoft.Entra.Users.format.ps1xml ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Applications/Get-EntraBetaApplicationProxyConnector.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Applications/Microsoft.Entra.Beta.Applications.format.ps1xml ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 ✅Succeeded
module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.Entra.Beta.Users.format.ps1xml ✅Succeeded
src/EntraModuleBuilder.ps1 ✅Succeeded

For more details, please refer to the build report.

For any questions, please:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review The PR Ready for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant