-
Notifications
You must be signed in to change notification settings - Fork 18
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
Modularization of Entra Powershell Module #1165
base: main
Are you sure you want to change the base?
Conversation
Learn Build status updates of commit c7d0a91: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 0b61ead: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 856a0cd: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 546221c: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit edb585b: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit cdff71e: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 0037a34: ✅ Validation status: passed
For more details, please refer to the build report. For any questions, please:
|
Learn Build status updates of commit 001b0d9: ✅ 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.
Incomplete?
"guid": "742dccd1-bf4b-46a0-a3f2-14e0bb508233", | ||
"authors": "Microsoft", | ||
"owners": "Microsoft", | ||
"description": "Microsoft Entra PowerShell v1.0: Microsoft Entra PowerShell is a scenario-driven module that allows administrators to efficiently manage Entra ID resources, including users, groups, applications, and policies, among others", |
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.
Pleased to see it referred to as 'Microsoft Entra PowerShell.' Would be ideal for existing strings in the module's source and documentation to be changed from 'Microsoft.Graph.Entra' to 'Microsoft.Entra' and 'Microsoft.Graph.Entra.Beta' to 'Microsoft.Entra.Beta' (but I understand that change will take some time to implement).
@@ -0,0 +1,10 @@ | |||
{ | |||
"Microsoft.Graph.Entra.Beta.Users":["Microsoft.Graph.Beta.Users","Microsoft.Graph.Beta.Users.Actions","Microsoft.Graph.Beta.Users.Functions"], | |||
"Microsoft.Graph.Entra.Beta.Authentication":["Microsoft.Graph.Authentication"], |
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.
Microsoft.Graph.Beta.Authentication
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.
Initial test results: I reviewed the build process, build scripts, and module configuration files. (25 files reviewed so far.) Was able to build the module, connect, and run a command, but some changes are necessary as noted in the comments.
|
||
### Checkout the Modularization Feature Branch | ||
|
||
git pull |
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.
Needs two spaces after git pull
so git checkout modularize
appears on the next line.
|
||
### Install PlatyPS | ||
|
||
The module help files are generated from markdown documentation (using platyPS module). To install PlatyPS module, run the command `Install-Module -Name PlatyPS`. |
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.
Does this require any specific version of PlatyPS?
If NO CHANGES have been made to the `.\module`, then proceed and build the vNext Module | ||
|
||
```powershell | ||
.\build\Split-EntraModule.ps1 -Module 'Entra' |
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.
This script fails when run from the base entra-powershell folder as .\build\Split-EntraModule.ps1 -Module 'Entra'
due to the way paths are referenced in the script. It works as:
cd .\build
.\Split-EntraModule.ps1 -Module 'Entra'
Some red text does quickly scroll past and exceeds the typical buffer size, so I started a transcript:
PS>cd build
�]633;D;0��]633;A��]633;P;Cwd=C:\x5cCode\x5cPersonal\x5cforks\x5centra-powershell\x5cbuild�PS C:\Code\Personal\forks\entra-powershell\build> �]633;B�
**********************
Command start time: 20241113112715
**********************
PS>$global:__psEditorServices_userInput = $args[0]
**********************
Command start time: 20241113112715
**********************
PS>$global:__psEditorServices_userInput = ""
**********************
Command start time: 20241113112715
**********************
PS>.\split-EntraModule.ps1 -Module 'Entra'
[ERROR] ModuleOutputDirectry ..\moduleVNext\Entra\Microsoft.Graph.Entra
[WARNING] PSM1 Path $psm1FilePath
[SUCCESS] [EntraModuleSplitter] Created function file: ..\moduleVNext\Entra\Microsoft.Graph.Entra\Groups\Remove-EntraGroupAppRoleAssignment.ps1 in ..\moduleVNext\Entra\Microsoft.Graph.Entra\Groups
# [...]
[ERROR] [EntraModuleSplitter] Created unmapped function file: ..\moduleVNext\Entra\UnMappedFiles\New-EntraInvitation.ps1 in UnMappedFiles
# [...]
[ERROR] [EntraModuleSplitter] Created unmapped function file: ..\moduleVNext\Entra\UnMappedFiles\Get-EntraUnsupportedCommand.ps1 in UnMappedFiles
[INFO] [EntraModuleSplitter] Created specific function file: ..\moduleVNext\Entra\Microsoft.Graph.Entra\Enable-EntraAzureADAlias.ps1
[SUCCESS] [EntraModuleSplitter] Created function file: ..\moduleVNext\Entra\Microsoft.Graph.Entra\Authentication\Connect-Entra.ps1 in ..\moduleVNext\Entra\Microsoft.Graph.Entra\Authentication
[SUCCESS] [EntraModuleSplitter] Created function file: ..\moduleVNext\Entra\Microsoft.Graph.Entra\DirectoryManagement\Remove-EntraAdministrativeUnit.ps1 in ..\moduleVNext\Entra\Microsoft.Graph.Entra\DirectoryManagement
[SUCCESS] [EntraModuleSplitter] Created function file: ..\moduleVNext\Entra\Microsoft.Graph.Entra\DirectoryManagement\Set-EntraAttributeSet.ps1 in ..\moduleVNext\Entra\Microsoft.Graph.Entra\DirectoryManagement
[SUCCESS] [EntraModuleSplitter] Created function file: ..\moduleVNext\Entra\Microsoft.Graph.Entra\DirectoryManagement\Get-EntraCustomSecurityAttributeDefinitionAllowedValue.ps1 in ..\moduleVNext\Entra\Microsoft.Graph.Entra\DirectoryManagement
[SUCCESS] [EntraModuleSplitter] Created function file: ..\moduleVNext\Entra\Microsoft.Graph.Entra\Authentication\Find-EntraPermission.ps1 in ..\moduleVNext\Entra\Microsoft.Graph.Entra\Authentication
[ERROR] [EntraModuleSplitter] Created unmapped function file: ..\moduleVNext\Entra\UnMappedFiles\New-EntraCustomHeaders.ps1 in UnMappedFiles
[SUCCESS] [EntraModuleSplitter] Created function file: ..\moduleVNext\Entra\Microsoft.Graph.Entra\DirectoryManagement\Get-EntraAttributeSet.ps1 in ..\moduleVNext\Entra\Microsoft.Graph.Entra\DirectoryManagement
[SUCCESS] [EntraModuleSplitter] Created function file: ..\moduleVNext\Entra\Microsoft.Graph.Entra\DirectoryManagement\Get-EntraAdministrativeUnit.ps1 in ..\moduleVNext\Entra\Microsoft.Graph.Entra\DirectoryManagement
[SUCCESS] [EntraModuleSplitter] Created function file: ..\moduleVNext\Entra\Microsoft.Graph.Entra\Applications\Get-EntraApplicationTemplate.ps1 in ..\moduleVNext\Entra\Microsoft.Graph.Entra\Applications
[ERROR] [EntraModuleSplitter] Created unmapped function file: ..\moduleVNext\Entra\UnMappedFiles\Test-EntraScript.ps1 in UnMappedFiles
# [...]
[ERROR] [EntraModuleSplitter] Created unmapped function file: ..\moduleVNext\Entra\UnMappedFiles\Get-EntraDirSyncfeature.ps1 in UnMappedFiles
# [...]
# The next section also shows a pattern of errors and warnings when copying tests due to the script being run from within the build folder instead of from the root folder.
[SUCCESS] [EntraModuleSplitter] Filtered lines have been written and wrapped inside Enable-EntraAzureADAliases function to ..\moduleVNext\Entra\Microsoft.Graph.Entra\Users\Enable-EntraAzureADAliases.ps1
[INFO] [EntraModuleSplitter] Unmapped aliases have been written to ..\moduleVNext\Entra\Microsoft.Graph.Entra\UnMappedAliases.psd1
[INFO] [EntraModuleSplitter] Total Alias Lines (excluding comments and blanks): 231
[INFO] [EntraModuleSplitter] Mapped Aliases: 456
[ERROR] [EntraModuleSplitter] UnMapped Aliases: 1
[SUCCESS] [EntraModuleSplitter] Processing complete.
[SUCCESS] Copied '..\test\module\EntraBeta\Get-EntraBetaUser.Tests.ps1' to '..\testVNext\EntraBeta\Users'
[WARNING] Additional test file 'General.Test.ps1' not found in '../test/module/EntraBeta'
[WARNING] Additional test file 'Invalid.Tests.ps1' not found in '../test/module/EntraBeta'
[WARNING] Additional test file 'Module.Tests.ps1' not found in '../test/module/EntraBeta'
[WARNING] Additional test file 'Valid.Tests.ps1' not found in '../test/module/EntraBeta'
[WARNING] Additional test file 'Entra.Tests.ps1' not found in '../test/module/EntraBeta'
[SUCCESS] Updated content in 'C:\Code\Personal\forks\entra-powershell\testVNext\EntraBeta\Applications\Add-EntraBetaApplicationPolicy.Tests.ps1.FullName'
[SUCCESS] Updated content in 'C:\Code\Personal\forks\entra-powershell\testVNext\EntraBeta\Applications\Get-EntraBetaApplication.Tests.ps1.FullName'
[SUCCESS] Updated content in 'C:\Code\Personal\forks\entra-powershell\testVNext\EntraBeta\Applications\Get-EntraBetaApplicationLogo.Tests.ps1.FullName'
# [...]
[INFO] Copied unmapped test 'C:\Code\Personal\forks\entra-powershell\test\module\EntraBeta\AddtionalFunctions.Tests.ps1' to '../testVNext/EntraBeta'
[INFO] Copied unmapped test 'C:\Code\Personal\forks\entra-powershell\test\module\EntraBeta\Customizations.Tests.ps1' to '../testVNext/EntraBeta'
[INFO] Copied unmapped test 'C:\Code\Personal\forks\entra-powershell\test\module\EntraBeta\EntraBeta.Tests.ps1' to '../testVNext/EntraBeta'
[INFO] Copied unmapped test 'C:\Code\Personal\forks\entra-powershell\test\module\EntraBeta\General.Tests.ps1' to '../testVNext/EntraBeta'
[SUCCESS] Split-Tests completed for source: EntraBeta
�]633;D;0��]633;A��]633;P;Cwd=C:\x5cCode\x5cPersonal\x5cforks\x5centra-powershell\x5cbuild�PS C:\Code\Personal\forks\entra-powershell\build> �]633;B�
Use a clean PowerShell session when you're building the module. The building process attempts to load the required versions of the module, which fails if another version of the dependencies is already loaded. | ||
|
||
```powershell | ||
.\build\Create-CreateModule.ps1 -Module Entra // or EntraBeta |
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.
Invalid script name. Should this be one of these?
- .\build\Create-CompatModule.ps1
- .\build\Create-EntraModule.ps1
- .\build\Create-ModuleMapping.ps1
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.
I ran .\build\Create-EntraModule.ps1 and it succeeded with the resulting files:
PS C:\Code\Personal\forks\entra-powershell> cd .\bin
PS C:\Code\Personal\forks\entra-powershell\bin> ls
Directory: C:\Code\Personal\forks\entra-powershell\bin
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 11/13/2024 11:01 AM 2386518 Microsoft.Graph.Entra-Help.xml
-a--- 11/13/2024 11:06 AM 585031 Microsoft.Graph.Entra.Applications-Help.xml
-a--- 11/13/2024 11:37 AM 7893 Microsoft.Graph.Entra.Applications.psd1
-a--- 11/13/2024 11:37 AM 234133 Microsoft.Graph.Entra.Applications.psm1
-a--- 11/13/2024 11:06 AM 100245 Microsoft.Graph.Entra.Authentication-Help.xml
-a--- 11/13/2024 11:37 AM 5313 Microsoft.Graph.Entra.Authentication.psd1
-a--- 11/13/2024 11:37 AM 54933 Microsoft.Graph.Entra.Authentication.psm1
-a--- 11/13/2024 11:06 AM 610324 Microsoft.Graph.Entra.DirectoryManagement-Help.xml
-a--- 11/13/2024 11:37 AM 7832 Microsoft.Graph.Entra.DirectoryManagement.psd1
-a--- 11/13/2024 11:37 AM 249486 Microsoft.Graph.Entra.DirectoryManagement.psm1
-a--- 11/13/2024 11:06 AM 93207 Microsoft.Graph.Entra.Governance-Help.xml
-a--- 11/13/2024 11:38 AM 5303 Microsoft.Graph.Entra.Governance.psd1
-a--- 11/13/2024 11:37 AM 58179 Microsoft.Graph.Entra.Governance.psm1
-a--- 11/13/2024 11:06 AM 239775 Microsoft.Graph.Entra.Groups-Help.xml
-a--- 11/13/2024 11:38 AM 5980 Microsoft.Graph.Entra.Groups.psd1
-a--- 11/13/2024 11:37 AM 125946 Microsoft.Graph.Entra.Groups.psm1
-a--- 11/13/2024 11:03 AM 15952 Microsoft.Graph.Entra.psd1
-a--- 11/13/2024 11:03 AM 930439 Microsoft.Graph.Entra.psm1
-a--- 11/13/2024 11:06 AM 23403 Microsoft.Graph.Entra.Reports-Help.xml
-a--- 11/13/2024 11:38 AM 5007 Microsoft.Graph.Entra.Reports.psd1
-a--- 11/13/2024 11:37 AM 35879 Microsoft.Graph.Entra.Reports.psm1
-a--- 11/13/2024 11:06 AM 391834 Microsoft.Graph.Entra.SignIns-Help.xml
-a--- 11/13/2024 11:38 AM 6631 Microsoft.Graph.Entra.SignIns.psd1
-a--- 11/13/2024 11:37 AM 171641 Microsoft.Graph.Entra.SignIns.psm1
-a--- 11/13/2024 11:06 AM 316042 Microsoft.Graph.Entra.Users-Help.xml
-a--- 11/13/2024 11:38 AM 6091 Microsoft.Graph.Entra.Users.psd1
-a--- 11/13/2024 11:37 AM 142677 Microsoft.Graph.Entra.Users.psm1
|
||
In order to import it, you need to run `Import-Module .\bin\Microsoft.Graph.Entra.<SubModule>psd1 -Force` | ||
|
||
Alternatively, import the root module(that encompases and includes all the sub-modules and their help and dependencies) `Import-Module .\bin\Microsoft.Graph.Entra.psd1 -Force` |
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.
Importing any of the submodules or the base module results in errors stating that,
Add-Type: Cannot add type. The type name 'Microsoft.Open.MSGraph.[.]' already exists.
Add-Type: Cannot add type. The type name 'Microsoft.Open.AzureAD.[.]' already exists.
even after closing all PowerShell sessions and starting fresh. Possibly due to multiple modules and functions importing the same type.
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.
I proceeded with another fresh PowerShell session, imported the base module, and was able to connect and run Get-EntraUser -Top 10
. 👍
@emmanuel-karanja, I also noted that the generated module manifest files do not yet define any aliases to export. |
…1194) * Sub-Modules as RequiredModules * Sub-Modules as RequiredModules * Sub-Modules as RequiredModules * Sub-Modules as RequiredModules * Sub-Modules as RequiredModules * Sub-Modules as RequiredModules
Learn Build status updates of commit 5f9291d: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit dfefad0: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit ccd2b5b: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit 242e3c1: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit b6d0d71: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
} else { | ||
|
||
# Return the names of the .psd1 files | ||
return $subModules | ForEach-Object { [System.IO.Path]::GetFileNameWithoutExtension($_.Name) } |
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.
return
ends the pipeline, so there could be more flexibility in how this script is used if you remove the return
statement from this line but leave the rest.
@emmanuel-karanja, @KenitoInc, @SteveMutungi254, please let me know if the review and comments are helpful or if feedback would be best provided in a different manner. Thanks for the great work on this module! |
Learn Build status updates of commit 05a9ce7: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit b3a30e7: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit d5a2874: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit 904851a: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
Learn Build status updates of commit 6d0225f: ✅ Validation status: passed
This comment lists only the first 25 files in the pull request. For any questions, please:
|
The implementation to: