-
Notifications
You must be signed in to change notification settings - Fork 35
[POC] Testing powershell formatting - Work in Progress #1445
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
base: main
Are you sure you want to change the base?
Conversation
Learn Build status updates of commit 676044d: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 8f48182: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit b54f788: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 3aef5af: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 4bcab4a: ❌ Validation status: errorsPlease follow instructions here which may help to resolve 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:
|
Learn Build status updates of commit c15bc5f: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 82130d5: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 80499c4: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 19f29db: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit a7b6d0e: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 4781552: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit a32b193: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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-***
There was a problem hiding this comment.
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
Learn Build status updates of commit a5a0220: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 7166412: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
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: