From 676044d85a054b4ec6deff8ea40d60fc17bb9354 Mon Sep 17 00:00:00 2001 From: Derrick Butoyi Date: Fri, 11 Apr 2025 08:59:30 +0300 Subject: [PATCH 01/14] test powershell formatting --- .../Users/Get-EntraBetaUser.ps1 | 1 + .../Users/Get-EntraBetaUserSponsor.ps1 | 1 + .../Users/Users.format.ps1xml | 40 +++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 module/EntraBeta/Microsoft.Entra.Beta/Users/Users.format.ps1xml diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 index 2bc3402af2..7d1c19fc04 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 @@ -135,6 +135,7 @@ ErrorCode: Request_ResourceNotFound" $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } + $userType.PSTypeNames.Insert(0, "EntraBeta.Users") $userList += $userType } $userList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 index 7993ac813c..9297df5e09 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 @@ -94,6 +94,7 @@ function Get-EntraBetaUserSponsor { $propertyValue = $_.Value $memberType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } + $memberType.PSTypeNames.Insert(0, "EntraBeta.Users") $memberList += $memberType } return $memberList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Users.format.ps1xml b/module/EntraBeta/Microsoft.Entra.Beta/Users/Users.format.ps1xml new file mode 100644 index 0000000000..3ce903b27f --- /dev/null +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Users.format.ps1xml @@ -0,0 +1,40 @@ + + + + + EntraBetaUsersTableViewTemplate + + EntraBeta.Users + + + + + + + + + + + + + + + + + + + displayName + + + id + + + description + + + + + + + + \ No newline at end of file From 8f48182ac93e50f35e8dc4fbc02659da61d7f2e2 Mon Sep 17 00:00:00 2001 From: Derrick Butoyi Date: Wed, 23 Apr 2025 13:33:07 +0300 Subject: [PATCH 02/14] add support to load formatting files for each submodule --- .../Microsoft.Entra/Users/Users.format.ps1xml | 40 +++++++++++++++++++ src/EntraModuleBuilder.ps1 | 31 +++++++++++--- 2 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 module/Entra/Microsoft.Entra/Users/Users.format.ps1xml diff --git a/module/Entra/Microsoft.Entra/Users/Users.format.ps1xml b/module/Entra/Microsoft.Entra/Users/Users.format.ps1xml new file mode 100644 index 0000000000..3ce903b27f --- /dev/null +++ b/module/Entra/Microsoft.Entra/Users/Users.format.ps1xml @@ -0,0 +1,40 @@ + + + + + EntraBetaUsersTableViewTemplate + + EntraBeta.Users + + + + + + + + + + + + + + + + + + + displayName + + + id + + + description + + + + + + + + \ No newline at end of file diff --git a/src/EntraModuleBuilder.ps1 b/src/EntraModuleBuilder.ps1 index 46be66f2e4..fb2ad3c96a 100644 --- a/src/EntraModuleBuilder.ps1 +++ b/src/EntraModuleBuilder.ps1 @@ -77,11 +77,28 @@ Set-StrictMode -Version 5 Log-Message "[EntraModuleBuilder] Creating .psm1 file: $psm1FilePath" $psm1Content = $this.headerText + "`n" # Add a newline after the header + $ps1xmlContent = "" # Add a newline after the header # Get-ChildItem returns different types depending on the number of items it finds. # When there is only one item, it returns a single object rather than an array # Using @() we force the result to be treated as an array, even if there is only one item. $ps1Files = @(Get-ChildItem -Path $currentDirPath -Filter "*.ps1") + + $ps1xmlFileName = "$currentDirName.format.ps1xml" + $ps1xmlFilePath = Join-Path -Path $destDirectory -ChildPath $ps1xmlFileName + + $ps1xmlFiles = @(Get-ChildItem -Path $currentDirPath -Filter "*format.ps1xml") + if ($ps1xmlFiles.Count -gt 0) { + foreach ($ps1xmlFile in $ps1xmlFiles) { + Log-Message "[EntraModuleBuilder] Appending formating content from file: $($ps1xmlFile.Name)" -ForegroundColor Cyan + $ps1xmlContent = Get-Content -Path $ps1xmlFile.FullName -Raw + $ps1xmlContent += "`n" # Add an empty line at the end + } + Log-Message "[EntraModuleBuilder] Writing .psm1 file to disk: $ps1xmlFilePath" + Set-Content -Path $ps1xmlFilePath -Value $ps1xmlContent + + Log-Message "[EntraModuleBuilder] Module file created: $psm1FilePath" -Level 'SUCCESS' + } if ($ps1Files.Count -eq 0) { Log-Message "[EntraModuleBuilder] Warning: No .ps1 files found in directory $currentDirPath" -Level 'ERROR' @@ -237,8 +254,6 @@ Set-StrictMode -Version 5 } } - - # Main function to create the root module [void] CreateRootModule([string] $Module) { #We only generate the .psm1 file with Enable-EntraAzureADAlias if it's 'Microsoft.Entra' module @@ -499,10 +514,15 @@ $($requiredModulesEntries -join ",`n") exit } - # Get all files in the specified directory and its subdirectories, without extensions - $allFunctions = @(Get-ChildItem -Path $subDir.FullName -Recurse -File | ForEach-Object { $_.BaseName }) + # Get all files in the specified directory and its subdirectories + $allFiles = @(Get-ChildItem -Path $subDir.FullName -Recurse -File) + $filteredFunctions = $allFiles | Where-Object { $_.Extension -eq ".ps1"} + $functions = @($filteredFunctions | ForEach-Object { $_.BaseName }) + "Enable-EntraAzureADAlias" + "Get-EntraUnsupportedCommand" - $functions = $allFunctions + "Enable-EntraAzureADAlias" + "Get-EntraUnsupportedCommand" + # Get formatting file for submodule + $filteredFormattingFiles = $allFiles | Where-Object { $_.Extension -eq ".ps1xml"} + $formattingFiles = @($filteredFormattingFiles | ForEach-Object { $_.Name }) + #QuickFix: TODO: Generalize to use this with any sub-module, by auto-extracting the alias $aliasesToExport = $this.ExtractSubModuleAliases($subDir.FullName, $moduleName) @@ -544,6 +564,7 @@ $($requiredModulesEntries -join ",`n") CompatiblePSEditions = @('Desktop', 'Core') RequiredModules = $requiredModules NestedModules = @() + FormatsToProcess = $formattingFiles } From b54f788d8f8f04fc03b800aaa9b6d7e0cfbc4ecd Mon Sep 17 00:00:00 2001 From: Derrick Butoyi Date: Thu, 24 Apr 2025 08:45:45 +0300 Subject: [PATCH 03/14] code cleanup --- .../Microsoft.Entra/Users/Users.format.ps1xml | 16 ++++++++++++++-- src/EntraModuleBuilder.ps1 | 6 +++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/module/Entra/Microsoft.Entra/Users/Users.format.ps1xml b/module/Entra/Microsoft.Entra/Users/Users.format.ps1xml index 3ce903b27f..cb3e7e41f7 100644 --- a/module/Entra/Microsoft.Entra/Users/Users.format.ps1xml +++ b/module/Entra/Microsoft.Entra/Users/Users.format.ps1xml @@ -16,7 +16,13 @@ - + + + + + + + @@ -29,7 +35,13 @@ id - description + upn + + + type + + + status diff --git a/src/EntraModuleBuilder.ps1 b/src/EntraModuleBuilder.ps1 index fb2ad3c96a..695cd8cff3 100644 --- a/src/EntraModuleBuilder.ps1 +++ b/src/EntraModuleBuilder.ps1 @@ -77,7 +77,7 @@ Set-StrictMode -Version 5 Log-Message "[EntraModuleBuilder] Creating .psm1 file: $psm1FilePath" $psm1Content = $this.headerText + "`n" # Add a newline after the header - $ps1xmlContent = "" # Add a newline after the header + $ps1xmlContent = "" # Xml content to be appended later # Get-ChildItem returns different types depending on the number of items it finds. # When there is only one item, it returns a single object rather than an array @@ -94,10 +94,10 @@ Set-StrictMode -Version 5 $ps1xmlContent = Get-Content -Path $ps1xmlFile.FullName -Raw $ps1xmlContent += "`n" # Add an empty line at the end } - Log-Message "[EntraModuleBuilder] Writing .psm1 file to disk: $ps1xmlFilePath" + Log-Message "[EntraModuleBuilder] Writing .ps1xml file to disk: $ps1xmlFilePath" Set-Content -Path $ps1xmlFilePath -Value $ps1xmlContent - Log-Message "[EntraModuleBuilder] Module file created: $psm1FilePath" -Level 'SUCCESS' + Log-Message "[EntraModuleBuilder] Module Formating file created: $ps1xmlFilePath" -Level 'SUCCESS' } if ($ps1Files.Count -eq 0) { From 599b14f2253343163692dbbf5bb4d48e4b44f15f Mon Sep 17 00:00:00 2001 From: Derrick Butoyi Date: Mon, 5 May 2025 08:26:00 +0300 Subject: [PATCH 04/14] refactor entra module builder --- .../Users/Get-EntraUserSponsor.ps1 | 1 + .../Microsoft.Entra/Users/Users.format.ps1xml | 99 +++++++++++++------ .../ApplicationsBeta.format.ps1xml | 33 +++++++ ...Get-EntraBetaApplicationProxyConnector.ps1 | 1 + .../Users/Get-EntraBetaUserManager.ps1 | 1 + .../Users/Get-EntraBetaUserOwnedObject.ps1 | 1 + .../Users/Get-EntraBetaUserSponsor.ps1 | 2 +- .../Users/Users.format.ps1xml | 40 -------- .../Users/UsersBeta.format.ps1xml | 91 +++++++++++++++++ src/EntraModuleBuilder.ps1 | 5 +- 10 files changed, 198 insertions(+), 76 deletions(-) create mode 100644 module/EntraBeta/Microsoft.Entra.Beta/Applications/ApplicationsBeta.format.ps1xml delete mode 100644 module/EntraBeta/Microsoft.Entra.Beta/Users/Users.format.ps1xml create mode 100644 module/EntraBeta/Microsoft.Entra.Beta/Users/UsersBeta.format.ps1xml diff --git a/module/Entra/Microsoft.Entra/Users/Get-EntraUserSponsor.ps1 b/module/Entra/Microsoft.Entra/Users/Get-EntraUserSponsor.ps1 index b40d5f6fae..a4faff96a0 100644 --- a/module/Entra/Microsoft.Entra/Users/Get-EntraUserSponsor.ps1 +++ b/module/Entra/Microsoft.Entra/Users/Get-EntraUserSponsor.ps1 @@ -101,6 +101,7 @@ function Get-EntraUserSponsor { $propertyValue = $_.Value $memberType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } + $memberType.PSTypeNames.Insert(0, "Microsoft.Entra.User.Simple") $memberList += $memberType } return $memberList diff --git a/module/Entra/Microsoft.Entra/Users/Users.format.ps1xml b/module/Entra/Microsoft.Entra/Users/Users.format.ps1xml index cb3e7e41f7..f6c6420771 100644 --- a/module/Entra/Microsoft.Entra/Users/Users.format.ps1xml +++ b/module/Entra/Microsoft.Entra/Users/Users.format.ps1xml @@ -1,48 +1,83 @@ + - EntraBetaUsersTableViewTemplate + EntraUserStandardView - EntraBeta.Users + Microsoft.Entra.User - - - - - - - - - - - - - - - + + + + + - - displayName - - - id - - - upn - - - type - - - status - + id + displayName + userPrincipalName + userType + accountEnabled + + + + + + + + + EntraUserSimpleView + + Microsoft.Entra.User.Simple + + + + + + + + + + + + id + displayName + userType + + + + + + + + + EntraApplicationView + + Microsoft.Entra.Application + + + + + + + + + + + + + + id + displayName + appId + signInAudience + publisherDomain diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Applications/ApplicationsBeta.format.ps1xml b/module/EntraBeta/Microsoft.Entra.Beta/Applications/ApplicationsBeta.format.ps1xml new file mode 100644 index 0000000000..42390b0336 --- /dev/null +++ b/module/EntraBeta/Microsoft.Entra.Beta/Applications/ApplicationsBeta.format.ps1xml @@ -0,0 +1,33 @@ + + + + + + EntraBetaApplicationView + + Microsoft.EntraBeta.Application + + + + + + + + + + + + + + id + displayName + appId + signInAudience + publisherDomain + + + + + + + \ No newline at end of file diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Applications/Get-EntraBetaApplicationProxyConnector.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Applications/Get-EntraBetaApplicationProxyConnector.ps1 index 34f1bda309..e67df26398 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Applications/Get-EntraBetaApplicationProxyConnector.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Applications/Get-EntraBetaApplicationProxyConnector.ps1 @@ -64,6 +64,7 @@ function Get-EntraBetaApplicationProxyConnector { $propertyValue = $_.Value $targetType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } + $targetType.PSTypeNames.Insert(0, "Microsoft.Entra.Application") $targetList += $targetType } $targetList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 index 99d74153e9..51bac8f7eb 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 @@ -80,6 +80,7 @@ function Get-EntraBetaUserManager { $propertyValue = $_.Value $targetType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } + $targetType.PSTypeNames.Insert(0, "Microsoft.Entra.User.Manager") $targetList += $targetType } $targetList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 index eb4f23ea67..7874d691df 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 @@ -63,6 +63,7 @@ function Get-EntraBetaUserOwnedObject { $propertyValue = $_.Value $targetType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } + $memberType.PSTypeNames.Insert(0, "Microsoft.Entra.User.Simple") $targetList += $targetType } $targetList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 index 3ff2de0d29..d3ce8fc8f1 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 @@ -103,7 +103,7 @@ function Get-EntraBetaUserSponsor { $propertyValue = $_.Value $memberType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } - $memberType.PSTypeNames.Insert(0, "EntraBeta.Users") + $memberType.PSTypeNames.Insert(0, "Microsoft.Entra.User.Simple") $memberList += $memberType } return $memberList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Users.format.ps1xml b/module/EntraBeta/Microsoft.Entra.Beta/Users/Users.format.ps1xml deleted file mode 100644 index 3ce903b27f..0000000000 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Users.format.ps1xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - EntraBetaUsersTableViewTemplate - - EntraBeta.Users - - - - - - - - - - - - - - - - - - - displayName - - - id - - - description - - - - - - - - \ No newline at end of file diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/UsersBeta.format.ps1xml b/module/EntraBeta/Microsoft.Entra.Beta/Users/UsersBeta.format.ps1xml new file mode 100644 index 0000000000..2fe05b486b --- /dev/null +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/UsersBeta.format.ps1xml @@ -0,0 +1,91 @@ + + + + + + EntraBetaUserStandardView + + Microsoft.EntraBeta.User + + + + + + + + + + + + + + id + displayName + userPrincipalName + userType + accountEnabled + + + + + + + + + EntraBetaUserSimpleView + + Microsoft.EntraBeta.User.Simple + + + + + + + + + + + + id + displayName + userType + + + + + + + + + EntraUserManagerView + + Microsoft.Entra.User.Manager + + + + + + + + + + + + + + + + id + displayName + userPrincipalName + createdDateTime + accountEnabled + userType + securityIdentifier + + + + + + + \ No newline at end of file diff --git a/src/EntraModuleBuilder.ps1 b/src/EntraModuleBuilder.ps1 index 695cd8cff3..ce2411f848 100644 --- a/src/EntraModuleBuilder.ps1 +++ b/src/EntraModuleBuilder.ps1 @@ -83,9 +83,6 @@ Set-StrictMode -Version 5 # When there is only one item, it returns a single object rather than an array # Using @() we force the result to be treated as an array, even if there is only one item. $ps1Files = @(Get-ChildItem -Path $currentDirPath -Filter "*.ps1") - - $ps1xmlFileName = "$currentDirName.format.ps1xml" - $ps1xmlFilePath = Join-Path -Path $destDirectory -ChildPath $ps1xmlFileName $ps1xmlFiles = @(Get-ChildItem -Path $currentDirPath -Filter "*format.ps1xml") if ($ps1xmlFiles.Count -gt 0) { @@ -94,6 +91,8 @@ Set-StrictMode -Version 5 $ps1xmlContent = Get-Content -Path $ps1xmlFile.FullName -Raw $ps1xmlContent += "`n" # Add an empty line at the end } + + $ps1xmlFilePath = Join-Path -Path $destDirectory -ChildPath $ps1xmlFile.Name Log-Message "[EntraModuleBuilder] Writing .ps1xml file to disk: $ps1xmlFilePath" Set-Content -Path $ps1xmlFilePath -Value $ps1xmlContent From 3aef5af9976d05de924bfaca82e1bfeb0a5e922a Mon Sep 17 00:00:00 2001 From: Derrick Butoyi Date: Mon, 5 May 2025 10:01:04 +0300 Subject: [PATCH 05/14] cleanup and refactors --- .../EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 | 2 +- .../Users/Get-EntraBetaUserDirectReport.ps1 | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 index 430f8e1204..9ba0ae7980 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 @@ -135,7 +135,7 @@ ErrorCode: Request_ResourceNotFound" $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } - $userType.PSTypeNames.Insert(0, "EntraBeta.Users") + $userType.PSTypeNames.Insert(0, "Microsoft.EntraBeta.User.Simple") $userList += $userType } $userList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 index 342cb998cb..b92b0fc358 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 @@ -69,6 +69,7 @@ function Get-EntraBetaUserDirectReport { $propertyValue = $_.Value $targetType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } + $targetType.PSTypeNames.Insert(0, "Microsoft.Entra.User.Manager") $targetList += $targetType } $targetList From 4bcab4acf2f3d380caa8f3503a996177148931ae Mon Sep 17 00:00:00 2001 From: Derrick Butoyi Date: Tue, 6 May 2025 06:17:22 +0300 Subject: [PATCH 06/14] update PStypename for number of commands --- .../Entra/Microsoft.Entra/Users/Get-EntraUserDirectReport.ps1 | 1 + module/Entra/Microsoft.Entra/Users/Get-EntraUserManager.ps1 | 1 + .../Users/Get-EntraBetaUserDirectReport.ps1 | 2 +- .../Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 | 2 +- .../Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 | 2 +- .../Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/module/Entra/Microsoft.Entra/Users/Get-EntraUserDirectReport.ps1 b/module/Entra/Microsoft.Entra/Users/Get-EntraUserDirectReport.ps1 index a1a6c39ee0..2f1ce60c9e 100644 --- a/module/Entra/Microsoft.Entra/Users/Get-EntraUserDirectReport.ps1 +++ b/module/Entra/Microsoft.Entra/Users/Get-EntraUserDirectReport.ps1 @@ -79,6 +79,7 @@ function Get-EntraUserDirectReport { $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } + $userType.PSTypeNames.Insert(0, "Microsoft.Entra.User.Manager") $userList += $userType } $userList diff --git a/module/Entra/Microsoft.Entra/Users/Get-EntraUserManager.ps1 b/module/Entra/Microsoft.Entra/Users/Get-EntraUserManager.ps1 index 68a4d587b7..4d04ceb7e4 100644 --- a/module/Entra/Microsoft.Entra/Users/Get-EntraUserManager.ps1 +++ b/module/Entra/Microsoft.Entra/Users/Get-EntraUserManager.ps1 @@ -57,6 +57,7 @@ function Get-EntraUserManager { $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } + $userType.PSTypeNames.Insert(0, "Microsoft.Entra.User.Manager") $userList += $userType } $userList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 index b92b0fc358..34d85c2d00 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 @@ -69,7 +69,7 @@ function Get-EntraBetaUserDirectReport { $propertyValue = $_.Value $targetType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } - $targetType.PSTypeNames.Insert(0, "Microsoft.Entra.User.Manager") + $targetType.PSTypeNames.Insert(0, "Microsoft.EntraBeta.User.Manager") $targetList += $targetType } $targetList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 index 51bac8f7eb..8a3448305a 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 @@ -80,7 +80,7 @@ function Get-EntraBetaUserManager { $propertyValue = $_.Value $targetType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } - $targetType.PSTypeNames.Insert(0, "Microsoft.Entra.User.Manager") + $targetType.PSTypeNames.Insert(0, "Microsoft.EntraBeta.User.Manager") $targetList += $targetType } $targetList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 index 7874d691df..0b8ef762a2 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 @@ -63,7 +63,7 @@ function Get-EntraBetaUserOwnedObject { $propertyValue = $_.Value $targetType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } - $memberType.PSTypeNames.Insert(0, "Microsoft.Entra.User.Simple") + $memberType.PSTypeNames.Insert(0, "Microsoft.EntraBeta.User.Simple") $targetList += $targetType } $targetList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 index d3ce8fc8f1..7a86a4bce7 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 @@ -103,7 +103,7 @@ function Get-EntraBetaUserSponsor { $propertyValue = $_.Value $memberType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } - $memberType.PSTypeNames.Insert(0, "Microsoft.Entra.User.Simple") + $memberType.PSTypeNames.Insert(0, "Microsoft.EntraBeta.User.Simple") $memberList += $memberType } return $memberList From 82130d5ece049c1c4ec7d0c42905c793f2a4d7e3 Mon Sep 17 00:00:00 2001 From: Derrick Butoyi Date: Tue, 6 May 2025 10:42:19 +0300 Subject: [PATCH 07/14] refactors change formatting file naming structure --- ...Microsoft.Entra.Applications.format.ps1xml | 33 +++++++++++++++++++ ...ml => Microsoft.Entra.Users.format.ps1xml} | 0 ...> Microsoft.EntraBeta.Users.format.ps1xml} | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 module/Entra/Microsoft.Entra/Applications/Microsoft.Entra.Applications.format.ps1xml rename module/Entra/Microsoft.Entra/Users/{Users.format.ps1xml => Microsoft.Entra.Users.format.ps1xml} (100%) rename module/EntraBeta/Microsoft.Entra.Beta/Users/{UsersBeta.format.ps1xml => Microsoft.EntraBeta.Users.format.ps1xml} (98%) diff --git a/module/Entra/Microsoft.Entra/Applications/Microsoft.Entra.Applications.format.ps1xml b/module/Entra/Microsoft.Entra/Applications/Microsoft.Entra.Applications.format.ps1xml new file mode 100644 index 0000000000..42390b0336 --- /dev/null +++ b/module/Entra/Microsoft.Entra/Applications/Microsoft.Entra.Applications.format.ps1xml @@ -0,0 +1,33 @@ + + + + + + EntraBetaApplicationView + + Microsoft.EntraBeta.Application + + + + + + + + + + + + + + id + displayName + appId + signInAudience + publisherDomain + + + + + + + \ No newline at end of file diff --git a/module/Entra/Microsoft.Entra/Users/Users.format.ps1xml b/module/Entra/Microsoft.Entra/Users/Microsoft.Entra.Users.format.ps1xml similarity index 100% rename from module/Entra/Microsoft.Entra/Users/Users.format.ps1xml rename to module/Entra/Microsoft.Entra/Users/Microsoft.Entra.Users.format.ps1xml diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/UsersBeta.format.ps1xml b/module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.EntraBeta.Users.format.ps1xml similarity index 98% rename from module/EntraBeta/Microsoft.Entra.Beta/Users/UsersBeta.format.ps1xml rename to module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.EntraBeta.Users.format.ps1xml index 2fe05b486b..c10c6092e2 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/UsersBeta.format.ps1xml +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.EntraBeta.Users.format.ps1xml @@ -59,7 +59,7 @@ EntraUserManagerView - Microsoft.Entra.User.Manager + Microsoft.EntraBeta.User.Manager From 80499c4c0594eab53ac76061d1d4016a7d05e17d Mon Sep 17 00:00:00 2001 From: Derrick Butoyi Date: Tue, 6 May 2025 20:33:11 +0300 Subject: [PATCH 08/14] fix pipeline failure cannot find path for member FormartToProcess --- src/EntraModuleBuilder.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EntraModuleBuilder.ps1 b/src/EntraModuleBuilder.ps1 index ce2411f848..cf5ad76b5c 100644 --- a/src/EntraModuleBuilder.ps1 +++ b/src/EntraModuleBuilder.ps1 @@ -555,7 +555,7 @@ $($requiredModulesEntries -join ",`n") AliasesToExport = $aliasesToExport Author = $($content.authors) CompanyName = $($content.owners) - FileList = @("$manifestFileName", "$moduleFileName", "$helpFileName") + FileList = @("$manifestFileName", "$moduleFileName", "$helpFileName", "$formattingFiles") RootModule = "$moduleFileName" Description = $content.moduleName DotNetFrameworkVersion = $([System.Version]::Parse($content.dotNetVersion)) From 19f29dbb14812d602586497454ad526f071cbd91 Mon Sep 17 00:00:00 2001 From: Derrick Butoyi Date: Wed, 7 May 2025 07:30:16 +0300 Subject: [PATCH 09/14] fix pipeline failure cannot find path for member FormartToProcess EntraBeta --- ...soft.Entra.Beta.Applications.format.ps1xml | 33 +++++++ .../Microsoft.Entra.Beta.Users.format.ps1xml | 91 +++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 module/EntraBeta/Microsoft.Entra.Beta/Applications/Microsoft.Entra.Beta.Applications.format.ps1xml create mode 100644 module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.Entra.Beta.Users.format.ps1xml diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Applications/Microsoft.Entra.Beta.Applications.format.ps1xml b/module/EntraBeta/Microsoft.Entra.Beta/Applications/Microsoft.Entra.Beta.Applications.format.ps1xml new file mode 100644 index 0000000000..42390b0336 --- /dev/null +++ b/module/EntraBeta/Microsoft.Entra.Beta/Applications/Microsoft.Entra.Beta.Applications.format.ps1xml @@ -0,0 +1,33 @@ + + + + + + EntraBetaApplicationView + + Microsoft.EntraBeta.Application + + + + + + + + + + + + + + id + displayName + appId + signInAudience + publisherDomain + + + + + + + \ No newline at end of file diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.Entra.Beta.Users.format.ps1xml b/module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.Entra.Beta.Users.format.ps1xml new file mode 100644 index 0000000000..c10c6092e2 --- /dev/null +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.Entra.Beta.Users.format.ps1xml @@ -0,0 +1,91 @@ + + + + + + EntraBetaUserStandardView + + Microsoft.EntraBeta.User + + + + + + + + + + + + + + id + displayName + userPrincipalName + userType + accountEnabled + + + + + + + + + EntraBetaUserSimpleView + + Microsoft.EntraBeta.User.Simple + + + + + + + + + + + + id + displayName + userType + + + + + + + + + EntraUserManagerView + + Microsoft.EntraBeta.User.Manager + + + + + + + + + + + + + + + + id + displayName + userPrincipalName + createdDateTime + accountEnabled + userType + securityIdentifier + + + + + + + \ No newline at end of file From a7b6d0e603b9d7919c385479eb2ed0acb7b81f1a Mon Sep 17 00:00:00 2001 From: Derrick Butoyi Date: Wed, 7 May 2025 07:31:41 +0300 Subject: [PATCH 10/14] delete beta formatting files --- .../ApplicationsBeta.format.ps1xml | 33 ------- .../Microsoft.EntraBeta.Users.format.ps1xml | 91 ------------------- 2 files changed, 124 deletions(-) delete mode 100644 module/EntraBeta/Microsoft.Entra.Beta/Applications/ApplicationsBeta.format.ps1xml delete mode 100644 module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.EntraBeta.Users.format.ps1xml diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Applications/ApplicationsBeta.format.ps1xml b/module/EntraBeta/Microsoft.Entra.Beta/Applications/ApplicationsBeta.format.ps1xml deleted file mode 100644 index 42390b0336..0000000000 --- a/module/EntraBeta/Microsoft.Entra.Beta/Applications/ApplicationsBeta.format.ps1xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - EntraBetaApplicationView - - Microsoft.EntraBeta.Application - - - - - - - - - - - - - - id - displayName - appId - signInAudience - publisherDomain - - - - - - - \ No newline at end of file diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.EntraBeta.Users.format.ps1xml b/module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.EntraBeta.Users.format.ps1xml deleted file mode 100644 index c10c6092e2..0000000000 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.EntraBeta.Users.format.ps1xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - EntraBetaUserStandardView - - Microsoft.EntraBeta.User - - - - - - - - - - - - - - id - displayName - userPrincipalName - userType - accountEnabled - - - - - - - - - EntraBetaUserSimpleView - - Microsoft.EntraBeta.User.Simple - - - - - - - - - - - - id - displayName - userType - - - - - - - - - EntraUserManagerView - - Microsoft.EntraBeta.User.Manager - - - - - - - - - - - - - - - - id - displayName - userPrincipalName - createdDateTime - accountEnabled - userType - securityIdentifier - - - - - - - \ No newline at end of file From 47815522d6c50a25931bd4953240ded4feb24432 Mon Sep 17 00:00:00 2001 From: Derrick Butoyi Date: Thu, 8 May 2025 09:24:41 +0300 Subject: [PATCH 11/14] refactor formatting files --- ...Microsoft.Entra.Applications.format.ps1xml | 4 ++-- .../Microsoft.Entra/Users/Get-EntraUser.ps1 | 1 + .../Users/Microsoft.Entra.Users.format.ps1xml | 22 +++++++++++-------- ...Get-EntraBetaApplicationProxyConnector.ps1 | 2 +- ...soft.Entra.Beta.Applications.format.ps1xml | 2 +- .../Users/Get-EntraBetaUser.ps1 | 2 +- .../Users/Get-EntraBetaUserDirectReport.ps1 | 2 +- .../Users/Get-EntraBetaUserManager.ps1 | 2 +- .../Users/Get-EntraBetaUserOwnedObject.ps1 | 2 +- .../Users/Get-EntraBetaUserSponsor.ps1 | 3 +-- .../Microsoft.Entra.Beta.Users.format.ps1xml | 6 ++--- 11 files changed, 26 insertions(+), 22 deletions(-) diff --git a/module/Entra/Microsoft.Entra/Applications/Microsoft.Entra.Applications.format.ps1xml b/module/Entra/Microsoft.Entra/Applications/Microsoft.Entra.Applications.format.ps1xml index 42390b0336..eab4c70e85 100644 --- a/module/Entra/Microsoft.Entra/Applications/Microsoft.Entra.Applications.format.ps1xml +++ b/module/Entra/Microsoft.Entra/Applications/Microsoft.Entra.Applications.format.ps1xml @@ -3,9 +3,9 @@ - EntraBetaApplicationView + EntraApplicationView - Microsoft.EntraBeta.Application + Microsoft.Entra.Application diff --git a/module/Entra/Microsoft.Entra/Users/Get-EntraUser.ps1 b/module/Entra/Microsoft.Entra/Users/Get-EntraUser.ps1 index b0132b61c0..26398ad793 100644 --- a/module/Entra/Microsoft.Entra/Users/Get-EntraUser.ps1 +++ b/module/Entra/Microsoft.Entra/Users/Get-EntraUser.ps1 @@ -126,6 +126,7 @@ function Get-EntraUser { $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } + $userType.PSTypeNames.Insert(0, "Microsoft.Entra.User.Simple") $userList += $userType } $userList diff --git a/module/Entra/Microsoft.Entra/Users/Microsoft.Entra.Users.format.ps1xml b/module/Entra/Microsoft.Entra/Users/Microsoft.Entra.Users.format.ps1xml index f6c6420771..30055de14a 100644 --- a/module/Entra/Microsoft.Entra/Users/Microsoft.Entra.Users.format.ps1xml +++ b/module/Entra/Microsoft.Entra/Users/Microsoft.Entra.Users.format.ps1xml @@ -55,29 +55,33 @@ - + - EntraApplicationView + EntraUserManagerView - Microsoft.Entra.Application + Microsoft.Entra.User.Manager - - - + + + + + id displayName - appId - signInAudience - publisherDomain + userPrincipalName + createdDateTime + accountEnabled + userType + securityIdentifier diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Applications/Get-EntraBetaApplicationProxyConnector.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Applications/Get-EntraBetaApplicationProxyConnector.ps1 index 5525b71386..73e531f866 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Applications/Get-EntraBetaApplicationProxyConnector.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Applications/Get-EntraBetaApplicationProxyConnector.ps1 @@ -64,7 +64,7 @@ function Get-EntraBetaApplicationProxyConnector { $propertyValue = $_.Value $targetType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } - $targetType.PSTypeNames.Insert(0, "Microsoft.Entra.Application") + $targetType.PSTypeNames.Insert(0, "Microsoft.Entra.Beta.Application") $targetList += $targetType } $targetList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Applications/Microsoft.Entra.Beta.Applications.format.ps1xml b/module/EntraBeta/Microsoft.Entra.Beta/Applications/Microsoft.Entra.Beta.Applications.format.ps1xml index 42390b0336..bd7b6c99ae 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Applications/Microsoft.Entra.Beta.Applications.format.ps1xml +++ b/module/EntraBeta/Microsoft.Entra.Beta/Applications/Microsoft.Entra.Beta.Applications.format.ps1xml @@ -5,7 +5,7 @@ EntraBetaApplicationView - Microsoft.EntraBeta.Application + Microsoft.Entra.Beta.Application diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 index 9ba0ae7980..6793eab85e 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUser.ps1 @@ -135,7 +135,7 @@ ErrorCode: Request_ResourceNotFound" $propertyValue = $_.Value $userType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } - $userType.PSTypeNames.Insert(0, "Microsoft.EntraBeta.User.Simple") + $userType.PSTypeNames.Insert(0, "Microsoft.Entra.Beta.User.Simple") $userList += $userType } $userList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 index 0ba1daaa89..6e4297ddec 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserDirectReport.ps1 @@ -69,7 +69,7 @@ function Get-EntraBetaUserDirectReport { $propertyValue = $_.Value $targetType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } - $targetType.PSTypeNames.Insert(0, "Microsoft.EntraBeta.User.Manager") + $targetType.PSTypeNames.Insert(0, "Microsoft.Entra.Beta.User.Manager") $targetList += $targetType } $targetList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 index 8a3448305a..be6f8a58dd 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserManager.ps1 @@ -80,7 +80,7 @@ function Get-EntraBetaUserManager { $propertyValue = $_.Value $targetType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } - $targetType.PSTypeNames.Insert(0, "Microsoft.EntraBeta.User.Manager") + $targetType.PSTypeNames.Insert(0, "Microsoft.Entra.Beta.User.Manager") $targetList += $targetType } $targetList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 index 0b8ef762a2..4ba01b96fc 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 @@ -63,7 +63,7 @@ function Get-EntraBetaUserOwnedObject { $propertyValue = $_.Value $targetType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } - $memberType.PSTypeNames.Insert(0, "Microsoft.EntraBeta.User.Simple") + $memberType.PSTypeNames.Insert(0, "Microsoft.Entra.Beta.User.Simple") $targetList += $targetType } $targetList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 index 54715549db..631aa6a1e5 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserSponsor.ps1 @@ -74,7 +74,6 @@ function Get-EntraBetaUserSponsor { $response = Invoke-GraphRequest -Headers $customHeaders -Uri $($params.Uri) -Method GET | ConvertTo-Json -Depth 10 | ConvertFrom-Json try { $data = $response.value | ConvertTo-Json -Depth 10 | ConvertFrom-Json - $directoryObjectList = @() $all = $All.IsPresent $increment = $topCount - $data.Count @@ -103,7 +102,7 @@ function Get-EntraBetaUserSponsor { $propertyValue = $_.Value $memberType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } - $memberType.PSTypeNames.Insert(0, "Microsoft.EntraBeta.User.Simple") + $memberType.PSTypeNames.Insert(0, "Microsoft.Entra.Beta.User.Simple") $memberList += $memberType } return $memberList diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.Entra.Beta.Users.format.ps1xml b/module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.Entra.Beta.Users.format.ps1xml index c10c6092e2..9ec98cff33 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.Entra.Beta.Users.format.ps1xml +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Microsoft.Entra.Beta.Users.format.ps1xml @@ -5,7 +5,7 @@ EntraBetaUserStandardView - Microsoft.EntraBeta.User + Microsoft.Entra.Beta.User @@ -34,7 +34,7 @@ EntraBetaUserSimpleView - Microsoft.EntraBeta.User.Simple + Microsoft.Entra.Beta.User.Simple @@ -59,7 +59,7 @@ EntraUserManagerView - Microsoft.EntraBeta.User.Manager + Microsoft.Entra.Beta.User.Manager From a32b1932c1aadab264f0aa582527f4adb279a2ba Mon Sep 17 00:00:00 2001 From: Derrick Butoyi Date: Thu, 8 May 2025 10:40:35 +0300 Subject: [PATCH 12/14] fix Get-EntraUserOwnedObject cutom type response --- .../Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 index 4ba01b96fc..7c538f894c 100644 --- a/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 +++ b/module/EntraBeta/Microsoft.Entra.Beta/Users/Get-EntraBetaUserOwnedObject.ps1 @@ -63,7 +63,7 @@ function Get-EntraBetaUserOwnedObject { $propertyValue = $_.Value $targetType | Add-Member -MemberType NoteProperty -Name $propertyName -Value $propertyValue -Force } - $memberType.PSTypeNames.Insert(0, "Microsoft.Entra.Beta.User.Simple") + $targetType.PSTypeNames.Insert(0, "Microsoft.Entra.Beta.User.Simple") $targetList += $targetType } $targetList From a5a022028ad69f611c3c3cae8d8d5622df1d8aa3 Mon Sep 17 00:00:00 2001 From: Derrick Butoyi Date: Tue, 13 May 2025 16:53:42 +0300 Subject: [PATCH 13/14] fix build failure on 5.1 --- src/EntraModuleBuilder.ps1 | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/EntraModuleBuilder.ps1 b/src/EntraModuleBuilder.ps1 index cf5ad76b5c..bba13cb25c 100644 --- a/src/EntraModuleBuilder.ps1 +++ b/src/EntraModuleBuilder.ps1 @@ -80,24 +80,24 @@ Set-StrictMode -Version 5 $ps1xmlContent = "" # Xml content to be appended later # Get-ChildItem returns different types depending on the number of items it finds. - # When there is only one item, it returns a single object rather than an array - # Using @() we force the result to be treated as an array, even if there is only one item. - $ps1Files = @(Get-ChildItem -Path $currentDirPath -Filter "*.ps1") + $ps1Files = @(Get-ChildItem -Path $currentDirPath -Include "*.ps1" -Recurse:$true) - $ps1xmlFiles = @(Get-ChildItem -Path $currentDirPath -Filter "*format.ps1xml") + $ps1xmlFiles = @(Get-ChildItem -Path $currentDirPath -Filter "*.format.ps1xml") if ($ps1xmlFiles.Count -gt 0) { foreach ($ps1xmlFile in $ps1xmlFiles) { - Log-Message "[EntraModuleBuilder] Appending formating content from file: $($ps1xmlFile.Name)" -ForegroundColor Cyan - $ps1xmlContent = Get-Content -Path $ps1xmlFile.FullName -Raw - $ps1xmlContent += "`n" # Add an empty line at the end - } + Log-Message "[EntraModuleBuilder] Appending formmatting content from file: $($ps1xmlFile.Name)" -ForegroundColor Cyan + $ps1xmlContent = Get-Content -Path $ps1xmlFile.FullName -Raw $ps1xmlFilePath = Join-Path -Path $destDirectory -ChildPath $ps1xmlFile.Name Log-Message "[EntraModuleBuilder] Writing .ps1xml file to disk: $ps1xmlFilePath" - Set-Content -Path $ps1xmlFilePath -Value $ps1xmlContent + + # Use UTF-8 with BOM for PowerShell 5.1 compatibility + $utf8WithBom = New-Object System.Text.UTF8Encoding($true) + [System.IO.File]::WriteAllText($ps1xmlFilePath, $ps1xmlContent, $utf8WithBom) Log-Message "[EntraModuleBuilder] Module Formating file created: $ps1xmlFilePath" -Level 'SUCCESS' } + } if ($ps1Files.Count -eq 0) { Log-Message "[EntraModuleBuilder] Warning: No .ps1 files found in directory $currentDirPath" -Level 'ERROR' @@ -387,6 +387,7 @@ foreach (`$subModule in `$subModules) { PowerShellVersion = $([System.Version]::Parse($content.powershellVersion)) CompatiblePSEditions = @('Desktop', 'Core') NestedModules = @() + ScriptsToProcess = @("../build/FormattingFile-Init.ps1") } if ($null -ne $content.Prerelease) { @@ -563,7 +564,7 @@ $($requiredModulesEntries -join ",`n") CompatiblePSEditions = @('Desktop', 'Core') RequiredModules = $requiredModules NestedModules = @() - FormatsToProcess = $formattingFiles + ScriptsToProcess = @("../build/FormattingFile-Init.ps1") } From 71664121cb95454aaf82678f27207757b039c26b Mon Sep 17 00:00:00 2001 From: Derrick Butoyi Date: Tue, 13 May 2025 17:24:00 +0300 Subject: [PATCH 14/14] remove trailing code --- src/EntraModuleBuilder.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/EntraModuleBuilder.ps1 b/src/EntraModuleBuilder.ps1 index bba13cb25c..02f36f0f27 100644 --- a/src/EntraModuleBuilder.ps1 +++ b/src/EntraModuleBuilder.ps1 @@ -387,7 +387,6 @@ foreach (`$subModule in `$subModules) { PowerShellVersion = $([System.Version]::Parse($content.powershellVersion)) CompatiblePSEditions = @('Desktop', 'Core') NestedModules = @() - ScriptsToProcess = @("../build/FormattingFile-Init.ps1") } if ($null -ne $content.Prerelease) { @@ -564,7 +563,7 @@ $($requiredModulesEntries -join ",`n") CompatiblePSEditions = @('Desktop', 'Core') RequiredModules = $requiredModules NestedModules = @() - ScriptsToProcess = @("../build/FormattingFile-Init.ps1") + FormatsToProcess = $formattingFiles }