diff --git a/.azure-pipelines/1es-entra-powershell-ci-build.yml b/.azure-pipelines/1es-entra-powershell-ci-build.yml index fa72ad1d8..20001ad6a 100644 --- a/.azure-pipelines/1es-entra-powershell-ci-build.yml +++ b/.azure-pipelines/1es-entra-powershell-ci-build.yml @@ -42,7 +42,7 @@ extends: - template: .azure-pipelines/common-templates/install-tools.yml@self - template: .azure-pipelines/common-templates/security-pre-checks.yml@self - - template: .azure-pipelines/generation-templates/generate_adapter-migrate-1es.yml@self + - template: .azure-pipelines/generation-templates/generate_adapter-1es.yml@self parameters: Sign: ${{ parameters.Sign }} diff --git a/.azure-pipelines/generation-templates/generate_adapter-migrate-1es.yml b/.azure-pipelines/generation-templates/generate_adapter-1es.yml similarity index 73% rename from .azure-pipelines/generation-templates/generate_adapter-migrate-1es.yml rename to .azure-pipelines/generation-templates/generate_adapter-1es.yml index dfa002b8a..51680a631 100644 --- a/.azure-pipelines/generation-templates/generate_adapter-migrate-1es.yml +++ b/.azure-pipelines/generation-templates/generate_adapter-1es.yml @@ -16,26 +16,26 @@ steps: inputs: targetType: inline script: 'echo $PSVersionTable' - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Set maximum function count' inputs: targetType: inline script: '$MaximumFunctionCount=32768' - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Install Dependencies Entra' inputs: targetType: inline script: | ./build/Install-Dependencies.ps1 -ModuleName Entra -Verbose - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Install PlatyPS' inputs: targetType: inline script: Install-Module PlatyPS -scope currentuser -Force - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Create Module Help Files Entra' inputs: @@ -44,13 +44,21 @@ steps: Import-Module PlatyPS . ./build/common-functions.ps1 Create-ModuleHelp -Module Entra - pwsh: false + pwsh: true +# - task: powershell@2 +# displayName: 'Build Entra' +# inputs: +# targetType: inline +# script: ./build/Create-CompatModule.ps1 -Module Entra -Verbose +# pwsh: true - task: powershell@2 - displayName: 'Build Entra' + displayName: '[Modularization ] Build Entra' inputs: targetType: inline - script: ./build/Create-CompatModule.ps1 -Module Entra -Verbose - pwsh: false + script: | + ./build/Create-EntraModule.ps1 -Module Entra -Verbose + ./build/Create-EntraModule.ps1 -Module Entra -Root -Verbose + pwsh: true - ${{ if eq(parameters.Sign, true) }}: - template: ../common-templates/esrp/codesign-migrate.yml parameters: @@ -61,11 +69,7 @@ steps: inputs: targetType: "inline" pwsh: true - script: | - $ModulePsd1 = "bin/Microsoft.Graph.Entra.psd1" - $ModulePsm1 = "bin/Microsoft.Graph.Entra.psm1" - ($ModulePsd1 | Get-AuthenticodeSignature).Status | Should -Be "Valid" - ($ModulePsm1 | Get-AuthenticodeSignature).Status | Should -Be "Valid" + script: ./build/ValidateAuthenticodeSignature.ps1 - task: powershell@2 displayName: 'Create Module Files Entra' inputs: @@ -73,7 +77,7 @@ steps: script: | . ./build/common-functions.ps1 Create-ModuleFolder - pwsh: false + pwsh: true - task: 1ES.PublishBuildArtifacts@1 displayName: 'Publish Module Files EntraBeta' inputs: @@ -86,13 +90,13 @@ steps: script: | . ./build/common-functions.ps1 Register-LocalGallery -Path $(Build.ArtifactStagingDirectory) - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Publish to Local Gallery Entra' inputs: targetType: inline script: ./build/Publish-LocalCompatModule.ps1 -Install - pwsh: false + pwsh: true - task: 1ES.PublishBuildArtifacts@1 displayName: 'Publish Module Nuget File Entra' inputs: @@ -105,14 +109,14 @@ steps: script: | . ./build/common-functions.ps1 Remove-BuildDirectories - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Install Dependencies EntraBeta' inputs: targetType: inline script: | ./build/Install-Dependencies.ps1 -ModuleName EntraBeta -Verbose - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Create Module Help Files EntraBeta' inputs: @@ -121,15 +125,23 @@ steps: Import-Module PlatyPS . ./build/common-functions.ps1 Create-ModuleHelp -Module EntraBeta - pwsh: false + pwsh: true +# - task: powershell@2 +# displayName: 'Build EntraBeta' +# inputs: +# targetType: inline +# script: | +# $MaximumFunctionCount=32768 +# ./build/Create-CompatModule.ps1 -Module EntraBeta -Verbose +# pwsh: true - task: powershell@2 - displayName: 'Build EntraBeta' + displayName: '[Modularization ] Build EntraBeta' inputs: targetType: inline script: | - $MaximumFunctionCount=32768 - ./build/Create-CompatModule.ps1 -Module EntraBeta -Verbose - pwsh: false + ./build/Create-EntraModule.ps1 -Module EntraBeta -Verbose + ./build/Create-EntraModule.ps1 -Module EntraBeta -Root -Verbose + pwsh: true - ${{ if eq(parameters.Sign, true) }}: - template: ../common-templates/esrp/codesign-migrate.yml parameters: @@ -140,11 +152,7 @@ steps: inputs: targetType: "inline" pwsh: true - script: | - $ModulePsd1 = "bin/Microsoft.Graph.Entra.Beta.psd1" - $ModulePsm1 = "bin/Microsoft.Graph.Entra.Beta.psm1" - ($ModulePsd1 | Get-AuthenticodeSignature).Status | Should -Be "Valid" - ($ModulePsm1 | Get-AuthenticodeSignature).Status | Should -Be "Valid" + script: ./build/ValidateAuthenticodeSignature.ps1 - task: powershell@2 displayName: 'Create Module Files EntraBeta' inputs: @@ -152,7 +160,7 @@ steps: script: | . ./build/common-functions.ps1 Create-ModuleFolder - pwsh: false + pwsh: true - task: 1ES.PublishBuildArtifacts@1 displayName: 'Publish Module Files EntraBeta' inputs: @@ -163,7 +171,7 @@ steps: inputs: targetType: inline script: ./build/Publish-LocalCompatModule.ps1 -Install - pwsh: false + pwsh: true - task: 1ES.PublishBuildArtifacts@1 displayName: 'Publish Module Nuget File EntraBeta' inputs: @@ -176,20 +184,46 @@ steps: script: | . ./build/common-functions.ps1 Remove-BuildDirectories - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Install Pester' inputs: targetType: inline script: Install-Module Pester -scope currentuser -SkipPublisherCheck -Force - pwsh: false + pwsh: true +# - task: powershell@2 +# displayName: 'Run tests Entra' +# inputs: +# targetType: inline +# pwsh: true +# script: | +# cd test/module/entra +# Invoke-Pester -OutputFile "./test/results/pester-test-results-ad.xml" -OutputFormat NUnitXml +# - task: PublishTestResults@2 +# inputs: +# testResultsFormat: NUnit +# testResultsFiles: "./test/results/pester-test-results-ad.xml" +# failTaskOnFailedTests: true +# - task: powershell@2 +# displayName: 'Run tests EntraBeta' +# inputs: +# targetType: inline +# pwsh: true +# script: | +# cd test/module/entrabeta +# Invoke-Pester -OutputFile "./test/results/pester-test-results-preview.xml" -OutputFormat NUnitXml +# - task: PublishTestResults@2 +# inputs: +# testResultsFormat: NUnit +# testResultsFiles: "./test/results/pester-test-results-preview.xml" +# failTaskOnFailedTests: true - task: powershell@2 - displayName: 'Run tests Entra' + displayName: '[Modularization] Run tests Entra' inputs: targetType: inline pwsh: true script: | - cd test/module/entra + cd testVNext/Entra Invoke-Pester -OutputFile "./test/results/pester-test-results-ad.xml" -OutputFormat NUnitXml - task: PublishTestResults@2 inputs: @@ -197,17 +231,17 @@ steps: testResultsFiles: "./test/results/pester-test-results-ad.xml" failTaskOnFailedTests: true - task: powershell@2 - displayName: 'Run tests EntraBeta' + displayName: '[Modularization] Run tests Entra Beta' inputs: targetType: inline pwsh: true script: | - cd test/module/entrabeta - Invoke-Pester -OutputFile "./test/results/pester-test-results-preview.xml" -OutputFormat NUnitXml + cd testVNext/EntraBeta + Invoke-Pester -OutputFile "./test/results/pester-test-results-ad.xml" -OutputFormat NUnitXml - task: PublishTestResults@2 inputs: testResultsFormat: NUnit - testResultsFiles: "./test/results/pester-test-results-preview.xml" + testResultsFiles: "./test/results/pester-test-results-ad.xml" failTaskOnFailedTests: true - ${{ if eq(parameters.Integration, true) }}: - task: powershell@2 @@ -243,7 +277,7 @@ steps: script: | . ./build/common-functions.ps1 Unregister-LocalGallery - pwsh: false + pwsh: true - task: PSScriptAnalyzer@1 displayName: 'Run PSScriptAnalyzer' inputs: diff --git a/.azure-pipelines/generation-templates/generate_adapter.yml b/.azure-pipelines/generation-templates/generate_adapter.yml index 30567ca17..0cc75ef8a 100644 --- a/.azure-pipelines/generation-templates/generate_adapter.yml +++ b/.azure-pipelines/generation-templates/generate_adapter.yml @@ -16,26 +16,26 @@ steps: inputs: targetType: inline script: 'echo $PSVersionTable' - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Set maximum function count' inputs: targetType: inline script: '$MaximumFunctionCount=32768' - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Install Dependencies Entra' inputs: targetType: inline script: | ./build/Install-Dependencies.ps1 -ModuleName Entra -Verbose - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Install PlatyPS' inputs: targetType: inline script: Install-Module PlatyPS -scope currentuser -Force - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Create Module Help Files Entra' inputs: @@ -44,13 +44,23 @@ steps: Import-Module PlatyPS . ./build/common-functions.ps1 Create-ModuleHelp -Module Entra - pwsh: false + pwsh: true +# - task: powershell@2 +# displayName: 'Build Entra' +# inputs: +# targetType: inline +# script: | +# $MaximumFunctionCount=32768 +# ./build/Create-CompatModule.ps1 -Module Entra -Verbose +# pwsh: true - task: powershell@2 - displayName: 'Build Entra' + displayName: '[Modularization ] Build Entra' inputs: targetType: inline - script: ./build/Create-CompatModule.ps1 -Module Entra -Verbose - pwsh: false + script: | + ./build/Create-EntraModule.ps1 -Module Entra -Verbose + ./build/Create-EntraModule.ps1 -Module Entra -Root -Verbose + pwsh: true - ${{ if eq(parameters.Sign, true) }}: - template: ../common-templates/esrp/codesign.yml parameters: @@ -73,7 +83,7 @@ steps: script: | . ./build/common-functions.ps1 Create-ModuleFolder - pwsh: false + pwsh: true - task: PublishBuildArtifacts@1 displayName: 'Publish Module Files Entra' inputs: @@ -86,13 +96,13 @@ steps: script: | . ./build/common-functions.ps1 Register-LocalGallery -Path $(Build.ArtifactStagingDirectory) - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Publish to Local Gallery Entra' inputs: targetType: inline script: ./build/Publish-LocalCompatModule.ps1 -Install - pwsh: false + pwsh: true - task: PublishBuildArtifacts@1 displayName: 'Publish Module Nuget File Entra' inputs: @@ -105,14 +115,14 @@ steps: script: | . ./build/common-functions.ps1 Remove-BuildDirectories - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Install Dependencies EntraBeta' inputs: targetType: inline script: | ./build/Install-Dependencies.ps1 -ModuleName EntraBeta -Verbose - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Create Module Help Files EntraBeta' inputs: @@ -121,15 +131,23 @@ steps: Import-Module PlatyPS . ./build/common-functions.ps1 Create-ModuleHelp -Module EntraBeta - pwsh: false + pwsh: true +# - task: powershell@2 +# displayName: 'Build EntraBeta' +# inputs: +# targetType: inline +# script: | +# $MaximumFunctionCount=32768 +# ./build/Create-CompatModule.ps1 -Module EntraBeta -Verbose +# pwsh: true - task: powershell@2 - displayName: 'Build EntraBeta' + displayName: '[Modularization ] Build EntraBeta' inputs: targetType: inline script: | - $MaximumFunctionCount=32768 - ./build/Create-CompatModule.ps1 -Module EntraBeta -Verbose - pwsh: false + ./build/Create-EntraModule.ps1 -Module EntraBeta -Verbose + ./build/Create-EntraModule.ps1 -Module EntraBeta -Root -Verbose + pwsh: true - ${{ if eq(parameters.Sign, true) }}: - template: ../common-templates/esrp/codesign.yml parameters: @@ -152,7 +170,7 @@ steps: script: | . ./build/common-functions.ps1 Create-ModuleFolder - pwsh: false + pwsh: true - task: PublishBuildArtifacts@1 displayName: 'Publish Module Files EntraBeta' inputs: @@ -163,7 +181,7 @@ steps: inputs: targetType: inline script: ./build/Publish-LocalCompatModule.ps1 -Install - pwsh: false + pwsh: true - task: PublishBuildArtifacts@1 displayName: 'Publish Module Nuget File EntraBeta' inputs: @@ -176,20 +194,46 @@ steps: script: | . ./build/common-functions.ps1 Remove-BuildDirectories - pwsh: false + pwsh: true - task: powershell@2 displayName: 'Install Pester' inputs: targetType: inline script: Install-Module Pester -scope currentuser -SkipPublisherCheck -Force - pwsh: false + pwsh: true +# - task: powershell@2 +# displayName: 'Run tests Entra' +# inputs: +# targetType: inline +# pwsh: true +# script: | +# cd test/module/entra +# Invoke-Pester -OutputFile "./test/results/pester-test-results-ad.xml" -OutputFormat NUnitXml +# - task: PublishTestResults@2 +# inputs: +# testResultsFormat: NUnit +# testResultsFiles: "./test/results/pester-test-results-ad.xml" +# failTaskOnFailedTests: true +# - task: powershell@2 +# displayName: 'Run tests EntraBeta' +# inputs: +# targetType: inline +# pwsh: true +# script: | +# cd test/module/entrabeta +# Invoke-Pester -OutputFile "./test/results/pester-test-results-preview.xml" -OutputFormat NUnitXml +# - task: PublishTestResults@2 +# inputs: +# testResultsFormat: NUnit +# testResultsFiles: "./test/results/pester-test-results-preview.xml" +# failTaskOnFailedTests: true - task: powershell@2 - displayName: 'Run tests Entra' + displayName: '[Modularization] Run tests Entra' inputs: targetType: inline pwsh: true script: | - cd test/module/entra + cd testVNext/Entra Invoke-Pester -OutputFile "./test/results/pester-test-results-ad.xml" -OutputFormat NUnitXml - task: PublishTestResults@2 inputs: @@ -197,17 +241,17 @@ steps: testResultsFiles: "./test/results/pester-test-results-ad.xml" failTaskOnFailedTests: true - task: powershell@2 - displayName: 'Run tests EntraBeta' + displayName: '[Modularization] Run tests Entra Beta' inputs: targetType: inline pwsh: true script: | - cd test/module/entrabeta - Invoke-Pester -OutputFile "./test/results/pester-test-results-preview.xml" -OutputFormat NUnitXml + cd testVNext/EntraBeta + Invoke-Pester -OutputFile "./test/results/pester-test-results-ad.xml" -OutputFormat NUnitXml - task: PublishTestResults@2 inputs: testResultsFormat: NUnit - testResultsFiles: "./test/results/pester-test-results-preview.xml" + testResultsFiles: "./test/results/pester-test-results-ad.xml" failTaskOnFailedTests: true - ${{ if eq(parameters.Integration, true) }}: - task: powershell@2 @@ -243,7 +287,7 @@ steps: script: | . ./build/common-functions.ps1 Unregister-LocalGallery - pwsh: false + pwsh: true - task: PSScriptAnalyzer@1 displayName: 'Run PSScriptAnalyzer' inputs: diff --git a/1 b/1 new file mode 100644 index 000000000..ec635144f --- /dev/null +++ b/1 @@ -0,0 +1 @@ +9 diff --git a/build/Publish-LocalCompatModule.ps1 b/build/Publish-LocalCompatModule.ps1 index 023851a7c..89a28e690 100644 --- a/build/Publish-LocalCompatModule.ps1 +++ b/build/Publish-LocalCompatModule.ps1 @@ -10,18 +10,29 @@ param( . "$psscriptroot/common-functions.ps1" -$modulePath = Join-Path (Get-ModuleBasePath) (Get-ConfigValue -Name ModuleOutputSubdirectoryName) -$modulePath = Join-Path $modulePath (Get-ModuleName) -$fullModuleName = Get-ModuleName -if($fullModuleName -eq 'Microsoft.Graph.Entra'){ - $moduleName = 'Entra' +$fullModuleNames = @() +$modName = Get-ModuleName + +if($modName -is [array]){ + $fullModuleName = $modName[0] + $fullModuleNames = $modName } else{ + $fullModuleName = $modName + $fullModuleNames += $modName +} + +if($fullModuleName -like 'Microsoft.Graph.Entra.Beta*'){ $moduleName = 'EntraBeta' } +else{ + $moduleName = 'Entra' +} $settingPath = "$PSScriptRoot/../module/$ModuleName/config/ModuleSettings.json" $content = Get-Content -Path $settingPath | ConvertFrom-Json +$metadataPath = "$PSScriptRoot/../module/$ModuleName/config/ModuleMetadata.json" +$metadata = Get-Content -Path $metadataPath | ConvertFrom-Json if($moduleName -eq 'Entra'){ Publish-Module -Name Microsoft.Graph.Authentication -RequiredVersion $content.destinationModuleVersion -Repository (Get-LocalPSRepoName) @@ -32,8 +43,37 @@ foreach ($destinationModuleName in $content.destinationModuleName){ Publish-Module -Name $destinationModuleName -RequiredVersion $content.destinationModuleVersion -Repository (Get-LocalPSRepoName) } -Publish-Module -Path $modulePath -Repository (Get-LocalPSRepoName) +foreach($module in $fullModuleNames){ + if(($module -eq 'Microsoft.Graph.Entra') -or ($module -eq 'Microsoft.Graph.Entra.Beta')){ + continue + } + $modulePath = Join-Path (Get-ModuleBasePath) (Get-ConfigValue -Name ModuleOutputSubdirectoryName) + $modulePath = Join-Path $modulePath $module + Log-Message "[Publish Local Compat] module : $module" -Level 'INFO' + Log-Message "[Publish Local Compat] modulePath : $modulePath" -Level 'INFO' + Publish-Module -Path $modulePath -Repository (Get-LocalPSRepoName) + + if ($Install) { + Log-Message "[Publish Local Compat] Installing : $module" -Level 'INFO' + Install-Module -Name $module -Repository (Get-LocalPSRepoName) -AllowClobber + } +} + +if($moduleName -eq 'Entra'){ + $module = 'Microsoft.Graph.Entra' +} +else{ + $module = 'Microsoft.Graph.Entra.Beta' +} + +$modulePath = Join-Path (Get-ModuleBasePath) (Get-ConfigValue -Name ModuleOutputSubdirectoryName) +$modulePath = Join-Path $modulePath $module +$modulePath = Join-Path $modulePath $metadata.version +Log-Message "[Publish Local Compat] module : $module" -Level 'INFO' +Log-Message "[Publish Local Compat] modulePath : $modulePath" -Level 'INFO' +Publish-PSResource -Path $modulePath -Repository (Get-LocalPSRepoName) -SkipDependenciesCheck if ($Install) { - Install-Module -Name (Get-ModuleName) -Repository (Get-LocalPSRepoName) -AllowClobber -} \ No newline at end of file + Log-Message "[Publish Local Compat] Installing : $module" -Level 'INFO' + Install-Module -Name $module -Repository (Get-LocalPSRepoName) -AllowClobber +} diff --git a/build/ValidateAuthenticodeSignature.ps1 b/build/ValidateAuthenticodeSignature.ps1 new file mode 100644 index 000000000..3904e0c5e --- /dev/null +++ b/build/ValidateAuthenticodeSignature.ps1 @@ -0,0 +1,21 @@ + +# [cmdletbinding()] +# param ( +# [string]$Module = "Entra" +# ) + +. "$psscriptroot/common-functions.ps1" + +$moduleNames = Get-ModuleName + +foreach($moduleName in $moduleNames){ + $modulePath = Join-Path (Get-ModuleBasePath) $moduleName + $modulePsd1 = $modulePath + ".psd1" + ($modulePsd1 | Get-AuthenticodeSignature).Status | Should -Be "Valid" + + if(($moduleName -eq 'Microsoft.Graph.Entra') -or ($moduleName -eq 'Microsoft.Graph.Entra.Beta')){ + continue + } + $modulePsm1 = $modulePath + ".psm1" + ($modulePsm1 | Get-AuthenticodeSignature).Status | Should -Be "Valid" +} \ No newline at end of file diff --git a/build/common-functions.ps1 b/build/common-functions.ps1 index c49af9d75..398820289 100644 --- a/build/common-functions.ps1 +++ b/build/common-functions.ps1 @@ -28,11 +28,13 @@ function Get-ModuleBasePath { } function Get-ModuleVersion { - (Get-ModuleManifestFile).FullName | Test-ModuleManifest | Select-Object -ExpandProperty Version + # Added -ErrorAction SilentlyContinue due to validation failure on Microsoft.Graph.Entra RequiredModules + # The RequiredModules are the Microsoft.Graph.Entra.* sub-modules + (Get-ModuleManifestFile).FullName | Test-ModuleManifest -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Version } function Get-ModuleFiles { - (Get-ModuleManifestFile).FullName | Test-ModuleManifest | Select-Object -ExpandProperty FileList + (Get-ModuleManifestFile).FullName | Test-ModuleManifest -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FileList } function Get-PSGalleryRepoName { @@ -82,10 +84,12 @@ function Register-LocalGallery { } $null = Register-PSRepository -Name (Get-LocalPSRepoName) -SourceLocation ($repoPath) -ScriptSourceLocation ($repoPath) -InstallationPolicy Trusted + $null = Register-PSResourceRepository -Name (Get-LocalPSRepoName) -Uri ($repoPath) } function Unregister-LocalGallery { $null = Unregister-PSRepository (Get-LocalPSRepoName) + $null = Unregister-PSResourceRepository (Get-LocalPSRepoName) } function Update-ModuleVersion { @@ -136,40 +140,67 @@ function Create-ModuleFolder { $null = Remove-Item -Recurse -Force $modulesDirectory } - $thisModuleDirectory = Join-Path $modulesDirectory (Get-ModuleName) - $targetDirectory = Join-Path $thisModuleDirectory (Get-ModuleVersion).tostring() + $modules = @() + $moduleName = Get-ModuleName + $moduleVersion = Get-ModuleVersion + if($moduleVersion -is [array]) + { + $moduleVersion = $moduleVersion[0] + } - $null = New-Item -Path $targetDirectory -ItemType Directory + if($moduleName -isnot [array]){ + $modules += $moduleName + } + else{ + $modules = $moduleName + } - $ignorableSegmentCount = ((Get-ModuleBasePath).replace("`\", '/') -split '/').count - $sourceFileList = @() - $destinationFileList = @() - Get-ModuleFiles | ForEach-Object { - $normalizedFile = $_.replace("`\", '/') - $segments = $normalizedFile -split '/' - $relativeSegments = $segments[$ignorableSegmentCount..($segments.length - 1)] - $relativePath = $relativeSegments -join '/' + foreach($module in $modules){ + $thisModuleDirectory = Join-Path $modulesDirectory $module + $targetDirectory = Join-Path $thisModuleDirectory $moduleVersion.tostring() - $sourceFileList += Join-Path (Get-ModuleBasePath) $relativePath - $destinationFileList += Join-Path $targetDirectory $relativePath - } + $null = New-Item -Path $targetDirectory -ItemType Directory + + $ignorableSegmentCount = ((Get-ModuleBasePath).replace("`\", '/') -split '/').count + $sourceFileList = @() + $destinationFileList = @() + $moduleFiles = @() - 0..($sourceFileList.length - 1) | ForEach-Object { - $parent = Split-Path -Parent $destinationFileList[ $_ ] - if ( -not (Test-Path $parent) ) { - $null = New-Item -Path $parent -ItemType Directory + if(($module -eq 'Microsoft.Graph.Entra') -or ($module -eq 'Microsoft.Graph.Entra.Beta')){ + $moduleFiles += Get-ModuleFiles | Where { $_ -like "*$module.psd1" } + $moduleFiles += Get-ModuleFiles | Where { $_ -like "*$module.psm1" } + } + else{ + $moduleFiles += Get-ModuleFiles | Where { $_ -like "*$module*" } } - $destinationName = Split-Path -Leaf $destinationFileList[ $_ ] - $syntaxOnlySourceName = Split-Path -Leaf $sourceFileList[ $_ ] - $sourceActualName = (Get-ChildItem (Split-Path -Parent $sourceFileList[ $_ ]) -Filter $syntaxOnlySourceName).name + $moduleFiles | ForEach-Object { + $normalizedFile = $_.replace("`\", '/') + $segments = $normalizedFile -split '/' + $relativeSegments = $segments[$ignorableSegmentCount..($segments.length - 1)] + $relativePath = $relativeSegments -join '/' - if ( $destinationName -cne $sourceActualName ) { - throw "The case-sensitive name of the file at source path '$($sourceFileList[$_])' is actually '$sourceActualName' and it does not match the case of the last element of destination path '$($destinationFileList[$_])' -- the case of the file names must match exactly in order to support environments with case-sensitive file systems. This can be corrected in the module manifest by specifying the case of the file exactly as it exists in the module source code directory" + $sourceFileList += Join-Path (Get-ModuleBasePath) $relativePath + $destinationFileList += Join-Path $targetDirectory $relativePath } - Copy-Item $sourceFileList[ $_ ] $destinationFileList[ $_ ] + 0..($sourceFileList.length - 1) | ForEach-Object { + $parent = Split-Path -Parent $destinationFileList[ $_ ] + if ( -not (Test-Path $parent) ) { + $null = New-Item -Path $parent -ItemType Directory + } + + $destinationName = Split-Path -Leaf $destinationFileList[ $_ ] + $syntaxOnlySourceName = Split-Path -Leaf $sourceFileList[ $_ ] + $sourceActualName = (Get-ChildItem (Split-Path -Parent $sourceFileList[ $_ ]) -Filter $syntaxOnlySourceName).name + + if ( $destinationName -cne $sourceActualName ) { + throw "The case-sensitive name of the file at source path '$($sourceFileList[$_])' is actually '$sourceActualName' and it does not match the case of the last element of destination path '$($destinationFileList[$_])' -- the case of the file names must match exactly in order to support environments with case-sensitive file systems. This can be corrected in the module manifest by specifying the case of the file exactly as it exists in the module source code directory" + } + + Copy-Item $sourceFileList[ $_ ] $destinationFileList[ $_ ] + } } } diff --git a/module/Entra/config/ModuleSettings.json b/module/Entra/config/ModuleSettings.json index b82808b53..6863871d5 100644 --- a/module/Entra/config/ModuleSettings.json +++ b/module/Entra/config/ModuleSettings.json @@ -4,7 +4,6 @@ "newPrefix" : "Entra", "typePrefix" : "Microsoft.Open.", "destinationModuleName" : [ - "Microsoft.Graph", "Microsoft.Graph.DirectoryObjects", "Microsoft.Graph.Users", "Microsoft.Graph.Users.Actions", diff --git a/module/EntraBeta/config/ModuleSettings.json b/module/EntraBeta/config/ModuleSettings.json index 46572adaf..16ef03892 100644 --- a/module/EntraBeta/config/ModuleSettings.json +++ b/module/EntraBeta/config/ModuleSettings.json @@ -4,7 +4,6 @@ "newPrefix" : "EntraBeta", "typePrefix" : "Microsoft.Open.", "destinationModuleName" : [ - "Microsoft.Graph.Beta", "Microsoft.Graph.Beta.DirectoryObjects", "Microsoft.Graph.Beta.Users", "Microsoft.Graph.Beta.Users.Actions", diff --git a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Applications/New-EntraBetaCustomHeaders.ps1 b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Applications/New-EntraBetaCustomHeaders.ps1 index 16c1e3b34..b4eea56ed 100644 --- a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Applications/New-EntraBetaCustomHeaders.ps1 +++ b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Applications/New-EntraBetaCustomHeaders.ps1 @@ -19,7 +19,7 @@ function New-EntraBetaCustomHeaders { ) $psVersion = $global:PSVersionTable.PSVersion - $entraVersion = (Get-module Microsoft.Graph.Entra.Beta | select version).Version.ToString() + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.Applications | select version).Version.ToString() $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion $Command" $customHeaders = New-Object 'system.collections.generic.dictionary[string,string]' $customHeaders["User-Agent"] = $userAgentHeaderValue diff --git a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Authentication/New-EntraBetaCustomHeaders.ps1 b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Authentication/New-EntraBetaCustomHeaders.ps1 index 16c1e3b34..81f47023e 100644 --- a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Authentication/New-EntraBetaCustomHeaders.ps1 +++ b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Authentication/New-EntraBetaCustomHeaders.ps1 @@ -19,7 +19,7 @@ function New-EntraBetaCustomHeaders { ) $psVersion = $global:PSVersionTable.PSVersion - $entraVersion = (Get-module Microsoft.Graph.Entra.Beta | select version).Version.ToString() + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.Authentication | select version).Version.ToString() $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion $Command" $customHeaders = New-Object 'system.collections.generic.dictionary[string,string]' $customHeaders["User-Agent"] = $userAgentHeaderValue diff --git a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/DirectoryManagement/New-EntraBetaCustomHeaders.ps1 b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/DirectoryManagement/New-EntraBetaCustomHeaders.ps1 index 16c1e3b34..13c5cca04 100644 --- a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/DirectoryManagement/New-EntraBetaCustomHeaders.ps1 +++ b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/DirectoryManagement/New-EntraBetaCustomHeaders.ps1 @@ -19,7 +19,7 @@ function New-EntraBetaCustomHeaders { ) $psVersion = $global:PSVersionTable.PSVersion - $entraVersion = (Get-module Microsoft.Graph.Entra.Beta | select version).Version.ToString() + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.DirectoryManagement | select version).Version.ToString() $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion $Command" $customHeaders = New-Object 'system.collections.generic.dictionary[string,string]' $customHeaders["User-Agent"] = $userAgentHeaderValue diff --git a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Governance/New-EntraBetaCustomHeaders.ps1 b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Governance/New-EntraBetaCustomHeaders.ps1 index 16c1e3b34..153948c90 100644 --- a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Governance/New-EntraBetaCustomHeaders.ps1 +++ b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Governance/New-EntraBetaCustomHeaders.ps1 @@ -19,7 +19,7 @@ function New-EntraBetaCustomHeaders { ) $psVersion = $global:PSVersionTable.PSVersion - $entraVersion = (Get-module Microsoft.Graph.Entra.Beta | select version).Version.ToString() + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.Governance | select version).Version.ToString() $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion $Command" $customHeaders = New-Object 'system.collections.generic.dictionary[string,string]' $customHeaders["User-Agent"] = $userAgentHeaderValue diff --git a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Groups/New-EntraBetaCustomHeaders.ps1 b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Groups/New-EntraBetaCustomHeaders.ps1 index 16c1e3b34..ac596542b 100644 --- a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Groups/New-EntraBetaCustomHeaders.ps1 +++ b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Groups/New-EntraBetaCustomHeaders.ps1 @@ -19,7 +19,7 @@ function New-EntraBetaCustomHeaders { ) $psVersion = $global:PSVersionTable.PSVersion - $entraVersion = (Get-module Microsoft.Graph.Entra.Beta | select version).Version.ToString() + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.Groups | select version).Version.ToString() $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion $Command" $customHeaders = New-Object 'system.collections.generic.dictionary[string,string]' $customHeaders["User-Agent"] = $userAgentHeaderValue diff --git a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/NetworkAccess/New-EntraBetaCustomHeaders.ps1 b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/NetworkAccess/New-EntraBetaCustomHeaders.ps1 index 16c1e3b34..dfff098b9 100644 --- a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/NetworkAccess/New-EntraBetaCustomHeaders.ps1 +++ b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/NetworkAccess/New-EntraBetaCustomHeaders.ps1 @@ -19,7 +19,7 @@ function New-EntraBetaCustomHeaders { ) $psVersion = $global:PSVersionTable.PSVersion - $entraVersion = (Get-module Microsoft.Graph.Entra.Beta | select version).Version.ToString() + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.NetworkAccess | select version).Version.ToString() $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion $Command" $customHeaders = New-Object 'system.collections.generic.dictionary[string,string]' $customHeaders["User-Agent"] = $userAgentHeaderValue diff --git a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Reports/New-EntraBetaCustomHeaders.ps1 b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Reports/New-EntraBetaCustomHeaders.ps1 index 16c1e3b34..cfa34c26e 100644 --- a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Reports/New-EntraBetaCustomHeaders.ps1 +++ b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Reports/New-EntraBetaCustomHeaders.ps1 @@ -19,7 +19,7 @@ function New-EntraBetaCustomHeaders { ) $psVersion = $global:PSVersionTable.PSVersion - $entraVersion = (Get-module Microsoft.Graph.Entra.Beta | select version).Version.ToString() + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.Reports | select version).Version.ToString() $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion $Command" $customHeaders = New-Object 'system.collections.generic.dictionary[string,string]' $customHeaders["User-Agent"] = $userAgentHeaderValue diff --git a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/SignIns/New-EntraBetaCustomHeaders.ps1 b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/SignIns/New-EntraBetaCustomHeaders.ps1 index 16c1e3b34..4ffe59371 100644 --- a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/SignIns/New-EntraBetaCustomHeaders.ps1 +++ b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/SignIns/New-EntraBetaCustomHeaders.ps1 @@ -19,7 +19,7 @@ function New-EntraBetaCustomHeaders { ) $psVersion = $global:PSVersionTable.PSVersion - $entraVersion = (Get-module Microsoft.Graph.Entra.Beta | select version).Version.ToString() + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.SignIns | select version).Version.ToString() $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion $Command" $customHeaders = New-Object 'system.collections.generic.dictionary[string,string]' $customHeaders["User-Agent"] = $userAgentHeaderValue diff --git a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/New-EntraBetaCustomHeaders.ps1 b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/New-EntraBetaCustomHeaders.ps1 index 16c1e3b34..b403d3a71 100644 --- a/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/New-EntraBetaCustomHeaders.ps1 +++ b/moduleVNext/EntraBeta/Microsoft.Graph.Entra.Beta/Users/New-EntraBetaCustomHeaders.ps1 @@ -19,7 +19,7 @@ function New-EntraBetaCustomHeaders { ) $psVersion = $global:PSVersionTable.PSVersion - $entraVersion = (Get-module Microsoft.Graph.Entra.Beta | select version).Version.ToString() + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.Users | select version).Version.ToString() $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion $Command" $customHeaders = New-Object 'system.collections.generic.dictionary[string,string]' $customHeaders["User-Agent"] = $userAgentHeaderValue diff --git a/src/EntraModuleBuilder.ps1 b/src/EntraModuleBuilder.ps1 index b3fdd5006..51a6f86fa 100644 --- a/src/EntraModuleBuilder.ps1 +++ b/src/EntraModuleBuilder.ps1 @@ -451,13 +451,13 @@ $($requiredModulesEntries -join ",`n") $manifestPath = Join-Path $this.OutputDirectory "$manifestFileName" # Check if the specified directory exists - if (-Not (Test-Path -Path $subDir)) { + if (-Not (Test-Path -Path $subDir.FullName)) { Log-Message "[EntraModuleBuilder]: The specified directory does not exist: $subDir" -Level 'ERROR' exit } # Get all files in the specified directory and its subdirectories, without extensions - $allFunctions = Get-ChildItem -Path $subDir -Recurse -File | ForEach-Object { $_.BaseName } + $allFunctions = Get-ChildItem -Path $subDir.FullName -Recurse -File | ForEach-Object { $_.BaseName } $functions = $allFunctions + "Enable-EntraAzureADAlias" + "Get-EntraUnsupportedCommand" @@ -509,7 +509,7 @@ $($requiredModulesEntries -join ",`n") # Create and update the module manifest Log-Message "[EntraModuleBuilder]: Creating manifest for $moduleName at $manifestPath" try{ - New-ModuleManifest @moduleSettings + New-ModuleManifest @moduleSettings Update-ModuleManifest -Path $manifestPath -PrivateData $PSData # Validate the module manifest @@ -551,10 +551,12 @@ $($requiredModulesEntries -join ",`n") $docsPath = $this.BaseDocsPath if ($Module -eq "Entra") { $docsPath = Join-Path -Path $this.BaseDocsPath -ChildPath "entra-powershell-v1.0" - } elseif ($Module -eq "EntraBeta") { + } + elseif ($Module -eq "EntraBeta") { $docsPath = Join-Path -Path $this.BaseDocsPath -ChildPath "entra-powershell-beta" - } else { - Log-Message "[EntraModuleBuilder] CreateModuleHelp:Invalid module specified: $Module" -Level 'ERROR' + } + else { + Log-Message "[EntraModuleBuilder] CreateModuleHelp:Invalid module specified: $Module" -Level 'ERROR' return } @@ -568,6 +570,7 @@ $($requiredModulesEntries -join ",`n") # Get all subdirectories within the base docs path $subDirectories = Get-ChildItem -Path $docsPath -Directory + foreach ($subDirectory in $subDirectories) { # Skip the 'Migration' sub-directory if ($subDirectory.Name -eq 'Migration' -or $subDirectory.Name -eq 'Invitations') { @@ -575,29 +578,25 @@ $($requiredModulesEntries -join ",`n") continue } - Log-Message "[EntraModuleBuilder] CreateModuleHelp:Creating help file for $subDirectory.." + Log-Message "[EntraModuleBuilder] CreateModuleHelp:Creating help file for $subDirectory.." # Get all markdown files in the current subdirectory $markDownFiles = Get-ChildItem -Path $subDirectory.FullName -Filter "*.md" - # Check if markdown files are found if (-not($markDownFiles)) { Log-Message "[EntraModuleBuilder] CreateModuleHelp:No markdown files found in $($subDirectory.FullName)." -Level 'ERROR' continue } - # Generate the help file name based on the module and sub-directory - $subDirectoryName = [System.IO.Path]::GetFileName($subDirectory.FullName) - $helpFileName = if ($Module -eq "Entra") { - "Microsoft.Graph.Entra.$subDirectoryName-Help.xml" + "Microsoft.Graph.Entra.$($subDirectory.Name)-Help.xml" } else { - "Microsoft.Graph.Entra.Beta.$subDirectoryName-Help.xml" + "Microsoft.Graph.Entra.Beta.$($subDirectory.Name)-Help.xml" } $helpOutputFilePath = Join-Path -Path $this.OutputDirectory -ChildPath $helpFileName - $moduleDocsPath = $subDirectory + $moduleDocsPath = $subDirectory.FullName try { # Create the help file using PlatyPS diff --git a/testVNext/Common-Functions.ps1 b/testVNext/Common-Functions.ps1 new file mode 100644 index 000000000..2c5f6ee76 --- /dev/null +++ b/testVNext/Common-Functions.ps1 @@ -0,0 +1,83 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ + +$psVersion = $global:PSVersionTable.PSVersion + +# Entra + +if($null -ne (Get-Module -Name Microsoft.Graph.Entra)){ + $entraVersion = (Get-module Microsoft.Graph.Entra | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Applications)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Applications | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Authentication)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Authentication | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.DirectoryManagement | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Governance)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Governance | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Users)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Users | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Groups)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Groups | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Reports)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Reports | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.SignIns)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.SignIns | select version).Version.ToString() +} + +#EntraBeta + +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Beta)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Beta.Applications)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.Applications | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Beta.Authentication)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.Authentication | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.DirectoryManagement | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Beta.Governance)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.Governance | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Beta.Users)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.Users | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Beta.Groups)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.Groups | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Beta.Reports)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.Reports | select version).Version.ToString() +} +if($null -ne (Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns)){ + $entraVersion = (Get-module Microsoft.Graph.Entra.Beta.SignIns | select version).Version.ToString() +} + + +function Get-Parameters{ + param( + $data + ) + + PROCESS{ + $params = @{} + for ($i = 0; $i -lt $data.Length; $i += 2) { + $key = $data[$i] -replace '-', '' -replace ':', '' + $value = $data[$i + 1] + $params[$key] = $value + } + + $params + } +} \ No newline at end of file diff --git a/testVNext/Entra/Applications/Add-EntraApplicationOwner.Tests.ps1 b/testVNext/Entra/Applications/Add-EntraApplicationOwner.Tests.ps1 index b3016636e..ba116e9a8 100644 --- a/testVNext/Entra/Applications/Add-EntraApplicationOwner.Tests.ps1 +++ b/testVNext/Entra/Applications/Add-EntraApplicationOwner.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName New-MgApplicationOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgApplicationOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Add-EntraApplicationOwner" { @@ -16,13 +16,13 @@ Describe "Add-EntraApplicationOwner" { $result = Add-EntraApplicationOwner -ApplicationId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName New-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when parameters are empty" { { Add-EntraApplicationOwner -ApplicationId "" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter*" } It "Should contain ApplicationId in parameters when passed ApplicationId to it" { - Mock -CommandName New-MgApplicationOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgApplicationOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Add-EntraApplicationOwner -ApplicationId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result @@ -32,7 +32,7 @@ Describe "Add-EntraApplicationOwner" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraApplicationOwner" Add-EntraApplicationOwner -ApplicationId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraApplicationOwner" - Should -Invoke -CommandName New-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Add-EntraServicePrincipalDelegatedPermissionClassification.Tests.ps1 b/testVNext/Entra/Applications/Add-EntraServicePrincipalDelegatedPermissionClassification.Tests.ps1 index 39925b7cf..de61d03e6 100644 --- a/testVNext/Entra/Applications/Add-EntraServicePrincipalDelegatedPermissionClassification.Tests.ps1 +++ b/testVNext/Entra/Applications/Add-EntraServicePrincipalDelegatedPermissionClassification.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking New-MgServicePrincipalDelegatedPermissionClassification with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -21,7 +21,7 @@ BeforeAll { ) } - Mock -CommandName New-MgServicePrincipalDelegatedPermissionClassification -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgServicePrincipalDelegatedPermissionClassification -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Add-EntraServicePrincipalDelegatedPermissionClassification"{ Context "Test for Add-EntraServicePrincipalDelegatedPermissionClassification" { @@ -33,7 +33,7 @@ Describe "Add-EntraServicePrincipalDelegatedPermissionClassification"{ $result.Classification | should -Be "low" $result.PermissionName | should -Be "access_microsoftstream_embed" - Should -Invoke -CommandName New-MgServicePrincipalDelegatedPermissionClassification -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgServicePrincipalDelegatedPermissionClassification -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Result should Contain ObjectId" { $result = Add-EntraServicePrincipalDelegatedPermissionClassification -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PermissionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Classification "low" -PermissionName "access_microsoftstream_embed" @@ -47,7 +47,7 @@ Describe "Add-EntraServicePrincipalDelegatedPermissionClassification"{ $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraServicePrincipalDelegatedPermissionClassification" - Should -Invoke -CommandName New-MgServicePrincipalDelegatedPermissionClassification -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgServicePrincipalDelegatedPermissionClassification -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Add-EntraServicePrincipalOwner.Tests.ps1 b/testVNext/Entra/Applications/Add-EntraServicePrincipalOwner.Tests.ps1 index 3a2dd0ed6..7f08bc7ef 100644 --- a/testVNext/Entra/Applications/Add-EntraServicePrincipalOwner.Tests.ps1 +++ b/testVNext/Entra/Applications/Add-EntraServicePrincipalOwner.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName New-MgServicePrincipalOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgServicePrincipalOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Add-EntraServicePrincipalOwner" { @@ -16,13 +16,13 @@ Describe "Add-EntraServicePrincipalOwner" { $result = Add-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName New-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should update the parameter with Alias" { $result = Add-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName New-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is empty" { { Add-EntraServicePrincipalOwner -ServicePrincipalId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" @@ -37,7 +37,7 @@ Describe "Add-EntraServicePrincipalOwner" { { Add-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." } It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { - Mock -CommandName New-MgServicePrincipalOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgServicePrincipalOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Add-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result @@ -46,7 +46,7 @@ Describe "Add-EntraServicePrincipalOwner" { It "Should contain BodyParameter in parameters when passed RefObjectId to it" { Add-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $value = @{"@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/bbbbbbbb-1111-2222-3333-cccccccccccc"} - Should -Invoke -CommandName New-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $BodyParameter.AdditionalProperties.'@odata.id' | Should -Be $value.'@odata.id' Write-Host $BodyParameter.AdditionalProperties.'@odata.id' $true @@ -59,7 +59,7 @@ Describe "Add-EntraServicePrincipalOwner" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraServicePrincipalOwner" - Should -Invoke -CommandName New-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Entra.Tests.ps1 b/testVNext/Entra/Applications/Entra.Tests.ps1 deleted file mode 100644 index e6b0c3179..000000000 --- a/testVNext/Entra/Applications/Entra.Tests.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. -# ------------------------------------------------------------------------------ - -if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module .\bin\Microsoft.Graph.Entra.psd1 -Force -} - -Import-Module Pester - -$psmPath = (Get-Module Microsoft.Graph.Entra).Path -$testReportPath = join-path $psscriptroot "..\..\..\TestReport\Entra" -$mockScriptsPath = join-path $psscriptroot "..\..\..\test\module\Entra\*.Tests.ps1" - -$testOutputFile = "$testReportPath\TestResults.xml" -if (!(test-path -path $testReportPath)) {new-item -path $testReportPath -itemtype directory} - -$mockScripts = Get-ChildItem -Path $mockScriptsPath -Exclude "Entra.Tests.ps1" | ForEach-Object { $_.FullName } - -$config = New-PesterConfiguration -$config.Run.Path = $mockScripts -$config.Run.PassThru = $true -$config.Run.Exit = $true -$config.CodeCoverage.Enabled = $true -$config.CodeCoverage.CoveragePercentTarget = 100 -$config.CodeCoverage.Path = $psmPath -$config.TestResult.Enabled = $true -$config.TestResult.OutputPath = $testOutputFile -$config.Output.Verbosity = "Detailed" - -Invoke-Pester -Configuration $config \ No newline at end of file diff --git a/testVNext/Entra/Applications/Get-EntraApplication.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraApplication.Tests.ps1 index bebd63819..7558c2a29 100644 --- a/testVNext/Entra/Applications/Get-EntraApplication.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraApplication.Tests.ps1 @@ -3,10 +3,10 @@ # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null) { + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1" ) -Force $scriptblock = { return @( @@ -31,7 +31,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgApplication -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgApplication -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraApplication" { @@ -41,7 +41,7 @@ Describe "Get-EntraApplication" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('bbbbbbbb-1111-2222-3333-cccccccccccc') - Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ApplicationId is invalid" { { Get-EntraApplication -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." @@ -53,7 +53,7 @@ Describe "Get-EntraApplication" { $result = Get-EntraApplication -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when All has an argument" { { Get-EntraApplication -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" @@ -75,21 +75,21 @@ Describe "Get-EntraApplication" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Mock-App' - Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should return specific application by filter" { $result = Get-EntraApplication -Filter "DisplayName -eq 'Mock-App'" $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Mock-App' - Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should return top application" { $result = @(Get-EntraApplication -Top 1) $result | Should -Not -BeNullOrEmpty $result | Should -HaveCount 1 - Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Result should Contain ApplicationId" { $result = Get-EntraApplication -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" @@ -113,7 +113,7 @@ Describe "Get-EntraApplication" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplication" - Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } @@ -123,7 +123,7 @@ Describe "Get-EntraApplication" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock-App' - Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when Property is empty" { { Get-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -147,7 +147,7 @@ Describe "Get-EntraApplication" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('bbbbbbbb-1111-2222-3333-cccccccccccc') - Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } } } diff --git a/testVNext/Entra/Applications/Get-EntraApplicationExtensionProperty.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraApplicationExtensionProperty.Tests.ps1 index 7627d7baf..b4bff3d66 100644 --- a/testVNext/Entra/Applications/Get-EntraApplicationExtensionProperty.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraApplicationExtensionProperty.Tests.ps1 @@ -3,10 +3,10 @@ # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Get-EntraApplicationExtensionProperty with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -19,7 +19,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgApplicationExtensionProperty -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgApplicationExtensionProperty -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraApplicationExtensionProperty" { @@ -28,13 +28,13 @@ BeforeAll { $result = Get-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should execute successfully with Alias" { $result = Get-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ApplicationId is empty" { { Get-EntraApplicationExtensionProperty -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." @@ -53,7 +53,7 @@ BeforeAll { $result | Should -Not -BeNullOrEmpty $result.Name | Should -Be 'extension_222_324_NewAttribute' - Should -Invoke -CommandName Get-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when Property is empty" { { Get-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -66,7 +66,7 @@ BeforeAll { $result = Get-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplicationExtensionProperty" - Should -Invoke -CommandName Get-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Get-EntraApplicationKeyCredential.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraApplicationKeyCredential.Tests.ps1 index 7bc3c922f..2ca78d0fd 100644 --- a/testVNext/Entra/Applications/Get-EntraApplicationKeyCredential.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraApplicationKeyCredential.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { @{ @@ -24,7 +24,7 @@ BeforeAll { } } - Mock -CommandName Get-MgApplication -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgApplication -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraApplicationKeyCredential" { @@ -32,7 +32,7 @@ BeforeAll { It "Should not return empty" { $result = Get-EntraApplicationKeyCredential -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ObjectId is empty" { { Get-EntraApplicationKeyCredential -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." @@ -42,7 +42,7 @@ BeforeAll { $result = Get-EntraApplicationKeyCredential -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplicationKeyCredential" - Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Get-EntraApplicationLogo.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraApplicationLogo.Tests.ps1 index 509f3a016..e3d1825f6 100644 --- a/testVNext/Entra/Applications/Get-EntraApplicationLogo.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraApplicationLogo.Tests.ps1 @@ -3,10 +3,10 @@ # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { @{ @@ -18,19 +18,19 @@ BeforeAll { } } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraApplicationLogo" { It "Should return empty" { $result = Get-EntraApplicationLogo -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -FilePath "D:\image.jpg" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should return empty" { $result = Get-EntraApplicationLogo -ObjectId "aaaaaaaa-1111-2222-3333-ccccccccccc" -FilePath "D:\image.jpg" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should return empty when passed ileName parameter" { $result = Get-EntraApplicationLogo -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -FileName "image" @@ -59,7 +59,7 @@ Describe "Get-EntraApplicationLogo" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplicationLogo" Get-EntraApplicationLogo -ApplicationId "aaaaaaaa-1111-2222-3333-ccccccccccc" -FilePath "D:\image.jpg" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplicationLogo" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Get-EntraApplicationOwner.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraApplicationOwner.Tests.ps1 index d1a82d07b..97b32204d 100644 --- a/testVNext/Entra/Applications/Get-EntraApplicationOwner.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraApplicationOwner.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $mockResponse = { return @{ @@ -26,7 +26,7 @@ BeforeAll { } } - Mock -CommandName Invoke-GraphRequest -MockWith $mockResponse -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $mockResponse -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraApplicationOwner"{ @@ -37,7 +37,7 @@ Describe "Get-EntraApplicationOwner"{ $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb') - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ApplicationId is empty" { { Get-EntraApplicationOwner -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." @@ -64,7 +64,7 @@ Describe "Get-EntraApplicationOwner"{ $result = Get-EntraApplicationOwner -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplicationOwner" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Get-EntraApplicationPasswordCredential.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraApplicationPasswordCredential.Tests.ps1 index 77aac893c..af3980845 100644 --- a/testVNext/Entra/Applications/Get-EntraApplicationPasswordCredential.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraApplicationPasswordCredential.Tests.ps1 @@ -1,8 +1,8 @@ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { @{ @@ -21,7 +21,7 @@ BeforeAll { } } - Mock -CommandName Get-MgApplication -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgApplication -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraApplicationPasswordCredential" { @@ -29,7 +29,7 @@ BeforeAll { It "Should not return empty" { $result = Get-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ApplicationId is empty" { { Get-EntraApplicationPasswordCredential -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId'*" @@ -45,7 +45,7 @@ BeforeAll { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be "Test" - Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when Property is empty" { @@ -57,7 +57,7 @@ BeforeAll { $result = Get-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraApplicationPasswordCredential" - Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Get-EntraApplicationTemplate.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraApplicationTemplate.Tests.ps1 index 0322de771..fb26e2a76 100644 --- a/testVNext/Entra/Applications/Get-EntraApplicationTemplate.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraApplicationTemplate.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll{ - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null) { + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $response = @{ "id" = "aaaaaaaa-1111-2222-3333-cccccccccccc" @@ -19,14 +19,14 @@ BeforeAll{ "supportedProvisioningTypes" = @{} } - Mock -CommandName Invoke-GraphRequest -MockWith { $response } -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith { $response } -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraApplicationTemplate tests"{ It "Should return specific application" { $result = Get-EntraApplicationTemplate -Id "aaaaaaaa-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('aaaaaaaa-1111-2222-3333-cccccccccccc') - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when Id is empty" { { Get-EntraApplicationTemplate -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id'*" @@ -40,7 +40,7 @@ Describe "Get-EntraApplicationTemplate tests"{ It "Should return all application templates" { $result = Get-EntraApplicationTemplate $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should execute successfully without throwing an error " { # Disable confirmation prompts @@ -58,7 +58,7 @@ Describe "Get-EntraApplicationTemplate tests"{ It "Should return top ApplicationTemplate" { $result = Get-EntraApplicationTemplate -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when Top is invalid" { { Get-EntraApplicationTemplate -Id "aaaaaaaa-1111-2222-3333-cccccccccccc" -Top XY } | Should -Throw "Cannot process argument transformation on parameter 'Top'*" @@ -66,7 +66,7 @@ Describe "Get-EntraApplicationTemplate tests"{ It "Should return all templates" { $result = Get-EntraApplicationTemplate -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when All has an argument" { { Get-EntraApplicationTemplate -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" @@ -82,7 +82,7 @@ Describe "Get-EntraApplicationTemplate tests"{ $result = Get-EntraApplicationTemplate -Filter "DisplayName eq 'test name'" $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'test name' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } } diff --git a/testVNext/Entra/Applications/Get-EntraDeletedApplication.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraDeletedApplication.Tests.ps1 index 673bd64db..ae9e470f9 100644 --- a/testVNext/Entra/Applications/Get-EntraDeletedApplication.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraDeletedApplication.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -48,7 +48,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgDirectoryDeletedItemAsApplication -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDirectoryDeletedItemAsApplication -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraDeletedApplication" { @@ -56,7 +56,7 @@ Describe "Get-EntraDeletedApplication" { It "Should return all applications" { $result = Get-EntraDeletedApplication | ConvertTo-Json -Depth 5 | ConvertFrom-Json $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when All is empty" { { Get-EntraDeletedApplication -All $true} | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" @@ -69,20 +69,20 @@ Describe "Get-EntraDeletedApplication" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Mock-test-App' - Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should return specific application by filter" { $result = Get-EntraDeletedApplication -Filter "DisplayName -eq 'Mock-test-App'" | ConvertTo-Json -Depth 5 | ConvertFrom-Json $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Mock-test-App' - Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should return top application" { $result = Get-EntraDeletedApplication -Top 1 | ConvertTo-Json -Depth 5 | ConvertFrom-Json $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Result should Contain ObjectId" { $result = Get-EntraDeletedApplication -Filter "DisplayName -eq 'Mock-test-App'" | ConvertTo-Json -Depth 5 | ConvertFrom-Json @@ -98,7 +98,7 @@ Describe "Get-EntraDeletedApplication" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be "Mock-test-App" - Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when Property is empty" { @@ -109,7 +109,7 @@ Describe "Get-EntraDeletedApplication" { $result = Get-EntraDeletedApplication -Filter "DisplayName -eq 'Mock-test-App'" | ConvertTo-Json -Depth 5 | ConvertFrom-Json $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeletedApplication" - Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Get-EntraServicePrincipal.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraServicePrincipal.Tests.ps1 index cdd98a2c7..ac6584cda 100644 --- a/testVNext/Entra/Applications/Get-EntraServicePrincipal.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraServicePrincipal.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -71,7 +71,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgServicePrincipal -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgServicePrincipal -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraServicePrincipal" { @@ -81,7 +81,7 @@ Describe "Get-EntraServicePrincipal" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should execute successfully with Alias" { @@ -89,7 +89,7 @@ Describe "Get-EntraServicePrincipal" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is empty" { @@ -104,7 +104,7 @@ Describe "Get-EntraServicePrincipal" { $result = Get-EntraServicePrincipal -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when All has an argument" { @@ -115,7 +115,7 @@ Describe "Get-EntraServicePrincipal" { $result = Get-EntraServicePrincipal -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when top is empty" { @@ -136,7 +136,7 @@ Describe "Get-EntraServicePrincipal" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Windows Update for Business Deployment Service' - Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when searchstring is empty" { @@ -148,7 +148,7 @@ Describe "Get-EntraServicePrincipal" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Windows Update for Business Deployment Service' - Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when filter is empty" { @@ -177,7 +177,7 @@ Describe "Get-EntraServicePrincipal" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be "Windows Update for Business Deployment Service" - Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when Property is empty" { @@ -191,7 +191,7 @@ Describe "Get-EntraServicePrincipal" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipal" - Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Get-EntraServicePrincipalAppRoleAssignedTo.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraServicePrincipalAppRoleAssignedTo.Tests.ps1 index 8d52263bf..b32fcd41a 100644 --- a/testVNext/Entra/Applications/Get-EntraServicePrincipalAppRoleAssignedTo.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraServicePrincipalAppRoleAssignedTo.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Get-EntraServicePrincipalAppRoleAssignedTo with parameters: $($args | ConvertTo-Json -Depth 3)" diff --git a/testVNext/Entra/Applications/Get-EntraServicePrincipalAppRoleAssignment.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraServicePrincipalAppRoleAssignment.Tests.ps1 index 4c282ea15..3cfbb77a6 100644 --- a/testVNext/Entra/Applications/Get-EntraServicePrincipalAppRoleAssignment.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraServicePrincipalAppRoleAssignment.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Get-EntraServicePrincipalAppRoleAssignment with parameters: $($args | ConvertTo-Json -Depth 3)" diff --git a/testVNext/Entra/Applications/Get-EntraServicePrincipalDelegatedPermissionClassification.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraServicePrincipalDelegatedPermissionClassification.Tests.ps1 index 3812741e2..8dd8285fe 100644 --- a/testVNext/Entra/Applications/Get-EntraServicePrincipalDelegatedPermissionClassification.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraServicePrincipalDelegatedPermissionClassification.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null) { + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -19,7 +19,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgServicePrincipalDelegatedPermissionClassification -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgServicePrincipalDelegatedPermissionClassification -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraServicePrincipalDelegatedPermissionClassification" { @@ -29,7 +29,7 @@ Describe "Get-EntraServicePrincipalDelegatedPermissionClassification" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be "T2qU_E28O0GgkLLIYRPsTwE" - Should -Invoke -CommandName Get-MgServicePrincipalDelegatedPermissionClassification -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalDelegatedPermissionClassification -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is invalid" { { Get-EntraServicePrincipalDelegatedPermissionClassification -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string.*" @@ -61,7 +61,7 @@ Describe "Get-EntraServicePrincipalDelegatedPermissionClassification" { $result | Should -Not -BeNullOrEmpty $result.PermissionName | Should -Be 'LicenseManager.AccessAsUser' - Should -Invoke -CommandName Get-MgServicePrincipalDelegatedPermissionClassification -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalDelegatedPermissionClassification -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when Property is empty" { { Get-EntraServicePrincipalDelegatedPermissionClassification -ServicePrincipalId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -74,7 +74,7 @@ Describe "Get-EntraServicePrincipalDelegatedPermissionClassification" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalDelegatedPermissionClassification" - Should -Invoke -CommandName Get-MgServicePrincipalDelegatedPermissionClassification -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgServicePrincipalDelegatedPermissionClassification -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Get-EntraServicePrincipalKeyCredential.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraServicePrincipalKeyCredential.Tests.ps1 index 43596da51..44fba45b5 100644 --- a/testVNext/Entra/Applications/Get-EntraServicePrincipalKeyCredential.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraServicePrincipalKeyCredential.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -25,7 +25,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgServicePrincipal -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgServicePrincipal -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraServicePrincipalKeyCredential" { @@ -36,7 +36,7 @@ Describe "Get-EntraServicePrincipalKeyCredential" { $result | Should -Not -BeNullOrEmpty $result.KeyId | Should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" - Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should update the parameter with Alias" { @@ -45,7 +45,7 @@ Describe "Get-EntraServicePrincipalKeyCredential" { $result | Should -Not -BeNullOrEmpty $result.KeyId | Should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" - Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is empty" { $errorActionPreference = "Stop" @@ -72,7 +72,7 @@ Describe "Get-EntraServicePrincipalKeyCredential" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalKeyCredential" - Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Get-EntraServicePrincipalMembership.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraServicePrincipalMembership.Tests.ps1 index 0fd4ef549..732c95b70 100644 --- a/testVNext/Entra/Applications/Get-EntraServicePrincipalMembership.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraServicePrincipalMembership.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -17,18 +17,18 @@ BeforeAll { ) } - Mock -CommandName Get-MgServicePrincipalTransitiveMemberOf -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgServicePrincipalTransitiveMemberOf -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraServicePrincipalMembership"{ It "Result should not be empty" { $result = Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should update the parameter with Alias" { $result = Get-EntraServicePrincipalMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is empty" { { Get-EntraServicePrincipalMembership -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string." @@ -36,7 +36,7 @@ Describe "Get-EntraServicePrincipalMembership"{ It "Should return all applications" { $result = Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when All has an argument" { { Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true} | Should -Throw "A positional parameter cannot be found that accepts argument 'True'." @@ -44,7 +44,7 @@ Describe "Get-EntraServicePrincipalMembership"{ It "Should return top application" { $result = Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Result should Contain ServicePrincipalId" { $result = Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" @@ -60,7 +60,7 @@ Describe "Get-EntraServicePrincipalMembership"{ $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when Property is empty" { { Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -70,7 +70,7 @@ Describe "Get-EntraServicePrincipalMembership"{ $result = Get-EntraServicePrincipalMembership -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalMembership" - Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgServicePrincipalTransitiveMemberOf -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Get-EntraServicePrincipalOAuth2PermissionGrant.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraServicePrincipalOAuth2PermissionGrant.Tests.ps1 index e322ea7a8..89ac33a01 100644 --- a/testVNext/Entra/Applications/Get-EntraServicePrincipalOAuth2PermissionGrant.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraServicePrincipalOAuth2PermissionGrant.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -21,18 +21,18 @@ BeforeAll { ) } - Mock -CommandName Get-MgServicePrincipalOauth2PermissionGrant -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgServicePrincipalOauth2PermissionGrant -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraServicePrincipalOAuth2PermissionGrant"{ It "Result should not be empty" { $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should update the parameter with Alias" { $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is empty" { { Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string." @@ -40,7 +40,7 @@ Describe "Get-EntraServicePrincipalOAuth2PermissionGrant"{ It "Should return all applications" { $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when All has an argument" { { Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true} | Should -Throw "A positional parameter cannot be found that accepts argument 'True'." @@ -48,7 +48,7 @@ Describe "Get-EntraServicePrincipalOAuth2PermissionGrant"{ It "Should return top application" { $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Result should Contain ServicePrincipalId" { $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" @@ -64,7 +64,7 @@ Describe "Get-EntraServicePrincipalOAuth2PermissionGrant"{ $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be 'aaaaaaaa-0b0b-1c1c-2d2d-333333333333' - Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when Property is empty" { { Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -74,7 +74,7 @@ Describe "Get-EntraServicePrincipalOAuth2PermissionGrant"{ $result = Get-EntraServicePrincipalOAuth2PermissionGrant -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalOAuth2PermissionGrant" - Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgServicePrincipalOauth2PermissionGrant -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Get-EntraServicePrincipalOwnedObject.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraServicePrincipalOwnedObject.Tests.ps1 index 4ef2ec18d..0668c7984 100644 --- a/testVNext/Entra/Applications/Get-EntraServicePrincipalOwnedObject.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraServicePrincipalOwnedObject.Tests.ps1 @@ -3,10 +3,10 @@ # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -23,7 +23,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgServicePrincipalOwnedObject -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgServicePrincipalOwnedObject -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraServicePrincipalOwnedObject" { @@ -32,13 +32,13 @@ Describe "Get-EntraServicePrincipalOwnedObject" { $result = Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "2d028fff-7e65-4340-80ca-89be16dae0b3" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('111cc9b5-fce9-485e-9566-c68debafac5f') - Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should return specific ServicePrincipalOwnedObject with Alias" { $result = Get-EntraServicePrincipalOwnedObject -ObjectId "2d028fff-7e65-4340-80ca-89be16dae0b3" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('111cc9b5-fce9-485e-9566-c68debafac5f') - Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is empty" { { Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId'*" @@ -49,7 +49,7 @@ Describe "Get-EntraServicePrincipalOwnedObject" { It "Should return all Owned Objects" { $result = Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "2d028fff-7e65-4340-80ca-89be16dae0b3" -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when All has an argument" { { Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "2d028fff-7e65-4340-80ca-89be16dae0b3" -All $true } | Should -Throw "A positional parameter cannot be found that accepts argument 'True'.*" @@ -57,7 +57,7 @@ Describe "Get-EntraServicePrincipalOwnedObject" { It "Should return top Owned Object" { $result = Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "2d028fff-7e65-4340-80ca-89be16dae0b3" -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Result should Contain ServicePrincipalId" { $result = Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "2d028fff-7e65-4340-80ca-89be16dae0b3" @@ -74,7 +74,7 @@ Describe "Get-EntraServicePrincipalOwnedObject" { $result = Get-EntraServicePrincipalOwnedObject -ServicePrincipalId "2d028fff-7e65-4340-80ca-89be16dae0b3" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalOwnedObject" - Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgServicePrincipalOwnedObject -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Get-EntraServicePrincipalOwner.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraServicePrincipalOwner.Tests.ps1 index 63fa52513..a59e92908 100644 --- a/testVNext/Entra/Applications/Get-EntraServicePrincipalOwner.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraServicePrincipalOwner.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -41,18 +41,18 @@ BeforeAll { ) } - Mock -CommandName Get-MgServicePrincipalOwner -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgServicePrincipalOwner -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraServicePrincipalOwner"{ It "Result should not be empty" { $result = Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should update the parameter with Alias" { $result = Get-EntraServicePrincipalOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is empty" { { Get-EntraServicePrincipalOwner -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string." @@ -60,7 +60,7 @@ Describe "Get-EntraServicePrincipalOwner"{ It "Should return all applications" { $result = Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when All has an argument" { { Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $true} | Should -Throw "A positional parameter cannot be found that accepts argument 'True'." @@ -68,7 +68,7 @@ Describe "Get-EntraServicePrincipalOwner"{ It "Should return top application" { $result = Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Result should Contain ServicePrincipalId" { $result = Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" @@ -84,7 +84,7 @@ Describe "Get-EntraServicePrincipalOwner"{ $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Adams Smith' - Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when Property is empty" { { Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -94,7 +94,7 @@ Describe "Get-EntraServicePrincipalOwner"{ $result = Get-EntraServicePrincipalOwner -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalOwner" - Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgServicePrincipalOwner -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Get-EntraServicePrincipalPasswordCredential.Tests.ps1 b/testVNext/Entra/Applications/Get-EntraServicePrincipalPasswordCredential.Tests.ps1 index d4fea0294..c635adf91 100644 --- a/testVNext/Entra/Applications/Get-EntraServicePrincipalPasswordCredential.Tests.ps1 +++ b/testVNext/Entra/Applications/Get-EntraServicePrincipalPasswordCredential.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -27,7 +27,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgServicePrincipal -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgServicePrincipal -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Get-EntraServicePrincipalPasswordCredential" { @@ -38,7 +38,7 @@ Describe "Get-EntraServicePrincipalPasswordCredential" { $result | Should -Not -BeNullOrEmpty $result.KeyId | Should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" - Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should update the parameter with Alias" { @@ -47,7 +47,7 @@ Describe "Get-EntraServicePrincipalPasswordCredential" { $result | Should -Not -BeNullOrEmpty $result.KeyId | Should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" - Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is empty" { @@ -75,7 +75,7 @@ Describe "Get-EntraServicePrincipalPasswordCredential" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraServicePrincipalPasswordCredential" - Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Invalid.Tests.ps1 b/testVNext/Entra/Applications/Invalid.Tests.ps1 index 6d5381a10..ef75d9bb5 100644 --- a/testVNext/Entra/Applications/Invalid.Tests.ps1 +++ b/testVNext/Entra/Applications/Invalid.Tests.ps1 @@ -1,17 +1,17 @@ -if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module Microsoft.Graph.Entra +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Applications)){ + Import-Module Microsoft.Graph.Entra.Applications } Describe "Invalid Tests"{ It "Should fail when parameters are invalid"{ - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Applications $module.ExportedCommands.Keys | ForEach-Object{ $command = Get-Command $_ { Invoke-Command $command -demo "" } | Should -Throw "A parameter cannot be found that matches parameter name 'demo'." } } It "Should fail with 'TenantId' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Applications $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'TenantId'){ @@ -21,7 +21,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Id' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Applications $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Id'){ @@ -31,7 +31,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'ObjectId' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Applications $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'ObjectId'){ @@ -41,7 +41,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'All' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Applications $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'All'){ @@ -56,7 +56,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Top' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Applications $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Top'){ @@ -66,7 +66,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Filter' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Applications $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Filter'){ @@ -76,7 +76,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'SearchString' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Applications $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'SearchString'){ diff --git a/testVNext/Entra/Applications/Module.Tests.ps1 b/testVNext/Entra/Applications/Module.Tests.ps1 index cc40ad720..fb12f884f 100644 --- a/testVNext/Entra/Applications/Module.Tests.ps1 +++ b/testVNext/Entra/Applications/Module.Tests.ps1 @@ -2,39 +2,39 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ -Describe "Microsoft.Graph.Entra Module" { +Describe "Microsoft.Graph.Entra.Applications Module" { Context "On module import" { BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } } It "Should have exported commands" { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Applications $PSModuleInfo | Should -Not -BeNullOrEmpty $PSModuleInfo.ExportedFunctions.Count | Should -Not -Be 0 } It 'Should be compatible with PS core and desktop' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Applications $PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop") } It 'Should point to script module' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra - $PSModuleInfo.RootModule | Should -BeLikeExactly "*Microsoft.Graph.Entra.psm1" + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Applications + $PSModuleInfo.RootModule | Should -BeLikeExactly "*Microsoft.Graph.Entra.Applications.psm1" } It 'Should lock GUID' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Applications $PSModuleInfo.Guid | Should -Be "742dccd1-bf4b-46a0-a3f2-14e0bb508233" } It "Module import should not write to error and information streams" { $ps = [powershell]::Create() - $ps.AddScript("Import-Module Microsoft.Graph.Entra -ErrorAction SilentlyContinue").Invoke() + $ps.AddScript("Import-Module Microsoft.Graph.Entra.Applications -ErrorAction SilentlyContinue").Invoke() "Checking Information stream" | Out-Host $ps.Streams.Information.Count | Should -Be 0 "Checking Error stream" | Out-Host diff --git a/testVNext/Entra/Applications/New-EntraApplication.Tests.ps1 b/testVNext/Entra/Applications/New-EntraApplication.Tests.ps1 index cc3aa0337..ae7bbf963 100644 --- a/testVNext/Entra/Applications/New-EntraApplication.Tests.ps1 +++ b/testVNext/Entra/Applications/New-EntraApplication.Tests.ps1 @@ -3,10 +3,10 @@ # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -31,7 +31,7 @@ BeforeAll { ) } - Mock -CommandName New-MgApplication -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgApplication -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "New-EntraApplication"{ @@ -44,7 +44,7 @@ Describe "New-EntraApplication"{ $result.IsFallbackPublicClient | should -Be "True" $result.SignInAudience | should -Be "AzureADandPersonalMicrosoftAccount" - Should -Invoke -CommandName New-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when DisplayName is empty" { { New-EntraApplication -DisplayName "" } | Should -Throw "Cannot bind argument to parameter 'DisplayName' because it is an empty string." @@ -54,7 +54,7 @@ Describe "New-EntraApplication"{ $result = New-EntraApplication -DisplayName "Mock-App" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraApplication" - Should -Invoke -CommandName New-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/New-EntraApplicationExtensionProperty.Tests.ps1 b/testVNext/Entra/Applications/New-EntraApplicationExtensionProperty.Tests.ps1 index 882e1ecda..9f03f4d7d 100644 --- a/testVNext/Entra/Applications/New-EntraApplicationExtensionProperty.Tests.ps1 +++ b/testVNext/Entra/Applications/New-EntraApplicationExtensionProperty.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -24,7 +24,7 @@ BeforeAll { ) } - Mock -CommandName New-MgApplicationExtensionProperty -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgApplicationExtensionProperty -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "New-EntraApplicationExtensionProperty" { @@ -37,7 +37,7 @@ Context "Test for New-EntraApplicationExtensionProperty" { $result.TargetObjects | Should -Be "Application" $result.DataType | Should -Be "MockType" - Should -Invoke -CommandName New-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should return created MS application extension property with alias" { $result = New-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" @@ -47,7 +47,7 @@ Context "Test for New-EntraApplicationExtensionProperty" { $result.TargetObjects | Should -Be "Application" $result.DataType | Should -Be "MockType" - Should -Invoke -CommandName New-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ApplicationId is empty" { { New-EntraApplicationExtensionProperty -ApplicationId -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" @@ -78,7 +78,7 @@ Context "Test for New-EntraApplicationExtensionProperty" { $result = New-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -DataType "MockType" -Name "Mock-App" -TargetObjects "Application" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraApplicationExtensionProperty" - Should -Invoke -CommandName New-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/New-EntraApplicationFromApplicationTemplate.Tests.ps1 b/testVNext/Entra/Applications/New-EntraApplicationFromApplicationTemplate.Tests.ps1 index 8f4f77d4c..26a53d1a2 100644 --- a/testVNext/Entra/Applications/New-EntraApplicationFromApplicationTemplate.Tests.ps1 +++ b/testVNext/Entra/Applications/New-EntraApplicationFromApplicationTemplate.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll{ if ((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null) { Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $response = @{ "@odata.context" = 'https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.applicationServicePrincipal' diff --git a/testVNext/Entra/Applications/New-EntraApplicationPassword.Tests.ps1 b/testVNext/Entra/Applications/New-EntraApplicationPassword.Tests.ps1 index 7315d6480..082b6d426 100644 --- a/testVNext/Entra/Applications/New-EntraApplicationPassword.Tests.ps1 +++ b/testVNext/Entra/Applications/New-EntraApplicationPassword.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -22,7 +22,7 @@ BeforeAll { ) } - Mock -CommandName Add-MgApplicationPassword -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Add-MgApplicationPassword -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "New-EntraApplicationPassword"{ It "Should return created password credential"{ @@ -30,7 +30,7 @@ Describe "New-EntraApplicationPassword"{ $result | Should -Not -BeNullOrEmpty $result.KeyId | should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $result.SecretText | Should -Be "wbBNW8kCuiPjNRg9NX98W_EaU6cqG" - Should -Invoke -CommandName Add-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Add-MgApplicationPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ApplicationId is empty" { { New-EntraApplicationPassword -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId'*" @@ -69,7 +69,7 @@ Describe "New-EntraApplicationPassword"{ $result = New-EntraApplicationPassword -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PasswordCredential @{ displayname = "mypassword" } | ConvertTo-Json | ConvertFrom-Json $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraApplicationPassword" - Should -Invoke -CommandName Add-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Add-MgApplicationPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/New-EntraApplicationPasswordCredential.Tests.ps1 b/testVNext/Entra/Applications/New-EntraApplicationPasswordCredential.Tests.ps1 index ab3f1fd9b..7b2326471 100644 --- a/testVNext/Entra/Applications/New-EntraApplicationPasswordCredential.Tests.ps1 +++ b/testVNext/Entra/Applications/New-EntraApplicationPasswordCredential.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -22,7 +22,7 @@ BeforeAll { ) } - Mock -CommandName Add-MgApplicationPassword -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Add-MgApplicationPassword -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "New-EntraApplicationPasswordCredential"{ It "Should return created password credential"{ @@ -30,7 +30,7 @@ Describe "New-EntraApplicationPasswordCredential"{ $result | Should -Not -BeNullOrEmpty $result.KeyId | should -Be "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $result.SecretText | Should -Be "wbBNW8kCuiPjNRg9NX98W_EaU6cqG" - Should -Invoke -CommandName Add-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Add-MgApplicationPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ApplicationId is empty" { { New-EntraApplicationPasswordCredential -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId'*" @@ -75,7 +75,7 @@ Describe "New-EntraApplicationPasswordCredential"{ $result = New-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraApplicationPasswordCredential" - Should -Invoke -CommandName Add-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Add-MgApplicationPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/New-EntraServicePrincipal.Tests.ps1 b/testVNext/Entra/Applications/New-EntraServicePrincipal.Tests.ps1 index cca44e22a..187f44fd6 100644 --- a/testVNext/Entra/Applications/New-EntraServicePrincipal.Tests.ps1 +++ b/testVNext/Entra/Applications/New-EntraServicePrincipal.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking New-MgServicePrincipal with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -32,7 +32,7 @@ BeforeAll { ) } - Mock -CommandName New-MgServicePrincipal -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgServicePrincipal -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "New-EntraServicePrincipal"{ @@ -52,7 +52,7 @@ Describe "New-EntraServicePrincipal"{ $result.ServicePrincipalType | should -Be "Application" $result.ServicePrincipalNames | should -Be "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" - Should -Invoke -CommandName New-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when AppID is empty" { { New-EntraServicePrincipal -AppId } | Should -Throw "Missing an argument for parameter 'AppId'.*" @@ -98,7 +98,7 @@ Describe "New-EntraServicePrincipal"{ $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraServicePrincipal" - Should -Invoke -CommandName New-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/New-EntraServicePrincipalAppRoleAssignment.Tests.ps1 b/testVNext/Entra/Applications/New-EntraServicePrincipalAppRoleAssignment.Tests.ps1 index ee7b9c10e..e79970abe 100644 --- a/testVNext/Entra/Applications/New-EntraServicePrincipalAppRoleAssignment.Tests.ps1 +++ b/testVNext/Entra/Applications/New-EntraServicePrincipalAppRoleAssignment.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking New-MgServicePrincipalAppRoleAssignment with parameters: $($args | ConvertTo-Json -Depth 3)" diff --git a/testVNext/Entra/Applications/New-EntraServicePrincipalPasswordCredential.Tests.ps1 b/testVNext/Entra/Applications/New-EntraServicePrincipalPasswordCredential.Tests.ps1 index 00eb234c6..8574c00e0 100644 --- a/testVNext/Entra/Applications/New-EntraServicePrincipalPasswordCredential.Tests.ps1 +++ b/testVNext/Entra/Applications/New-EntraServicePrincipalPasswordCredential.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Add-MgServicePrincipalPassword with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -23,7 +23,7 @@ BeforeAll { ) } - Mock -CommandName Add-MgServicePrincipalPassword -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Add-MgServicePrincipalPassword -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "New-EntraServicePrincipalPasswordCredential"{ @@ -34,13 +34,13 @@ Describe "New-EntraServicePrincipalPasswordCredential"{ $result.StartDate | should -Be "16/09/2024 14:14:14" $result.EndDate | should -Be "16/12/2024 13:14:14" - Should -Invoke -CommandName Add-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Add-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should update the parameter with Alias" { $result = New-EntraServicePrincipalPasswordCredential -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -StartDate "2024-09-16T14:14:14Z" -EndDate "2024-12-16T13:14:14Z" $result | Should -Not -Be NullOrEmpty - Should -Invoke -CommandName Add-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Add-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is empty" { {New-EntraServicePrincipalPasswordCredential -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" @@ -73,7 +73,7 @@ Describe "New-EntraServicePrincipalPasswordCredential"{ $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraServicePrincipalPasswordCredential" - Should -Invoke -CommandName Add-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Add-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Remove-EntraApplication.Tests.ps1 b/testVNext/Entra/Applications/Remove-EntraApplication.Tests.ps1 index 2d0e78a18..3bd14690c 100644 --- a/testVNext/Entra/Applications/Remove-EntraApplication.Tests.ps1 +++ b/testVNext/Entra/Applications/Remove-EntraApplication.Tests.ps1 @@ -3,12 +3,12 @@ # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgApplication -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgApplication -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Remove-EntraApplication" { @@ -17,13 +17,13 @@ Describe "Remove-EntraApplication" { $result = Remove-EntraApplication -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should execute successfully with Alias" { $result = Remove-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ApplicationId is invalid" { { Remove-EntraApplication -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." @@ -32,7 +32,7 @@ Describe "Remove-EntraApplication" { { Remove-EntraApplication -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } It "Should contain ApplicationId in parameters when passed ApplicationId to it" { - Mock -CommandName Remove-MgApplication -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgApplication -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Remove-EntraApplication -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result @@ -42,7 +42,7 @@ Describe "Remove-EntraApplication" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraApplication" Remove-EntraApplication -ApplicationId bbbbbbbb-1111-2222-3333-cccccccccccc - Should -Invoke -CommandName Remove-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Remove-EntraApplicationExtensionProperty.Tests.ps1 b/testVNext/Entra/Applications/Remove-EntraApplicationExtensionProperty.Tests.ps1 index 6e6e9e216..5d7acf815 100644 --- a/testVNext/Entra/Applications/Remove-EntraApplicationExtensionProperty.Tests.ps1 +++ b/testVNext/Entra/Applications/Remove-EntraApplicationExtensionProperty.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module .\test\module\Common-Functions.ps1 -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgApplicationExtensionProperty -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgApplicationExtensionProperty -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Remove-EntraApplicationExtensionProperty" { @@ -16,13 +16,13 @@ Describe "Remove-EntraApplicationExtensionProperty" { $result = Remove-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should execute successfully with Alias" { $result = Remove-EntraApplicationExtensionProperty -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ApplicationId is empty" { { Remove-EntraApplicationExtensionProperty -ApplicationId -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444"} | Should -Throw "Missing an argument for parameter 'ApplicationId'*" @@ -37,7 +37,7 @@ Describe "Remove-EntraApplicationExtensionProperty" { { Remove-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId "" } | Should -Throw "Cannot bind argument to parameter 'ExtensionPropertyId' because it is an empty string." } It "Should contain ApplicationId in parameters when passed ApplicationId to it" { - Mock -CommandName Remove-MgApplicationExtensionProperty -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgApplicationExtensionProperty -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Remove-EntraApplicationExtensionProperty -ApplicationId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ExtensionPropertyId "00001111-aaaa-2222-bbbb-3333cccc4444" $params = Get-Parameters -data $result @@ -50,7 +50,7 @@ Describe "Remove-EntraApplicationExtensionProperty" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraApplicationExtensionProperty" - Should -Invoke -CommandName Remove-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgApplicationExtensionProperty -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Remove-EntraApplicationOwner.Tests.ps1 b/testVNext/Entra/Applications/Remove-EntraApplicationOwner.Tests.ps1 index 51461cbd9..680110fff 100644 --- a/testVNext/Entra/Applications/Remove-EntraApplicationOwner.Tests.ps1 +++ b/testVNext/Entra/Applications/Remove-EntraApplicationOwner.Tests.ps1 @@ -2,24 +2,24 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgApplicationOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgApplicationOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Remove-EntraApplicationOwner"{ It "Should return empty object" { $result = Remove-EntraApplicationOwner -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should return empty object" { $result = Remove-EntraApplicationOwner -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ApplicationId is empty" { { Remove-EntraApplicationOwner -ApplicationId "" } @@ -28,13 +28,13 @@ Describe "Remove-EntraApplicationOwner"{ { Remove-EntraApplicationOwner -OwnerId "" } } It "Should contain ApplicationId in parameters" { - Mock -CommandName Remove-MgApplicationOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgApplicationOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Remove-EntraApplicationOwner -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" $params = Get-Parameters -data $result $params.ApplicationId | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" } It "Should contain DirectoryObjectId in parameters" { - Mock -CommandName Remove-MgApplicationOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgApplicationOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Remove-EntraApplicationOwner -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" $params = Get-Parameters -data $result $params.DirectoryObjectId | Should -Be "bbbbbbbb-cccc-dddd-2222-333333333333" @@ -44,7 +44,7 @@ Describe "Remove-EntraApplicationOwner"{ $result = Remove-EntraApplicationOwner -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -OwnerId "bbbbbbbb-cccc-dddd-2222-333333333333" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraApplicationOwner" - Should -Invoke -CommandName Remove-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgApplicationOwnerByRef -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Remove-EntraApplicationPassword.Tests.ps1 b/testVNext/Entra/Applications/Remove-EntraApplicationPassword.Tests.ps1 index de5a5a136..f076400ec 100644 --- a/testVNext/Entra/Applications/Remove-EntraApplicationPassword.Tests.ps1 +++ b/testVNext/Entra/Applications/Remove-EntraApplicationPassword.Tests.ps1 @@ -2,19 +2,19 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgApplicationPassword -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgApplicationPassword -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Remove-EntraApplicationPassword"{ It "Should return empty object" { $result = Remove-EntraApplicationPassword -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgApplicationPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ObjectId is empty" { { Remove-EntraApplicationPassword -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId'*" @@ -29,7 +29,7 @@ Describe "Remove-EntraApplicationPassword"{ { Remove-EntraApplicationPassword -DisplayName "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'DisplayName'." } It "Should contain ApplicationId in parameters when passed ObjectId to it" { - Mock -CommandName Remove-MgApplicationPassword -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgApplicationPassword -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Remove-EntraApplicationPassword -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $params = Get-Parameters -data $result $params.ApplicationId | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" @@ -39,7 +39,7 @@ Describe "Remove-EntraApplicationPassword"{ $result = Remove-EntraApplicationPassword -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraApplicationPassword" - Should -Invoke -CommandName Remove-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgApplicationPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Remove-EntraApplicationPasswordCredential.Tests.ps1 b/testVNext/Entra/Applications/Remove-EntraApplicationPasswordCredential.Tests.ps1 index dbe56b4e3..ca15d5945 100644 --- a/testVNext/Entra/Applications/Remove-EntraApplicationPasswordCredential.Tests.ps1 +++ b/testVNext/Entra/Applications/Remove-EntraApplicationPasswordCredential.Tests.ps1 @@ -2,24 +2,24 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgApplicationPassword -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgApplicationPassword -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Remove-EntraApplicationPasswordCredential"{ It "Should return empty object" { $result = Remove-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "bbbbbbbb-cccc-dddd-2222-333333333333" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgApplicationPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should return empty object with alias" { $result = Remove-EntraApplicationPasswordCredential -ObjectId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "bbbbbbbb-cccc-dddd-2222-333333333333" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgApplicationPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ApplicationId is empty" { { Remove-EntraApplicationPasswordCredential -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId'*" @@ -37,7 +37,7 @@ Describe "Remove-EntraApplicationPasswordCredential"{ { Remove-EntraApplicationPasswordCredential -DisplayName "abc" } | Should -Throw "A parameter cannot be found that matches parameter name 'DisplayName'." } It "Should contain ApplicationId in parameters when passed ApplicationId to it" { - Mock -CommandName Remove-MgApplicationPassword -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgApplicationPassword -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Remove-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "bbbbbbbb-cccc-dddd-2222-333333333333" $params = Get-Parameters -data $result $params.ApplicationId | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" @@ -47,7 +47,7 @@ Describe "Remove-EntraApplicationPasswordCredential"{ $result = Remove-EntraApplicationPasswordCredential -ApplicationId "aaaaaaaa-bbbb-cccc-1111-222222222222" -KeyId "bbbbbbbb-cccc-dddd-2222-333333333333" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraApplicationPasswordCredential" - Should -Invoke -CommandName Remove-MgApplicationPassword -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgApplicationPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Remove-EntraDeletedApplication.Tests.ps1 b/testVNext/Entra/Applications/Remove-EntraDeletedApplication.Tests.ps1 index 37aaef940..a45899aae 100644 --- a/testVNext/Entra/Applications/Remove-EntraDeletedApplication.Tests.ps1 +++ b/testVNext/Entra/Applications/Remove-EntraDeletedApplication.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgDirectoryDeletedItem -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDirectoryDeletedItem -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Remove-EntraDeletedApplication" { @@ -16,7 +16,7 @@ Describe "Remove-EntraDeletedApplication" { $result = Remove-EntraDeletedApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgDirectoryDeletedItem -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgDirectoryDeletedItem -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ObjectId is empty" { @@ -28,7 +28,7 @@ Describe "Remove-EntraDeletedApplication" { } It "Should contain DirectoryObjectId in parameters when passed ObjectId to it" { - Mock -CommandName Remove-MgDirectoryDeletedItem -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDirectoryDeletedItem -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Remove-EntraDeletedApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result @@ -39,7 +39,7 @@ Describe "Remove-EntraDeletedApplication" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDeletedApplication" Remove-EntraDeletedApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDeletedApplication" - Should -Invoke -CommandName Remove-MgDirectoryDeletedItem -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgDirectoryDeletedItem -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Remove-EntraDeletedDirectoryObject.Tests.ps1 b/testVNext/Entra/Applications/Remove-EntraDeletedDirectoryObject.Tests.ps1 index ee39953e5..f946b44f8 100644 --- a/testVNext/Entra/Applications/Remove-EntraDeletedDirectoryObject.Tests.ps1 +++ b/testVNext/Entra/Applications/Remove-EntraDeletedDirectoryObject.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Remove-EntraDeletedDirectoryObject" { @@ -16,14 +16,14 @@ Describe "Remove-EntraDeletedDirectoryObject" { $result = Remove-EntraDeletedDirectoryObject -DirectoryObjectId "11112222-bbbb-3333-cccc-4444dddd5555" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should execute successfully with Alias" { $result = Remove-EntraDeletedDirectoryObject -Id "11112222-bbbb-3333-cccc-4444dddd5555" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when DirectoryObjectId is empty" { @@ -41,7 +41,7 @@ Describe "Remove-EntraDeletedDirectoryObject" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDeletedDirectoryObject" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Remove-EntraServicePrincipal.Tests.ps1 b/testVNext/Entra/Applications/Remove-EntraServicePrincipal.Tests.ps1 index 2c8611deb..97dd35444 100644 --- a/testVNext/Entra/Applications/Remove-EntraServicePrincipal.Tests.ps1 +++ b/testVNext/Entra/Applications/Remove-EntraServicePrincipal.Tests.ps1 @@ -2,24 +2,24 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgServicePrincipal -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgServicePrincipal -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Remove-EntraServicePrincipal" { Context "Test for Remove-EntraServicePrincipal" { It "Should return empty object" { $result = Remove-EntraServicePrincipal -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should update the parameter with Alias" { $result = Remove-EntraServicePrincipal -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is empty" { { Remove-EntraServicePrincipal -ServicePrincipalId }| Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" @@ -28,7 +28,7 @@ Describe "Remove-EntraServicePrincipal" { { Remove-EntraServicePrincipal -ServicePrincipalId "" } | Should -Throw "Cannot bind argument to parameter 'ServicePrincipalId' because it is an empty string.*" } It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { - Mock -CommandName Remove-MgServicePrincipal -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgServicePrincipal -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Remove-EntraServicePrincipal -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result @@ -42,7 +42,7 @@ Describe "Remove-EntraServicePrincipal" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraServicePrincipal" - Should -Invoke -CommandName Remove-MgServicePrincipal -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgServicePrincipal -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Remove-EntraServicePrincipalAppRoleAssignment.Tests.ps1 b/testVNext/Entra/Applications/Remove-EntraServicePrincipalAppRoleAssignment.Tests.ps1 index edc7a3fe4..e22ec6ea7 100644 --- a/testVNext/Entra/Applications/Remove-EntraServicePrincipalAppRoleAssignment.Tests.ps1 +++ b/testVNext/Entra/Applications/Remove-EntraServicePrincipalAppRoleAssignment.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgServicePrincipalAppRoleAssignment -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } diff --git a/testVNext/Entra/Applications/Remove-EntraServicePrincipalDelegatedPermissionClassification.Tests.ps1 b/testVNext/Entra/Applications/Remove-EntraServicePrincipalDelegatedPermissionClassification.Tests.ps1 index 0983ac278..01f1ca5b1 100644 --- a/testVNext/Entra/Applications/Remove-EntraServicePrincipalDelegatedPermissionClassification.Tests.ps1 +++ b/testVNext/Entra/Applications/Remove-EntraServicePrincipalDelegatedPermissionClassification.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgServicePrincipalDelegatedPermissionClassification -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgServicePrincipalDelegatedPermissionClassification -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Remove-EntraServicePrincipalDelegatedPermissionClassification" { @@ -16,7 +16,7 @@ Describe "Remove-EntraServicePrincipalDelegatedPermissionClassification" { $result = Remove-EntraServicePrincipalDelegatedPermissionClassification -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Id "00001111-aaaa-2222-bbbb-3333cccc4444" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgServicePrincipalDelegatedPermissionClassification -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgServicePrincipalDelegatedPermissionClassification -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is empty" { { Remove-EntraServicePrincipalDelegatedPermissionClassification -ServicePrincipalId -Id "00001111-aaaa-2222-bbbb-3333cccc4444" } | should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" @@ -31,7 +31,7 @@ Describe "Remove-EntraServicePrincipalDelegatedPermissionClassification" { { Remove-EntraServicePrincipalDelegatedPermissionClassification -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Id "" } | should -Throw "Cannot bind argument to parameter 'Id'*" } It "Should contain DelegatedPermissionClassificationId in parameters when passed Id to it" { - Mock -CommandName Remove-MgServicePrincipalDelegatedPermissionClassification -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgServicePrincipalDelegatedPermissionClassification -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Remove-EntraServicePrincipalDelegatedPermissionClassification -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Id "00001111-aaaa-2222-bbbb-3333cccc4444" $params = Get-Parameters -data $result @@ -44,7 +44,7 @@ Describe "Remove-EntraServicePrincipalDelegatedPermissionClassification" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraServicePrincipalDelegatedPermissionClassification" - Should -Invoke -CommandName Remove-MgServicePrincipalDelegatedPermissionClassification -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgServicePrincipalDelegatedPermissionClassification -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Remove-EntraServicePrincipalOwner.Tests.ps1 b/testVNext/Entra/Applications/Remove-EntraServicePrincipalOwner.Tests.ps1 index a322efcd9..598be8fda 100644 --- a/testVNext/Entra/Applications/Remove-EntraServicePrincipalOwner.Tests.ps1 +++ b/testVNext/Entra/Applications/Remove-EntraServicePrincipalOwner.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgServicePrincipalOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgServicePrincipalOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Remove-EntraServicePrincipalOwner" { @@ -15,12 +15,12 @@ Describe "Remove-EntraServicePrincipalOwner" { It "Should return empty object" { $result = Remove-EntraServicePrincipalOwner -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should update the parameter with Alias" { $result = Remove-EntraServicePrincipalOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is empty" { { Remove-EntraServicePrincipalOwner -ServicePrincipalId -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" }| Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" @@ -35,14 +35,14 @@ Describe "Remove-EntraServicePrincipalOwner" { { Remove-EntraServicePrincipalOwner -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId ""} | Should -Throw "Cannot bind argument to parameter 'OwnerId' because it is an empty string." } It "Should contain ServicePrincipalId in parameters when passed ServicePrincipalId to it" { - Mock -CommandName Remove-MgServicePrincipalOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgServicePrincipalOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Remove-EntraServicePrincipalOwner -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $params = Get-Parameters -data $result $params.ServicePrincipalId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" } It "Should contain DirectoryObjectId in parameters when passed OwnerId to it" { - Mock -CommandName Remove-MgServicePrincipalOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgServicePrincipalOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Remove-EntraServicePrincipalOwner -ServicePrincipalId "bbbbbbbb-1111-2222-3333-cccccccccccc" -OwnerId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $params = Get-Parameters -data $result @@ -56,7 +56,7 @@ Describe "Remove-EntraServicePrincipalOwner" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraServicePrincipalOwner" - Should -Invoke -CommandName Remove-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgServicePrincipalOwnerByRef -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Remove-EntraServicePrincipalPasswordCredential.Tests.ps1 b/testVNext/Entra/Applications/Remove-EntraServicePrincipalPasswordCredential.Tests.ps1 index b7b4074b9..2df05c510 100644 --- a/testVNext/Entra/Applications/Remove-EntraServicePrincipalPasswordCredential.Tests.ps1 +++ b/testVNext/Entra/Applications/Remove-EntraServicePrincipalPasswordCredential.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgServicePrincipalPassword -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgServicePrincipalPassword -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Remove-EntraServicePrincipalPasswordCredential" { @@ -16,13 +16,13 @@ Describe "Remove-EntraServicePrincipalPasswordCredential" { $result = Remove-EntraServicePrincipalPasswordCredential -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should update the parameter with Alias" { $result = Remove-EntraServicePrincipalPasswordCredential -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is empty" { { Remove-EntraServicePrincipalPasswordCredential -ServicePrincipalId -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" } | should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" @@ -37,7 +37,7 @@ Describe "Remove-EntraServicePrincipalPasswordCredential" { { Remove-EntraServicePrincipalPasswordCredential -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId ""} | should -Throw "Cannot bind argument to parameter 'KeyId'*" } It "Should contain ServicePrincipalId in parameters when passed ObjectId to it" { - Mock -CommandName Remove-MgServicePrincipalPassword -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgServicePrincipalPassword -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Remove-EntraServicePrincipalPasswordCredential -ServicePrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -KeyId "aaaaaaaa-0b0b-1c1c-2d2d-333333333333" $params = Get-Parameters -data $result @@ -50,7 +50,7 @@ Describe "Remove-EntraServicePrincipalPasswordCredential" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraServicePrincipalPasswordCredential" - Should -Invoke -CommandName Remove-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgServicePrincipalPassword -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Restore-EntraDeletedApplication.Tests.ps1 b/testVNext/Entra/Applications/Restore-EntraDeletedApplication.Tests.ps1 index c8808157e..8c8910817 100644 --- a/testVNext/Entra/Applications/Restore-EntraDeletedApplication.Tests.ps1 +++ b/testVNext/Entra/Applications/Restore-EntraDeletedApplication.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -38,7 +38,7 @@ BeforeAll { ) } - Mock -CommandName Restore-MgDirectoryDeletedItem -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Restore-MgDirectoryDeletedItem -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Restore-EntraDeletedApplication" { Context "Restore-EntraDeletedApplication" { @@ -47,7 +47,7 @@ Context "Restore-EntraDeletedApplication" { $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" - Should -Invoke -CommandName Restore-MgDirectoryDeletedItem -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Restore-MgDirectoryDeletedItem -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ObjectId is empty" { { Restore-EntraDeletedApplication -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" @@ -87,7 +87,7 @@ Context "Restore-EntraDeletedApplication" { $result = Restore-EntraDeletedApplication -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Restore-EntraDeletedApplication" - Should -Invoke -CommandName Restore-MgDirectoryDeletedItem -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Restore-MgDirectoryDeletedItem -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Select-EntraGroupIdsServicePrincipalIsMemberOf.Tests.ps1 b/testVNext/Entra/Applications/Select-EntraGroupIdsServicePrincipalIsMemberOf.Tests.ps1 index 301fb92bb..1392bda50 100644 --- a/testVNext/Entra/Applications/Select-EntraGroupIdsServicePrincipalIsMemberOf.Tests.ps1 +++ b/testVNext/Entra/Applications/Select-EntraGroupIdsServicePrincipalIsMemberOf.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( [PSCustomObject]@{ @@ -15,7 +15,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgServicePrincipalMemberOf -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgServicePrincipalMemberOf -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Applications } Describe "Select-EntraGroupIdsServicePrincipalIsMemberOf" { @@ -26,7 +26,7 @@ Describe "Select-EntraGroupIdsServicePrincipalIsMemberOf" { $SPId = "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" $result = Select-EntraGroupIdsServicePrincipalIsMemberOf -ObjectId $SPId -GroupIdsForMembershipCheck $Groups $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgServicePrincipalMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgServicePrincipalMemberOf -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ObjectID parameter is empty" { { Select-EntraGroupIdsServicePrincipalIsMemberOf -ObjectId -GroupIdsForMembershipCheck "22cc22cc-dd33-ee44-ff55-66aa66aa66aa" } | Should -Throw "Missing an argument for parameter*" @@ -50,7 +50,7 @@ Describe "Select-EntraGroupIdsServicePrincipalIsMemberOf" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Select-EntraGroupIdsServicePrincipalIsMemberOf" - Should -Invoke -CommandName Get-MgServicePrincipalMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgServicePrincipalMemberOf -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Set-EntraApplication.Tests.ps1 b/testVNext/Entra/Applications/Set-EntraApplication.Tests.ps1 index dd6a34b0b..3bb0806c6 100644 --- a/testVNext/Entra/Applications/Set-EntraApplication.Tests.ps1 +++ b/testVNext/Entra/Applications/Set-EntraApplication.Tests.ps1 @@ -3,12 +3,12 @@ # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Update-MgApplication -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgApplication -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Set-EntraApplication"{ @@ -17,13 +17,13 @@ Describe "Set-EntraApplication"{ $result = Set-EntraApplication -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" -DisplayName "Mock-App" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should execute successfully with Alias" { $result = Set-EntraApplication -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -DisplayName "Mock-App" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ApplicationId is invalid" { { Set-EntraApplication -ApplicationId "" } | Should -Throw "Cannot bind argument to parameter 'ApplicationId' because it is an empty string." @@ -32,7 +32,7 @@ Describe "Set-EntraApplication"{ { Set-EntraApplication -ApplicationId } | Should -Throw "Missing an argument for parameter 'ApplicationId'*" } It "Should contain ApplicationId in parameters when passed ApplicationId to it" { - Mock -CommandName Update-MgApplication -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgApplication -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Applications $result = Set-EntraApplication -ApplicationId bbbbbbbb-1111-2222-3333-cccccccccccc $result = Set-EntraApplication -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" @@ -46,7 +46,7 @@ Describe "Set-EntraApplication"{ $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraApplication" - Should -Invoke -CommandName Update-MgApplication -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgApplication -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Set-EntraApplicationLogo.Tests.ps1 b/testVNext/Entra/Applications/Set-EntraApplicationLogo.Tests.ps1 index 965a515af..b8556d752 100644 --- a/testVNext/Entra/Applications/Set-EntraApplicationLogo.Tests.ps1 +++ b/testVNext/Entra/Applications/Set-EntraApplicationLogo.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Set-EntraApplicationLogo"{ @@ -15,12 +15,12 @@ Describe "Set-EntraApplicationLogo"{ It "Should return empty object"{ $result = Set-EntraApplicationLogo -ApplicationId "bbbbbbbb-1111-2222-3333-cccccccccccc" -FilePath "https://th.bing.com/th?q=Application+Garden+Ideas&w=138&h=138&c=7&o=5&dpr=1.3&pid=1.7&mkt=en-IN&cc=IN&setlang=en&adlt=moderate" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should return empty object with alias"{ $result = Set-EntraApplicationLogo -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" -FilePath "https://th.bing.com/th?q=Application+Garden+Ideas&w=138&h=138&c=7&o=5&dpr=1.3&pid=1.7&mkt=en-IN&cc=IN&setlang=en&adlt=moderate" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ApplicationId is empty" { @@ -39,7 +39,7 @@ Describe "Set-EntraApplicationLogo"{ $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraApplicationLogo" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Set-EntraServicePrincipal.Tests.ps1 b/testVNext/Entra/Applications/Set-EntraServicePrincipal.Tests.ps1 index f80453f6c..a4695d38e 100644 --- a/testVNext/Entra/Applications/Set-EntraServicePrincipal.Tests.ps1 +++ b/testVNext/Entra/Applications/Set-EntraServicePrincipal.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Applications) -eq $null){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications } Describe "Set-EntraServicePrincipal"{ @@ -17,25 +17,25 @@ Describe "Set-EntraServicePrincipal"{ $result= Set-EntraServicePrincipal -ServicePrincipalId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -AccountEnabled $false -AppId "00001111-aaaa-2222-bbbb-3333cccc4444" -AppRoleAssignmentRequired $true -DisplayName "test11" -ServicePrincipalNames "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Tags $tags $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should update the parameter with Alias" { $result= Set-EntraServicePrincipal -ObjectId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -AccountEnabled $false -AppId "00001111-aaaa-2222-bbbb-3333cccc4444" -AppRoleAssignmentRequired $true -DisplayName "test11" -ServicePrincipalNames "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should update the LogoutUrl and ServicePrincipalType parameter" { $result= Set-EntraServicePrincipal -ServicePrincipalId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -LogoutUrl 'https://securescore.office.com/SignOut' -ServicePrincipalType "Application" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should update the Homepage, ReplyUrls and AlternativeNames parameter" { $result= Set-EntraServicePrincipal -ServicePrincipalId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Homepage 'https://HomePageurlss.com' -ReplyUrls 'https://admin.microsoft1.com' -AlternativeNames "updatetest" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should update the KeyCredentials parameter" { $creds = New-Object Microsoft.Open.AzureAD.Model.KeyCredential @@ -49,7 +49,7 @@ Describe "Set-EntraServicePrincipal"{ $result= Set-EntraServicePrincipal -ServicePrincipalId 6aa187e3-bbbb-4748-a708-fc380aa9eb17 -KeyCredentials $creds $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } It "Should fail when ServicePrincipalId is empty" { { Set-EntraServicePrincipal -ServicePrincipalId } | Should -Throw "Missing an argument for parameter 'ServicePrincipalId'.*" @@ -67,7 +67,7 @@ Describe "Set-EntraServicePrincipal"{ $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraServicePrincipal" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Applications/Valid.Tests.ps1 b/testVNext/Entra/Applications/Valid.Tests.ps1 index 5013e8327..fb28955ce 100644 --- a/testVNext/Entra/Applications/Valid.Tests.ps1 +++ b/testVNext/Entra/Applications/Valid.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll{ - if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module Microsoft.Graph.Entra + if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Applications)){ + Import-Module Microsoft.Graph.Entra.Applications } - Import-Module (Join-Path $psscriptroot ".\EntraCmdletsMap.ps1") -Force + Import-Module (Join-Path $psscriptroot "..\EntraCmdletsMap.ps1") -Force - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Applications } Describe "Valid parameter Tests"{ @@ -20,23 +20,23 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | Select-Object -expand Name) - if($params.count -eq 1 -and $params -eq 'Id'){ + if(($params -eq 'Id') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'Id')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { Write-Host "$command" $commandScriptBlock = [scriptblock]::Create("$commandName -Id 056b2531-005e-4f3e-be78-01a71ea30a04") if($filter.IsApi){ - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } else { - Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } } catch { @@ -58,23 +58,23 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | select -expand Name) - if($params.count -eq 1 -and $params -eq 'ObjectId'){ + if(($params -eq 'ObjectId') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'ObjectId')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { Write-Host "$command" $commandScriptBlock = [scriptblock]::Create("$commandName -ObjectId 056b2531-005e-4f3e-be78-01a71ea30a04") if($filter.IsApi){ - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } else { - Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra.Applications $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra.Applications -Times 1 } } catch { diff --git a/testVNext/Entra/Authentication/Entra.Tests.ps1 b/testVNext/Entra/Authentication/Entra.Tests.ps1 deleted file mode 100644 index e6b0c3179..000000000 --- a/testVNext/Entra/Authentication/Entra.Tests.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. -# ------------------------------------------------------------------------------ - -if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module .\bin\Microsoft.Graph.Entra.psd1 -Force -} - -Import-Module Pester - -$psmPath = (Get-Module Microsoft.Graph.Entra).Path -$testReportPath = join-path $psscriptroot "..\..\..\TestReport\Entra" -$mockScriptsPath = join-path $psscriptroot "..\..\..\test\module\Entra\*.Tests.ps1" - -$testOutputFile = "$testReportPath\TestResults.xml" -if (!(test-path -path $testReportPath)) {new-item -path $testReportPath -itemtype directory} - -$mockScripts = Get-ChildItem -Path $mockScriptsPath -Exclude "Entra.Tests.ps1" | ForEach-Object { $_.FullName } - -$config = New-PesterConfiguration -$config.Run.Path = $mockScripts -$config.Run.PassThru = $true -$config.Run.Exit = $true -$config.CodeCoverage.Enabled = $true -$config.CodeCoverage.CoveragePercentTarget = 100 -$config.CodeCoverage.Path = $psmPath -$config.TestResult.Enabled = $true -$config.TestResult.OutputPath = $testOutputFile -$config.Output.Verbosity = "Detailed" - -Invoke-Pester -Configuration $config \ No newline at end of file diff --git a/testVNext/Entra/Authentication/Invalid.Tests.ps1 b/testVNext/Entra/Authentication/Invalid.Tests.ps1 index 6d5381a10..0f0902f6e 100644 --- a/testVNext/Entra/Authentication/Invalid.Tests.ps1 +++ b/testVNext/Entra/Authentication/Invalid.Tests.ps1 @@ -1,17 +1,17 @@ -if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module Microsoft.Graph.Entra +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Authentication)){ + Import-Module Microsoft.Graph.Entra.Authentication } Describe "Invalid Tests"{ It "Should fail when parameters are invalid"{ - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Authentication $module.ExportedCommands.Keys | ForEach-Object{ $command = Get-Command $_ { Invoke-Command $command -demo "" } | Should -Throw "A parameter cannot be found that matches parameter name 'demo'." } } It "Should fail with 'TenantId' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Authentication $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'TenantId'){ @@ -21,7 +21,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Id' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Authentication $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Id'){ @@ -31,7 +31,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'ObjectId' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Authentication $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'ObjectId'){ @@ -41,7 +41,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'All' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Authentication $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'All'){ @@ -56,7 +56,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Top' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Authentication $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Top'){ @@ -66,7 +66,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Filter' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Authentication $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Filter'){ @@ -76,7 +76,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'SearchString' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Authentication $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'SearchString'){ diff --git a/testVNext/Entra/Authentication/Module.Tests.ps1 b/testVNext/Entra/Authentication/Module.Tests.ps1 index cc40ad720..a0cf17d8d 100644 --- a/testVNext/Entra/Authentication/Module.Tests.ps1 +++ b/testVNext/Entra/Authentication/Module.Tests.ps1 @@ -2,39 +2,39 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ -Describe "Microsoft.Graph.Entra Module" { +Describe "Microsoft.Graph.Entra.Authentication Module" { Context "On module import" { BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Authentication) -eq $null){ + Import-Module Microsoft.Graph.Entra.Authentication } } It "Should have exported commands" { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Authentication $PSModuleInfo | Should -Not -BeNullOrEmpty $PSModuleInfo.ExportedFunctions.Count | Should -Not -Be 0 } It 'Should be compatible with PS core and desktop' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Authentication $PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop") } It 'Should point to script module' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra - $PSModuleInfo.RootModule | Should -BeLikeExactly "*Microsoft.Graph.Entra.psm1" + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Authentication + $PSModuleInfo.RootModule | Should -BeLikeExactly "*Microsoft.Graph.Entra.Authentication.psm1" } It 'Should lock GUID' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Authentication $PSModuleInfo.Guid | Should -Be "742dccd1-bf4b-46a0-a3f2-14e0bb508233" } It "Module import should not write to error and information streams" { $ps = [powershell]::Create() - $ps.AddScript("Import-Module Microsoft.Graph.Entra -ErrorAction SilentlyContinue").Invoke() + $ps.AddScript("Import-Module Microsoft.Graph.Entra.Authentication -ErrorAction SilentlyContinue").Invoke() "Checking Information stream" | Out-Host $ps.Streams.Information.Count | Should -Be 0 "Checking Error stream" | Out-Host diff --git a/testVNext/Entra/Authentication/Reset-EntraStrongAuthenticationMethodByUpn.Tests.ps1 b/testVNext/Entra/Authentication/Reset-EntraStrongAuthenticationMethodByUpn.Tests.ps1 index 721913c1c..9436cf241 100644 --- a/testVNext/Entra/Authentication/Reset-EntraStrongAuthenticationMethodByUpn.Tests.ps1 +++ b/testVNext/Entra/Authentication/Reset-EntraStrongAuthenticationMethodByUpn.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Authentication) -eq $null){ Import-Module Microsoft.Graph.Entra.Authentication } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( [PSCustomObject]@{ diff --git a/testVNext/Entra/Authentication/Revoke-EntraSignedInUserAllRefreshToken.Tests.ps1 b/testVNext/Entra/Authentication/Revoke-EntraSignedInUserAllRefreshToken.Tests.ps1 index a4fd3f06b..e1bff23d7 100644 --- a/testVNext/Entra/Authentication/Revoke-EntraSignedInUserAllRefreshToken.Tests.ps1 +++ b/testVNext/Entra/Authentication/Revoke-EntraSignedInUserAllRefreshToken.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Authentication) -eq $null){ + Import-Module Microsoft.Graph.Entra.Authentication } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $mockResponse = { return @{ @@ -15,7 +15,7 @@ BeforeAll { } } } - Mock -CommandName Invoke-GraphRequest -MockWith $mockResponse -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $mockResponse -ModuleName Microsoft.Graph.Entra.Authentication } Describe "Revoke-EntraSignedInUserAllRefreshToken" { @@ -25,7 +25,7 @@ Describe "Revoke-EntraSignedInUserAllRefreshToken" { $result | Should -Not -BeNullOrEmpty $result | Should -Be $true - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Authentication -Times 1 } It "Should contain 'User-Agent' header" { @@ -35,7 +35,7 @@ Describe "Revoke-EntraSignedInUserAllRefreshToken" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Revoke-EntraSignedInUserAllRefreshToken" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Authentication -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Authentication/Revoke-EntraUserAllRefreshToken.Tests.ps1 b/testVNext/Entra/Authentication/Revoke-EntraUserAllRefreshToken.Tests.ps1 index 717168fd2..a1b5135d2 100644 --- a/testVNext/Entra/Authentication/Revoke-EntraUserAllRefreshToken.Tests.ps1 +++ b/testVNext/Entra/Authentication/Revoke-EntraUserAllRefreshToken.Tests.ps1 @@ -2,13 +2,13 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Authentication) -eq $null) { + Import-Module Microsoft.Graph.Entra.Authentication } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Revoke-MgUserSignInSession -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Revoke-MgUserSignInSession -MockWith {} -ModuleName Microsoft.Graph.Entra.Authentication } Describe "Revoke-EntraUserAllRefreshToken" { @@ -16,12 +16,12 @@ Describe "Revoke-EntraUserAllRefreshToken" { It "Should return empty object" { $result = Revoke-EntraUserAllRefreshToken -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Revoke-MgUserSignInSession -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Revoke-MgUserSignInSession -ModuleName Microsoft.Graph.Entra.Authentication -Times 1 } It "Should return empty object with alias" { $result = Revoke-EntraUserAllRefreshToken -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Revoke-MgUserSignInSession -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Revoke-MgUserSignInSession -ModuleName Microsoft.Graph.Entra.Authentication -Times 1 } It "Should fail when UserId is empty string" { { Revoke-EntraUserAllRefreshToken -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." @@ -30,7 +30,7 @@ Describe "Revoke-EntraUserAllRefreshToken" { { Revoke-EntraUserAllRefreshToken -UserId } | Should -Throw "Missing an argument for parameter*" } It "Should contain Id in parameters when passed UserId to it" { - Mock -CommandName Revoke-MgUserSignInSession -MockWith { $args } -ModuleName Microsoft.Graph.Entra + Mock -CommandName Revoke-MgUserSignInSession -MockWith { $args } -ModuleName Microsoft.Graph.Entra.Authentication $result = Revoke-EntraUserAllRefreshToken -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result @@ -44,7 +44,7 @@ Describe "Revoke-EntraUserAllRefreshToken" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Revoke-EntraUserAllRefreshToken" - Should -Invoke -CommandName Revoke-MgUserSignInSession -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Revoke-MgUserSignInSession -ModuleName Microsoft.Graph.Entra.Authentication -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Authentication/Valid.Tests.ps1 b/testVNext/Entra/Authentication/Valid.Tests.ps1 index 5013e8327..e4f6630fa 100644 --- a/testVNext/Entra/Authentication/Valid.Tests.ps1 +++ b/testVNext/Entra/Authentication/Valid.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll{ - if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module Microsoft.Graph.Entra + if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Authentication)){ + Import-Module Microsoft.Graph.Entra.Authentication } - Import-Module (Join-Path $psscriptroot ".\EntraCmdletsMap.ps1") -Force + Import-Module (Join-Path $psscriptroot "..\EntraCmdletsMap.ps1") -Force - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Authentication } Describe "Valid parameter Tests"{ @@ -20,23 +20,23 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | Select-Object -expand Name) - if($params.count -eq 1 -and $params -eq 'Id'){ + if(($params -eq 'Id') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'Id')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { Write-Host "$command" $commandScriptBlock = [scriptblock]::Create("$commandName -Id 056b2531-005e-4f3e-be78-01a71ea30a04") if($filter.IsApi){ - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Authentication $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Authentication -Times 1 } else { - Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra.Authentication $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra.Authentication -Times 1 } } catch { @@ -58,23 +58,23 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | select -expand Name) - if($params.count -eq 1 -and $params -eq 'ObjectId'){ + if(($params -eq 'ObjectId') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'ObjectId')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { Write-Host "$command" $commandScriptBlock = [scriptblock]::Create("$commandName -ObjectId 056b2531-005e-4f3e-be78-01a71ea30a04") if($filter.IsApi){ - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Authentication $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Authentication -Times 1 } else { - Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra.Authentication $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra.Authentication -Times 1 } } catch { diff --git a/testVNext/Entra/DirectoryManagement/Add-EntraAdministrativeUnitMember.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Add-EntraAdministrativeUnitMember.Tests.ps1 index a18309a0c..a2bdba7d5 100644 --- a/testVNext/Entra/DirectoryManagement/Add-EntraAdministrativeUnitMember.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Add-EntraAdministrativeUnitMember.Tests.ps1 @@ -2,24 +2,24 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Add-EntraAdministrativeUnitMember tests"{ It "Should return empty object"{ $result = Add-EntraAdministrativeUnitMember -AdministrativeUnitId "f306a126-cf2e-439d-b20f-95ce4bcb7ffa" -RefObjectId "d6873b36-81d6-4c5e-bec0-9e3ca2c86846" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return empty object with ObjectId"{ $result = Add-EntraAdministrativeUnitMember -ObjectId "f306a126-cf2e-439d-b20f-95ce4bcb7ffa" -RefObjectId "d6873b36-81d6-4c5e-bec0-9e3ca2c86846" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when AdministrativeUnitId is empty"{ { Add-EntraAdministrativeUnitMember -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" @@ -40,7 +40,7 @@ Describe "Add-EntraAdministrativeUnitMember tests"{ $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraAdministrativeUnitMember" Add-EntraAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraAdministrativeUnitMember" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Add-EntraCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Add-EntraCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 index ecbf81bdd..fe584e5b7 100644 --- a/testVNext/Entra/DirectoryManagement/Add-EntraCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Add-EntraCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( [PSCustomObject]@{ diff --git a/testVNext/Entra/DirectoryManagement/Add-EntraDeviceRegisteredOwner.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Add-EntraDeviceRegisteredOwner.Tests.ps1 index bb5cc1f43..beb122906 100644 --- a/testVNext/Entra/DirectoryManagement/Add-EntraDeviceRegisteredOwner.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Add-EntraDeviceRegisteredOwner.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName New-MgDeviceRegisteredOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgDeviceRegisteredOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Add-EntraDeviceRegisteredOwner" { @@ -16,13 +16,13 @@ Describe "Add-EntraDeviceRegisteredOwner" { $result = Add-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName New-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should execute successfully with Alias" { $result = Add-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName New-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DeviceId is empty" { { Add-EntraDeviceRegisteredOwner -DeviceId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'DeviceId'.*" @@ -37,19 +37,19 @@ Describe "Add-EntraDeviceRegisteredOwner" { { Add-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." } It "Should contain DeviceId in parameters when passed ObjectId to it" { - Mock -CommandName New-MgDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Add-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "412be9d1-1460-4061-8eed-cca203fcb215" $params = Get-Parameters -data $result $params.DeviceId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain BodyParameter in parameters when passed RefObjectId to it" { - Mock -CommandName New-MgDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement Add-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $value = @{ "@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/bbbbbbbb-1111-2222-3333-cccccccccccc"} - Should -Invoke -CommandName New-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $BodyParameter.AdditionalProperties.'@odata.id' | Should -Be $value.'@odata.id' Write-Host $BodyParameter.AdditionalProperties.'@odata.id' $true @@ -62,7 +62,7 @@ Describe "Add-EntraDeviceRegisteredOwner" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraDeviceRegisteredOwner" - Should -Invoke -CommandName New-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Add-EntraDeviceRegisteredUser.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Add-EntraDeviceRegisteredUser.Tests.ps1 index 7b1cf1d27..b9c24deef 100644 --- a/testVNext/Entra/DirectoryManagement/Add-EntraDeviceRegisteredUser.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Add-EntraDeviceRegisteredUser.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName New-MgDeviceRegisteredUserByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgDeviceRegisteredUserByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Add-EntraDeviceRegisteredUser" { @@ -16,7 +16,7 @@ Describe "Add-EntraDeviceRegisteredUser" { $result = Add-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName New-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DeviceId is empty" { { Add-EntraDeviceRegisteredUser -DeviceId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'DeviceId'.*" @@ -34,22 +34,22 @@ Describe "Add-EntraDeviceRegisteredUser" { $result = Add-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName New-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should contain DeviceId in parameters when passed DeviceId to it" { - Mock -CommandName New-MgDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Add-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.DeviceId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain BodyParameter in parameters when passed RefObjectId to it" { - Mock -CommandName New-MgDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement Add-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $value = @{ "@odata.id" = "https://graph.microsoft.com/v1.0/directoryObjects/bbbbbbbb-1111-2222-3333-cccccccccccc"} - Should -Invoke -CommandName New-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $BodyParameter.AdditionalProperties.'@odata.id' | Should -Be $value.'@odata.id' Write-Host $BodyParameter.AdditionalProperties.'@odata.id' $true @@ -62,7 +62,7 @@ Describe "Add-EntraDeviceRegisteredUser" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraDeviceRegisteredUser" - Should -Invoke -CommandName New-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Add-EntraDirectoryRoleMember.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Add-EntraDirectoryRoleMember.Tests.ps1 index 2d05182ad..ad50e3389 100644 --- a/testVNext/Entra/DirectoryManagement/Add-EntraDirectoryRoleMember.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Add-EntraDirectoryRoleMember.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName New-MgDirectoryRoleMemberByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgDirectoryRoleMemberByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Add-EntraDirectoryRoleMember" { @@ -16,13 +16,13 @@ Describe "Add-EntraDirectoryRoleMember" { $result = Add-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName New-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return empty object with alias" { $result = Add-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName New-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DirectoryRoleId is empty" { { Add-EntraDirectoryRoleMember -DirectoryRoleId -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'DirectoryRoleId'.*" @@ -37,14 +37,14 @@ Describe "Add-EntraDirectoryRoleMember" { { Add-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "" } | Should -Throw "Cannot bind argument to parameter 'RefObjectId' because it is an empty string." } It "Should contain DirectoryRoleId in parameters when passed ObjectId to it" { - Mock -CommandName New-MgDirectoryRoleMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgDirectoryRoleMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Add-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.DirectoryRoleId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain OdataId in parameters when passed RefObjectId to it" { - Mock -CommandName New-MgDirectoryRoleMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgDirectoryRoleMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Add-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result @@ -58,7 +58,7 @@ Describe "Add-EntraDirectoryRoleMember" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraDirectoryRoleMember" - Should -Invoke -CommandName New-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Add-EntraScopedRoleMembership.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Add-EntraScopedRoleMembership.Tests.ps1 index e92426054..0be93af49 100644 --- a/testVNext/Entra/DirectoryManagement/Add-EntraScopedRoleMembership.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Add-EntraScopedRoleMembership.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll{ - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $userObjId = "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $roleObjId = "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" @@ -29,20 +29,20 @@ BeforeAll{ } } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Tests for Add-EntraScopedRoleMembership"{ It "Result should not be empty"{ $result = Add-EntraScopedRoleMembership -AdministrativeUnitId $unitObjId -RoleObjectId $roleObjId -RoleMemberInfo $RoleMember $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('NewDummyId') - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Result should not be empty with ObjectId"{ $result = Add-EntraScopedRoleMembership -ObjectId $unitObjId -RoleObjectId $roleObjId -RoleMemberInfo $RoleMember $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('NewDummyId') - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when AdministrativeUnitId is invalid" { { Add-EntraScopedRoleMembership -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" diff --git a/testVNext/Entra/DirectoryManagement/Enable-EntraDirectoryRole.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Enable-EntraDirectoryRole.Tests.ps1 index 749cf3dac..4c6f14198 100644 --- a/testVNext/Entra/DirectoryManagement/Enable-EntraDirectoryRole.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Enable-EntraDirectoryRole.Tests.ps1 @@ -3,12 +3,12 @@ # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName New-MgDirectoryRole -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgDirectoryRole -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Enable-EntraDirectoryRole" { @@ -17,7 +17,7 @@ Describe "Enable-EntraDirectoryRole" { $result = Enable-EntraDirectoryRole -RoleTemplateId 'aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb' $result | Should -BeNullOrEmpty - Should -Invoke -CommandName New-MgDirectoryRole -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgDirectoryRole -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when RoleTemplateId is empty" { { Enable-EntraDirectoryRole -RoleTemplateId } | Should -Throw "Missing an argument for parameter 'RoleTemplateId'*" @@ -26,7 +26,7 @@ Describe "Enable-EntraDirectoryRole" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Enable-EntraDirectoryRole" Enable-EntraDirectoryRole -RoleTemplateId 'aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb' $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Enable-EntraDirectoryRole" - Should -Invoke -CommandName New-MgDirectoryRole -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgDirectoryRole -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Entra.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Entra.Tests.ps1 deleted file mode 100644 index e6b0c3179..000000000 --- a/testVNext/Entra/DirectoryManagement/Entra.Tests.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. -# ------------------------------------------------------------------------------ - -if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module .\bin\Microsoft.Graph.Entra.psd1 -Force -} - -Import-Module Pester - -$psmPath = (Get-Module Microsoft.Graph.Entra).Path -$testReportPath = join-path $psscriptroot "..\..\..\TestReport\Entra" -$mockScriptsPath = join-path $psscriptroot "..\..\..\test\module\Entra\*.Tests.ps1" - -$testOutputFile = "$testReportPath\TestResults.xml" -if (!(test-path -path $testReportPath)) {new-item -path $testReportPath -itemtype directory} - -$mockScripts = Get-ChildItem -Path $mockScriptsPath -Exclude "Entra.Tests.ps1" | ForEach-Object { $_.FullName } - -$config = New-PesterConfiguration -$config.Run.Path = $mockScripts -$config.Run.PassThru = $true -$config.Run.Exit = $true -$config.CodeCoverage.Enabled = $true -$config.CodeCoverage.CoveragePercentTarget = 100 -$config.CodeCoverage.Path = $psmPath -$config.TestResult.Enabled = $true -$config.TestResult.OutputPath = $testOutputFile -$config.Output.Verbosity = "Detailed" - -Invoke-Pester -Configuration $config \ No newline at end of file diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraAccountSku.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraAccountSku.Tests.ps1 index 718b83313..fa4e6b3eb 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraAccountSku.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraAccountSku.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -21,7 +21,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgSubscribedSku -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgSubscribedSku -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Get-EntraAccountSku" { @@ -36,7 +36,7 @@ Describe "Get-EntraAccountSku" { $result.AccountId | should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" $result.AppliesTo | should -Be "User" - Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when TenantId is empty" { { Get-EntraAccountSku -TenantId } | Should -Throw "Missing an argument for parameter 'TenantId'*" @@ -53,7 +53,7 @@ Describe "Get-EntraAccountSku" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraAccountSku" - Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraAdministrativeUnit.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraAdministrativeUnit.Tests.ps1 index 877c4b3d5..86efb9ee1 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraAdministrativeUnit.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraAdministrativeUnit.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll{ - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { @{ @@ -21,18 +21,18 @@ BeforeAll{ } } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Tests for Get-EntraAdministrativeUnit"{ It "Result should not be empty"{ $result = Get-EntraAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Result should not be empty objectid"{ $result = Get-EntraAdministrativeUnit -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when AdministrativeUnitId is empty" { { Get-EntraAdministrativeUnit -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" @@ -59,20 +59,20 @@ Describe "Tests for Get-EntraAdministrativeUnit"{ $result = Get-EntraAdministrativeUnit -Filter "displayName -eq 'test111'" $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'test111' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return top AdministrativeUnit" { $result = @(Get-EntraAdministrativeUnit -Top 1) $result | Should -Not -BeNullOrEmpty $result | Should -HaveCount 1 - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraAdministrativeUnit" $result = Get-EntraAdministrativeUnit -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraAdministrativeUnit" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraAdministrativeUnitMember.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraAdministrativeUnitMember.Tests.ps1 index 371152add..019b916f7 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraAdministrativeUnitMember.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraAdministrativeUnitMember.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll{ - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { @{ @@ -21,18 +21,18 @@ BeforeAll{ } } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Tests for Get-EntraAdministrativeUnitMember"{ It "Result should not be empty"{ $result = Get-EntraAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Result should not be empty objectId"{ $result = Get-EntraAdministrativeUnitMember -ObjectId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when AdministrativeUnitId is empty" { { Get-EntraAdministrativeUnitMember -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" @@ -56,14 +56,14 @@ Describe "Tests for Get-EntraAdministrativeUnitMember"{ $result = @(Get-EntraAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" -Top 1) $result | Should -Not -BeNullOrEmpty $result | Should -HaveCount 1 - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraAdministrativeUnitMember" $result = Get-EntraAdministrativeUnitMember -AdministrativeUnitId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraAdministrativeUnitMember" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraAttributeSet.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraAttributeSet.Tests.ps1 index 7b357e2da..360f30ff3 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraAttributeSet.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraAttributeSet.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraContact.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraContact.Tests.ps1 index 38a042bba..d495ae9c9 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraContact.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraContact.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -42,7 +42,7 @@ BeforeAll { } - Mock -CommandName Get-MgContact -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgContact -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Get-EntraContact" { @@ -58,7 +58,7 @@ Describe "Get-EntraContact" { $result.Mobile | Should -BeNullOrEmpty $result.TelephoneNumber | Should -BeNullOrEmpty - Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return specific Contact alias" { @@ -72,7 +72,7 @@ Describe "Get-EntraContact" { $result.Mobile | Should -BeNullOrEmpty $result.TelephoneNumber | Should -BeNullOrEmpty - Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } @@ -88,7 +88,7 @@ Describe "Get-EntraContact" { $result = Get-EntraContact -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when All is invalid" { { Get-EntraContact -All XY } | Should -Throw "A positional parameter cannot be found that accepts argument 'xy'.*" @@ -99,7 +99,7 @@ Describe "Get-EntraContact" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Bob Kelly (TAILSPIN)' - Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when filter is empty" { @@ -110,7 +110,7 @@ Describe "Get-EntraContact" { $result = Get-EntraContact -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when top is empty" { @@ -136,7 +136,7 @@ Describe "Get-EntraContact" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Bob Kelly (TAILSPIN)' - Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Property is empty" { { Get-EntraContact -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -150,7 +150,7 @@ Describe "Get-EntraContact" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraContact" - Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgContact -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraContactMembership.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraContactMembership.Tests.ps1 index 7cc591d9b..76335f1c7 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraContactMembership.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraContactMembership.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -26,7 +26,7 @@ BeforeAll { } - Mock -CommandName Get-MgContactMemberOf -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgContactMemberOf -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Get-EntraContactMembership" { @@ -37,7 +37,7 @@ Describe "Get-EntraContactMembership" { $result.Id | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' $result.DeletedDateTime | Should -BeNullOrEmpty - Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return specific Contact Membership with alias" { @@ -46,7 +46,7 @@ Describe "Get-EntraContactMembership" { $result.Id | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' $result.DeletedDateTime | Should -BeNullOrEmpty - Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when OrgContactId is invalid" { @@ -57,7 +57,7 @@ Describe "Get-EntraContactMembership" { $result = Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when All is invalid" { { Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -All XY } | Should -Throw "A positional parameter cannot be found that accepts argument 'xy'.*" @@ -67,7 +67,7 @@ Describe "Get-EntraContactMembership" { $result = Get-EntraContactMembership -OrgContactId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when top is empty" { @@ -94,7 +94,7 @@ Describe "Get-EntraContactMembership" { $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Property is empty" { @@ -109,7 +109,7 @@ Describe "Get-EntraContactMembership" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraContactMembership" - Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgContactMemberOf -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraCustomSecurityAttributeDefinition.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraCustomSecurityAttributeDefinition.Tests.ps1 index 5e3546a32..a3c37188d 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraCustomSecurityAttributeDefinition.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraCustomSecurityAttributeDefinition.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 index 1ece0a2c2..5892021c7 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( [PSCustomObject]@{ diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDeletedDirectoryObject.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDeletedDirectoryObject.Tests.ps1 index 50c70c3e0..0cc8be44c 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDeletedDirectoryObject.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDeletedDirectoryObject.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -18,7 +18,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgDirectoryDeletedItem -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDirectoryDeletedItem -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Get-EntraDeletedDirectoryObject"{ @@ -49,7 +49,7 @@ Describe "Get-EntraDeletedDirectoryObject"{ $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" - Should -Invoke -CommandName Get-MgDirectoryDeletedItem -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryDeletedItem -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Property is empty" { @@ -60,7 +60,7 @@ Describe "Get-EntraDeletedDirectoryObject"{ $result = Get-EntraDeletedDirectoryObject -DirectoryObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeletedDirectoryObject" - Should -Invoke -CommandName Get-MgDirectoryDeletedItem -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgDirectoryDeletedItem -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDevice.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDevice.Tests.ps1 index eb5b54981..5ca2420a0 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDevice.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDevice.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Get-MgDevice with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -45,7 +45,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgDevice -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDevice -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Get-EntraDevice" { @@ -55,13 +55,13 @@ Describe "Get-EntraDevice" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb') - Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return specific device with Alias" { $result = Get-EntraDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DeviceId is invalid" { { Get-EntraDevice -DeviceId "" } | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string." @@ -85,7 +85,7 @@ Describe "Get-EntraDevice" { $result = Get-EntraDevice -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when All has an argument" { { Get-EntraDevice -All $true} | Should -Throw "A positional parameter cannot be found that accepts argument 'True'." @@ -95,27 +95,27 @@ Describe "Get-EntraDevice" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Mock-Device' - Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return specific device by filter" { $result = Get-EntraDevice -Filter "DisplayName -eq 'Mock-Device'" $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Mock-Device' - Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return top device" { $result = Get-EntraDevice -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Property parameter should work" { $result = Get-EntraDevice -Property DisplayName $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock-Device' - Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Property is empty" { { Get-EntraDevice -Property DisplayName -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -134,7 +134,7 @@ Describe "Get-EntraDevice" { $result = Get-EntraDevice -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDevice" - Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgDevice -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDeviceRegisteredOwner.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDeviceRegisteredOwner.Tests.ps1 index cc1a882fd..390fb1592 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDeviceRegisteredOwner.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDeviceRegisteredOwner.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @{ @@ -28,7 +28,7 @@ BeforeAll { } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } @@ -40,14 +40,14 @@ Describe "Get-EntraDeviceRegisteredOwner" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return specific device registered owner with alias" { $result = Get-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DeviceId is empty" { { Get-EntraDeviceRegisteredOwner -DeviceId } | Should -Throw "Missing an argument for parameter 'DeviceId'*" @@ -60,7 +60,7 @@ Describe "Get-EntraDeviceRegisteredOwner" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when All is invalid" { @@ -71,7 +71,7 @@ Describe "Get-EntraDeviceRegisteredOwner" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when top is empty" { { Get-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" @@ -109,7 +109,7 @@ Describe "Get-EntraDeviceRegisteredOwner" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeviceRegisteredOwner" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } @@ -120,7 +120,7 @@ Describe "Get-EntraDeviceRegisteredOwner" { $result | Should -Not -BeNullOrEmpty $result.mobilePhone | Should -Be '425-555-0100' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Property is empty" { diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDeviceRegisteredUser.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDeviceRegisteredUser.Tests.ps1 index e1841fd41..f71ea4f4e 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDeviceRegisteredUser.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDeviceRegisteredUser.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @{ @@ -28,7 +28,7 @@ BeforeAll { } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } @@ -40,14 +40,14 @@ Describe "Get-EntraDeviceRegisteredUser" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return specific device registered User with alias" { $result = Get-EntraDeviceRegisteredUser -ObjectId "8542ebd1-3d49-4073-9dce-30f197c67755" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DeviceId is empty" { { Get-EntraDeviceRegisteredUser -DeviceId } | Should -Throw "Missing an argument for parameter 'DeviceId'*" @@ -60,7 +60,7 @@ Describe "Get-EntraDeviceRegisteredUser" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return top device registered owner" { @@ -68,7 +68,7 @@ Describe "Get-EntraDeviceRegisteredUser" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when top is empty" { { Get-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" @@ -115,7 +115,7 @@ Describe "Get-EntraDeviceRegisteredUser" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeviceRegisteredUser" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDirSyncConfiguration.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDirSyncConfiguration.Tests.ps1 index 5546ee23a..b2a9a439e 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDirSyncConfiguration.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDirSyncConfiguration.Tests.ps1 @@ -2,11 +2,11 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ - Import-Module Microsoft.Graph.Entra + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @{ configuration = [PSCustomObject]@{ @@ -17,14 +17,14 @@ BeforeAll { } } } - Mock -CommandName Get-MgDirectoryOnPremiseSynchronization -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDirectoryOnPremiseSynchronization -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Get-EntraDirSyncConfiguration" { Context "Test for Get-EntraDirSyncConfiguration" { It "Get irectory synchronization settings" { $result = Get-EntraDirSyncConfiguration -TenantId "aaaabbbb-0000-cccc-1111-dddd2222eeee" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when TenantId is empty" { { Get-EntraDirSyncConfiguration -TenantId } | Should -Throw "Missing an argument for parameter 'TenantId'*" @@ -46,7 +46,7 @@ Describe "Get-EntraDirSyncConfiguration" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirSyncConfiguration" - Should -Invoke -CommandName Get-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDirSyncFeature.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDirSyncFeature.Tests.ps1 index 0636ae129..4fb4efac2 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDirSyncFeature.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDirSyncFeature.Tests.ps1 @@ -1,85 +1,85 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. -# ------------------------------------------------------------------------------ -BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ - Import-Module Microsoft.Graph.Entra.DirectoryManagement - } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force +# # ------------------------------------------------------------------------------ +# # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# # ------------------------------------------------------------------------------ +# BeforeAll { +# if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ +# Import-Module Microsoft.Graph.Entra.DirectoryManagement +# } +# Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - $scriptblock = { - return @( - [PSCustomObject]@{ - "Features" = @{ - "BlockCloudObjectTakeoverThroughHardMatchEnabled" = $false; - "BlockSoftMatchEnabled" = $false; - "BypassDirSyncOverridesEnabled" = $false; - "CloudPasswordPolicyForPasswordSyncedUsersEnabled" = $false; - "ConcurrentCredentialUpdateEnabled" = $false; - "ConcurrentOrgIdProvisioningEnabled" = $true; - "DeviceWritebackEnabled" = $false; - "DirectoryExtensionsEnabled" = $false; - "FopeConflictResolutionEnabled" = $false; - "GroupWriteBackEnabled" = $true; - "PasswordSyncEnabled" = $false; - "PasswordWritebackEnabled" = $false; - "QuarantineUponProxyAddressesConflictEnabled" = $true; - "QuarantineUponUpnConflictEnabled" = $true; - "SoftMatchOnUpnEnabled" = $true; - "SynchronizeUpnForManagedUsersEnabled" = $true; - "UnifiedGroupWritebackEnabled" = $true; - "UserForcePasswordChangeOnLogonEnabled" = $false; - "UserWritebackEnabled" = $false; - } - } - ) - } - Mock -CommandName Get-MgDirectoryOnPremiseSynchronization -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement -} +# $scriptblock = { +# return @( +# [PSCustomObject]@{ +# "Features" = @{ +# "BlockCloudObjectTakeoverThroughHardMatchEnabled" = $false; +# "BlockSoftMatchEnabled" = $false; +# "BypassDirSyncOverridesEnabled" = $false; +# "CloudPasswordPolicyForPasswordSyncedUsersEnabled" = $false; +# "ConcurrentCredentialUpdateEnabled" = $false; +# "ConcurrentOrgIdProvisioningEnabled" = $true; +# "DeviceWritebackEnabled" = $false; +# "DirectoryExtensionsEnabled" = $false; +# "FopeConflictResolutionEnabled" = $false; +# "GroupWriteBackEnabled" = $true; +# "PasswordSyncEnabled" = $false; +# "PasswordWritebackEnabled" = $false; +# "QuarantineUponProxyAddressesConflictEnabled" = $true; +# "QuarantineUponUpnConflictEnabled" = $true; +# "SoftMatchOnUpnEnabled" = $true; +# "SynchronizeUpnForManagedUsersEnabled" = $true; +# "UnifiedGroupWritebackEnabled" = $true; +# "UserForcePasswordChangeOnLogonEnabled" = $false; +# "UserWritebackEnabled" = $false; +# } +# } +# ) +# } +# Mock -CommandName Get-MgDirectoryOnPremiseSynchronization -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement +# } -Describe "Get-EntraDirSyncFeature" { - Context "Test for Get-EntraDirSyncFeature" { - It "Returns all the sync features" { - $result = Get-EntraDirSyncFeature - $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 - } - It "Returns specific sync feature" { - $result = Get-EntraDirSyncFeature -Feature PasswordSync - $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 - } - It "Should fail when TenantId is null" { - { Get-EntraDirSyncFeature -TenantId } | Should -Throw "Missing an argument for parameter 'TenantId'*" - } - It "Should fail when TenantId is empty" { - { Get-EntraDirSyncFeature -TenantId "" } | Should -Throw "Cannot process argument transformation on parameter 'TenantId'*" - } - It "Should fail when invalid paramter is passed"{ - { Get-EntraDirSyncFeature -Demo } | Should -Throw "A parameter cannot be found that matches parameter name 'Demo'*" - } - It "Should contain 'User-Agent' header" { - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirSyncFeature" - $result = Get-EntraDirSyncFeature -Feature PasswordSync - $result | Should -Not -BeNullOrEmpty - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirSyncFeature" - Should -Invoke -CommandName Get-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { - $Headers.'User-Agent' | Should -Be $userAgentHeaderValue - $true - } - } - It "Should execute successfully without throwing an error " { - # Disable confirmation prompts - $originalDebugPreference = $DebugPreference - $DebugPreference = 'Continue' +# Describe "Get-EntraDirSyncFeature" { +# Context "Test for Get-EntraDirSyncFeature" { +# It "Returns all the sync features" { +# $result = Get-EntraDirSyncFeature +# $result | Should -Not -BeNullOrEmpty +# Should -Invoke -CommandName Get-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 +# } +# It "Returns specific sync feature" { +# $result = Get-EntraDirSyncFeature -Feature PasswordSync +# $result | Should -Not -BeNullOrEmpty +# Should -Invoke -CommandName Get-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 +# } +# It "Should fail when TenantId is null" { +# { Get-EntraDirSyncFeature -TenantId } | Should -Throw "Missing an argument for parameter 'TenantId'*" +# } +# It "Should fail when TenantId is empty" { +# { Get-EntraDirSyncFeature -TenantId "" } | Should -Throw "Cannot process argument transformation on parameter 'TenantId'*" +# } +# It "Should fail when invalid paramter is passed"{ +# { Get-EntraDirSyncFeature -Demo } | Should -Throw "A parameter cannot be found that matches parameter name 'Demo'*" +# } +# It "Should contain 'User-Agent' header" { +# $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirSyncFeature" +# $result = Get-EntraDirSyncFeature -Feature PasswordSync +# $result | Should -Not -BeNullOrEmpty +# $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirSyncFeature" +# Should -Invoke -CommandName Get-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { +# $Headers.'User-Agent' | Should -Be $userAgentHeaderValue +# $true +# } +# } +# It "Should execute successfully without throwing an error " { +# # Disable confirmation prompts +# $originalDebugPreference = $DebugPreference +# $DebugPreference = 'Continue' - try { - # Act & Assert: Ensure the function doesn't throw an exception - { Get-EntraDirSyncFeature -Feature PasswordSync -Debug } | Should -Not -Throw - } finally { - # Restore original confirmation preference - $DebugPreference = $originalDebugPreference - } - } - } -} +# try { +# # Act & Assert: Ensure the function doesn't throw an exception +# { Get-EntraDirSyncFeature -Feature PasswordSync -Debug } | Should -Not -Throw +# } finally { +# # Restore original confirmation preference +# $DebugPreference = $originalDebugPreference +# } +# } +# } +# } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryObjectOnPremisesProvisioningError.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryObjectOnPremisesProvisioningError.Tests.ps1 index e1e229f72..b6e8ad80b 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryObjectOnPremisesProvisioningError.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryObjectOnPremisesProvisioningError.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRole.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRole.Tests.ps1 index c9a2e8dfa..55b758e35 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRole.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRole.Tests.ps1 @@ -3,10 +3,10 @@ # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Get-EntraDirectoryRole with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -24,7 +24,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgDirectoryRole -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDirectoryRole -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Get-EntraDirectoryRole" { @@ -34,14 +34,14 @@ BeforeAll { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" - Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should execute successfully with Alias" { $result = Get-EntraDirectoryRole -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" - Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DirectoryRoleId is empty" { { Get-EntraDirectoryRole -DirectoryRoleId "" } | Should -Throw "Cannot bind argument to parameter 'DirectoryRoleId' because it is an empty string." @@ -51,7 +51,7 @@ BeforeAll { $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Attribute Assignment Reader' - Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Result should Contain DirectoryRoleId" { $result = Get-EntraDirectoryRole -DirectoryRoleId "bbbbbbbb-1111-2222-3333-cccccccccccc" @@ -67,7 +67,7 @@ BeforeAll { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Attribute Assignment Reader' - Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Property is empty" { { Get-EntraDirectoryRole -DirectoryRoleId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -77,7 +77,7 @@ BeforeAll { $result = Get-EntraDirectoryRole -DirectoryRoleId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirectoryRole" - Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgDirectoryRole -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRoleMember.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRoleMember.Tests.ps1 index 9e7c6dd4b..48cc47902 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRoleMember.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRoleMember.Tests.ps1 @@ -2,11 +2,11 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ - Import-Module Microsoft.Graph.Entra + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @{ value = @( @@ -23,7 +23,7 @@ BeforeAll { } } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } @@ -34,14 +34,14 @@ Describe "EntraDirectoryRoleMember" { $result | Should -Not -BeNullOrEmpty $result.ObjectId | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return specific directory rolemember with alias" { $result = (Get-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb") | ConvertTo-json | ConvertFrom-json $result | Should -Not -BeNullOrEmpty $result.ObjectId | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DirectoryRoleId is empty" { { Get-EntraDirectoryRoleMember -DirectoryRoleId } | Should -Throw "Missing an argument for parameter 'DirectoryRoleId'*" @@ -69,7 +69,7 @@ Describe "EntraDirectoryRoleMember" { $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Property is empty" { { Get-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -82,7 +82,7 @@ Describe "EntraDirectoryRoleMember" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirectoryRoleMember" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRoleTemplate.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRoleTemplate.Tests.ps1 index f2653aceb..d4663ce81 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRoleTemplate.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRoleTemplate.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -20,7 +20,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgDirectoryRoleTemplate -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDirectoryRoleTemplate -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Get-EntraDirectoryRoleTemplate" { @@ -31,7 +31,7 @@ Describe "Get-EntraDirectoryRoleTemplate" { $result.Id | should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result.DisplayName | should -Be "Mock-App" - Should -Invoke -CommandName Get-MgDirectoryRoleTemplate -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryRoleTemplate -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should be fail when provide non supported parameter" { { Get-EntraDirectoryRoleTemplate -Top 1} | should -Throw "A parameter cannot be found that matches parameter name 'Top'." @@ -41,7 +41,7 @@ Describe "Get-EntraDirectoryRoleTemplate" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock-App' - Should -Invoke -CommandName Get-MgDirectoryRoleTemplate -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryRoleTemplate -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Property is empty" { { Get-EntraDirectoryRoleTemplate -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -53,7 +53,7 @@ Describe "Get-EntraDirectoryRoleTemplate" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirectoryRoleTemplate" - Should -Invoke -CommandName Get-MgDirectoryRoleTemplate -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgDirectoryRoleTemplate -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDomain.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDomain.Tests.ps1 index 4467d2ffd..711af4810 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDomain.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDomain.Tests.ps1 @@ -2,11 +2,11 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ - Import-Module Microsoft.Graph.Entra + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -34,7 +34,7 @@ $scriptblock = { } - Mock -CommandName Get-MgDomain -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDomain -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Get-EntraDomain" { @@ -44,7 +44,7 @@ Describe "Get-EntraDomain" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'test.mail.onmicrosoft.com' - Should -Invoke -CommandName Get-MgDomain -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDomain -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Name is empty" { { Get-EntraDomain -Name "" } | Should -Throw "Cannot bind argument to parameter 'Name' because it is an empty string." @@ -53,13 +53,13 @@ Describe "Get-EntraDomain" { $result = Get-EntraDomain -Name "test.mail.onmicrosoft.com" $result.ObjectId | should -Be "test.mail.onmicrosoft.com" - Should -Invoke -CommandName Get-MgDomain -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDomain -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Result should Contain Name" { $result = Get-EntraDomain -Name "test.mail.onmicrosoft.com" $result.Name | should -Be "test.mail.onmicrosoft.com" - Should -Invoke -CommandName Get-MgDomain -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDomain -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should contain DomainId in parameters when passed Name to it" { $result = Get-EntraDomain -Name "test.mail.onmicrosoft.com" @@ -71,7 +71,7 @@ Describe "Get-EntraDomain" { $result | Should -Not -BeNullOrEmpty $result.AuthenticationType | Should -Be 'Managed' - Should -Invoke -CommandName Get-MgDomain -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDomain -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Property is empty" { {Get-EntraDomain -Name "test.mail.onmicrosoft.com" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -82,7 +82,7 @@ Describe "Get-EntraDomain" { Get-EntraDomain -Name "test.mail.onmicrosoft.com" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDomain" - Should -Invoke -CommandName Get-MgDomain -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgDomain -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDomainFederationSettings.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDomainFederationSettings.Tests.ps1 index b96973a16..e01b761ba 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDomainFederationSettings.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDomainFederationSettings.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -29,7 +29,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgDomainFederationConfiguration -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDomainFederationConfiguration -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Get-EntraDomainFederationSettings" { @@ -39,7 +39,7 @@ Describe "Get-EntraDomainFederationSettings" { $result | Should -Not -BeNullOrEmpty $result.FederationBrandName | Should -Be "Contoso" $result.ActiveLogOnUri | Should -Be "https://sts.deverett.info/adfs/services/trust/2005/usernamemixed" - Should -Invoke -CommandName Get-MgDomainFederationConfiguration -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDomainFederationConfiguration -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when TenantId is null" { { Get-EntraDomainFederationSettings -TenantId } | Should -Throw "Missing an argument for parameter 'TenantId'*" @@ -61,7 +61,7 @@ Describe "Get-EntraDomainFederationSettings" { $result = Get-EntraDomainFederationSettings -DomainName "test.com" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDomainFederationSettings" - Should -Invoke -CommandName Get-MgDomainFederationConfiguration -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgDomainFederationConfiguration -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDomainNameReference.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDomainNameReference.Tests.ps1 index f503703a0..6ea961d65 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDomainNameReference.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDomainNameReference.Tests.ps1 @@ -3,10 +3,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @{ @@ -28,7 +28,7 @@ BeforeAll { } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } @@ -40,7 +40,7 @@ Describe "Get-EntraDomainNameReference" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '22cc22cc-dd33-ee44-ff55-66aa66aa66aa' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Name is empty" { { Get-EntraDomainNameReference -Name } | Should -Throw "Missing an argument for parameter 'Name'*" @@ -73,7 +73,7 @@ Describe "Get-EntraDomainNameReference" { $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be '22cc22cc-dd33-ee44-ff55-66aa66aa66aa' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Property is empty" { { Get-EntraDomainNameReference -Name "M365x99297270.mail.onmicrosoft.com" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -85,7 +85,7 @@ Describe "Get-EntraDomainNameReference" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDomainNameReference" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDomainServiceConfigurationRecord.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDomainServiceConfigurationRecord.Tests.ps1 index d0aa101ff..3acbad54d 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDomainServiceConfigurationRecord.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDomainServiceConfigurationRecord.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDomainVerificationDnsRecord.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraDomainVerificationDnsRecord.Tests.ps1 index f009b7153..984f74e6f 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDomainVerificationDnsRecord.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraDomainVerificationDnsRecord.Tests.ps1 @@ -2,11 +2,11 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ - Import-Module Microsoft.Graph.Entra + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -28,7 +28,7 @@ $scriptblock = { } - Mock -CommandName Get-MgDomainVerificationDnsRecord -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDomainVerificationDnsRecord -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Get-EntraDomainVerificationDnsRecord" { @@ -38,7 +38,7 @@ Describe "Get-EntraDomainVerificationDnsRecord" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be '0000aaaa-11bb-cccc-dd22-eeeeee333333' - Should -Invoke -CommandName Get-MgDomainVerificationDnsRecord -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDomainVerificationDnsRecord -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Name is empty" { @@ -51,13 +51,13 @@ Describe "Get-EntraDomainVerificationDnsRecord" { $result = Get-EntraDomainVerificationDnsRecord -Name "test.mail.onmicrosoft.com" $result.DnsRecordId | should -Be "0000aaaa-11bb-cccc-dd22-eeeeee333333" - Should -Invoke -CommandName Get-MgDomainVerificationDnsRecord -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDomainVerificationDnsRecord -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Result should Contain ObjectId" { $result = Get-EntraDomainVerificationDnsRecord -Name "test.mail.onmicrosoft.com" $result.ObjectId | should -Be "0000aaaa-11bb-cccc-dd22-eeeeee333333" - Should -Invoke -CommandName Get-MgDomainVerificationDnsRecord -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDomainVerificationDnsRecord -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should contain DomainId in parameters when passed Name to it" { $result = Get-EntraDomainVerificationDnsRecord -Name "test.mail.onmicrosoft.com" @@ -69,7 +69,7 @@ Describe "Get-EntraDomainVerificationDnsRecord" { $result | Should -Not -BeNullOrEmpty $result.RecordType | Should -Be 'Txt' - Should -Invoke -CommandName Get-MgDomainVerificationDnsRecord -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDomainVerificationDnsRecord -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Property is empty" { { Get-EntraDomainVerificationDnsRecord -Name "test.mail.onmicrosoft.com" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -81,7 +81,7 @@ Describe "Get-EntraDomainVerificationDnsRecord" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDomainVerificationDnsRecord" - Should -Invoke -CommandName Get-MgDomainVerificationDnsRecord -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgDomainVerificationDnsRecord -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraFederationProperty.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraFederationProperty.Tests.ps1 index 624c27135..9aee14e4d 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraFederationProperty.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraFederationProperty.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -20,7 +20,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgDomainFederationConfiguration -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDomainFederationConfiguration -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Get-EntraFederationProperty" { Context "Test for Get-EntraFederationProperty" { @@ -34,7 +34,7 @@ Describe "Get-EntraFederationProperty" { $result.PassiveSignInUri | Should -Be "https://sts.anmaji.myworkspace.microsoft.com/adfs/ls/" $result.SignOutUri | Should -Be "https://sts.anmaji.myworkspace.microsoft.com/adfs/ls/" - Should -Invoke -CommandName Get-MgDomainFederationConfiguration -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDomainFederationConfiguration -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DomainName is empty" { {Get-EntraFederationProperty -DomainName} | Should -Throw "Missing an argument for parameter 'DomainName'. Specify a parameter*" @@ -45,7 +45,7 @@ Describe "Get-EntraFederationProperty" { } It "Should contain DomainId in parameters when DomainName to it" { - Mock -CommandName Get-MgDomainFederationConfiguration -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDomainFederationConfiguration -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Get-EntraFederationProperty -DomainName "anmaji.myworkspace.contoso.com" $params = Get-Parameters -data $result $params.DomainId | Should -Be "anmaji.myworkspace.contoso.com" @@ -59,7 +59,7 @@ Describe "Get-EntraFederationProperty" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraFederationProperty" - Should -Invoke -CommandName Get-MgDomainFederationConfiguration -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgDomainFederationConfiguration -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraObjectByObjectId.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraObjectByObjectId.Tests.ps1 index 6ad007cbd..87feec004 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraObjectByObjectId.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraObjectByObjectId.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @{ value = @( diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraPasswordPolicy.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraPasswordPolicy.Tests.ps1 index 04f9ce610..4d3798ade 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraPasswordPolicy.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraPasswordPolicy.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -17,7 +17,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgDomain -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDomain -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Get-EntraPasswordPolicy" { @@ -28,7 +28,7 @@ Describe "Get-EntraPasswordPolicy" { $result.NotificationDays.PasswordNotificationWindowInDays | Should -Be "14" $result.ValidityPeriod | Should -Be "2147483647" - Should -Invoke -CommandName Get-MgDomain -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDomain -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DomainName is empty" { @@ -47,7 +47,7 @@ Describe "Get-EntraPasswordPolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraPasswordPolicy" - Should -Invoke -CommandName Get-MgDomain -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgDomain -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraScopedRoleMembership.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraScopedRoleMembership.Tests.ps1 index 20066df55..ae370cb0b 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraScopedRoleMembership.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraScopedRoleMembership.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll{ - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $userObjId = "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $roleObjId = "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" @@ -28,7 +28,7 @@ BeforeAll{ } } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Tests for Get-EntraScopedRoleMembership"{ It "Result should not be empty"{ @@ -37,7 +37,7 @@ Describe "Tests for Get-EntraScopedRoleMembership"{ $result.ObjectId | should -Be $scopedRoleMembershipId $result.AdministrativeUnitObjectId | should -Be $unitObjId $result.RoleObjectId | should -Be $roleObjId - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Result should not be empty with ObjectId"{ $result = Get-EntraScopedRoleMembership -ObjectId $unitObjId -ScopedRoleMembershipId $scopedRoleMembershipId @@ -45,7 +45,7 @@ Describe "Tests for Get-EntraScopedRoleMembership"{ $result.ObjectId | should -Be $scopedRoleMembershipId $result.AdministrativeUnitObjectId | should -Be $unitObjId $result.RoleObjectId | should -Be $roleObjId - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when AdministrativeUnitId is invalid" { { Get-EntraScopedRoleMembership -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" @@ -64,7 +64,7 @@ Describe "Tests for Get-EntraScopedRoleMembership"{ $result = Get-EntraScopedRoleMembership -AdministrativeUnitId $unitObjId -ScopedRoleMembershipId $scopedRoleMembershipId $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraScopedRoleMembership" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraSubscribedSku.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraSubscribedSku.Tests.ps1 index b0d7bb95b..67471ef5d 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraSubscribedSku.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraSubscribedSku.Tests.ps1 @@ -2,11 +2,11 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ - Import-Module Microsoft.Graph.Entra + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -29,7 +29,7 @@ $scriptblock = { } - Mock -CommandName Get-MgSubscribedSku -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgSubscribedSku -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } @@ -40,14 +40,14 @@ Describe "Get-EntraSubscribedSku" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be "00001111-aaaa-2222-bbbb-3333cccc4444_11112222-bbbb-3333-cccc-4444dddd5555" - Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return specific SubscribedSku with alias" { $result = Get-EntraSubscribedSku -ObjectId "00001111-aaaa-2222-bbbb-3333cccc4444_11112222-bbbb-3333-cccc-4444dddd5555" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be "00001111-aaaa-2222-bbbb-3333cccc4444_11112222-bbbb-3333-cccc-4444dddd5555" - Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when SubscribedSkuId empty" { { Get-EntraSubscribedSku -SubscribedSkuId } | Should -Throw "Missing an argument for parameter 'SubscribedSkuId'*" @@ -59,14 +59,14 @@ Describe "Get-EntraSubscribedSku" { $result = Get-EntraSubscribedSku $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Property parameter should work" { $result = Get-EntraSubscribedSku -Property AppliesTo $result | Should -Not -BeNullOrEmpty $result.AppliesTo | Should -Be 'User' - Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Property is empty" { { Get-EntraSubscribedSku -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -78,7 +78,7 @@ Describe "Get-EntraSubscribedSku" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraSubscribedSku" - Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgSubscribedSku -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraTenantDetail.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Get-EntraTenantDetail.Tests.ps1 index 6dfe7a876..7dc35b5a6 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraTenantDetail.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Get-EntraTenantDetail.Tests.ps1 @@ -2,11 +2,11 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ - Import-Module Microsoft.Graph.Entra + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -34,7 +34,7 @@ $scriptblock = { } - Mock -CommandName Get-MgOrganization -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgOrganization -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } @@ -44,7 +44,7 @@ Describe "Get-EntraTenantDetail" { $result = Get-EntraTenantDetail -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgOrganization -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgOrganization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when All is invalid" { { Get-EntraTenantDetail -All XY } | Should -Throw "A positional parameter cannot be found that accepts argument 'xy'.*" @@ -53,7 +53,7 @@ Describe "Get-EntraTenantDetail" { $result = Get-EntraTenantDetail -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgOrganization -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgOrganization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Top is empty" { { Get-EntraTenantDetail -Top } | Should -Throw "Missing an argument for parameter 'Top'*" @@ -66,7 +66,7 @@ Describe "Get-EntraTenantDetail" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock App' - Should -Invoke -CommandName Get-MgOrganization -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgOrganization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Property is empty" { { Get-EntraTenantDetail -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -78,7 +78,7 @@ Describe "Get-EntraTenantDetail" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraTenantDetail" - Should -Invoke -CommandName Get-MgOrganization -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgOrganization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Invalid.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Invalid.Tests.ps1 index 6d5381a10..9d6567d89 100644 --- a/testVNext/Entra/DirectoryManagement/Invalid.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Invalid.Tests.ps1 @@ -1,17 +1,17 @@ -if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module Microsoft.Graph.Entra +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement)){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } Describe "Invalid Tests"{ It "Should fail when parameters are invalid"{ - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement $module.ExportedCommands.Keys | ForEach-Object{ $command = Get-Command $_ { Invoke-Command $command -demo "" } | Should -Throw "A parameter cannot be found that matches parameter name 'demo'." } } It "Should fail with 'TenantId' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'TenantId'){ @@ -21,7 +21,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Id' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Id'){ @@ -31,7 +31,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'ObjectId' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'ObjectId'){ @@ -41,7 +41,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'All' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'All'){ @@ -56,7 +56,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Top' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Top'){ @@ -66,7 +66,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Filter' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Filter'){ @@ -76,7 +76,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'SearchString' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'SearchString'){ diff --git a/testVNext/Entra/DirectoryManagement/Module.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Module.Tests.ps1 index cc40ad720..24e5e5254 100644 --- a/testVNext/Entra/DirectoryManagement/Module.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Module.Tests.ps1 @@ -2,39 +2,39 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ -Describe "Microsoft.Graph.Entra Module" { +Describe "Microsoft.Graph.Entra.DirectoryManagement Module" { Context "On module import" { BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } } It "Should have exported commands" { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.DirectoryManagement $PSModuleInfo | Should -Not -BeNullOrEmpty $PSModuleInfo.ExportedFunctions.Count | Should -Not -Be 0 } It 'Should be compatible with PS core and desktop' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.DirectoryManagement $PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop") } It 'Should point to script module' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra - $PSModuleInfo.RootModule | Should -BeLikeExactly "*Microsoft.Graph.Entra.psm1" + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.DirectoryManagement + $PSModuleInfo.RootModule | Should -BeLikeExactly "*Microsoft.Graph.Entra.DirectoryManagement.psm1" } It 'Should lock GUID' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.DirectoryManagement $PSModuleInfo.Guid | Should -Be "742dccd1-bf4b-46a0-a3f2-14e0bb508233" } It "Module import should not write to error and information streams" { $ps = [powershell]::Create() - $ps.AddScript("Import-Module Microsoft.Graph.Entra -ErrorAction SilentlyContinue").Invoke() + $ps.AddScript("Import-Module Microsoft.Graph.Entra.DirectoryManagement -ErrorAction SilentlyContinue").Invoke() "Checking Information stream" | Out-Host $ps.Streams.Information.Count | Should -Be 0 "Checking Error stream" | Out-Host diff --git a/testVNext/Entra/DirectoryManagement/New-EntraAdministrativeUnit.Tests.ps1 b/testVNext/Entra/DirectoryManagement/New-EntraAdministrativeUnit.Tests.ps1 index decb8e231..8fc708577 100644 --- a/testVNext/Entra/DirectoryManagement/New-EntraAdministrativeUnit.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/New-EntraAdministrativeUnit.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll{ - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { @{ @@ -21,7 +21,7 @@ BeforeAll{ } } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Tests for New-EntraAdministrativeUnit"{ It "Result should not be empty"{ @@ -29,7 +29,7 @@ Describe "Tests for New-EntraAdministrativeUnit"{ $result | Should -Not -BeNullOrEmpty $result.id | should -Be @('aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb') $result.displayName | Should -Be "DummyName" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DisplayName is empty" { { New-EntraAdministrativeUnit -DisplayName "" } | Should -Throw "Cannot bind argument to parameter 'DisplayName'*" @@ -45,7 +45,7 @@ Describe "Tests for New-EntraAdministrativeUnit"{ $result = New-EntraAdministrativeUnit -DisplayName "DummyName" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraAdministrativeUnit" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/New-EntraAttributeSet.Tests.ps1 b/testVNext/Entra/DirectoryManagement/New-EntraAttributeSet.Tests.ps1 index 6b08b9c40..151ea9cf4 100644 --- a/testVNext/Entra/DirectoryManagement/New-EntraAttributeSet.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/New-EntraAttributeSet.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/Entra/DirectoryManagement/New-EntraCustomSecurityAttributeDefinition.Tests.ps1 b/testVNext/Entra/DirectoryManagement/New-EntraCustomSecurityAttributeDefinition.Tests.ps1 index aef412047..105679259 100644 --- a/testVNext/Entra/DirectoryManagement/New-EntraCustomSecurityAttributeDefinition.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/New-EntraCustomSecurityAttributeDefinition.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( [PSCustomObject]@{ diff --git a/testVNext/Entra/DirectoryManagement/New-EntraDirectoryRoleAssignment.Tests.ps1 b/testVNext/Entra/DirectoryManagement/New-EntraDirectoryRoleAssignment.Tests.ps1 deleted file mode 100644 index 541948b95..000000000 --- a/testVNext/Entra/DirectoryManagement/New-EntraDirectoryRoleAssignment.Tests.ps1 +++ /dev/null @@ -1,88 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. -# ------------------------------------------------------------------------------ -BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ - Import-Module Microsoft.Graph.Entra.DirectoryManagement - } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force - - $scriptblock = { - return @( - [PSCustomObject]@{ - "AppScope" = "Microsoft.Graph.PowerShell.Models.MicrosoftGraphAppScope" - "AppScopeId" = $null - "Id" = "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" - "DirectoryScope" = "Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject" - "DirectoryScopeId" = "/00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - "Condition" = $null - "Principal" = "Microsoft.Graph.PowerShell.Models.MicrosoftGraphDirectoryObject" - "PrincipalId" = "aaaaaaaa-bbbb-cccc-1111-222222222222" - "RoleDefinition" = "Microsoft.Graph.PowerShell.Models.MicrosoftGraphUnifiedRoleDefinition" - "RoleDefinitionId" = "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - "AdditionalProperties" = @{"@odata.context" = "https://graph.microsoft.com/v1.0/$metadata#roleManagement/directory/roleAssignments/$entity"} - "Parameters" = $args - } - ) - } - - Mock -CommandName New-MgRoleManagementDirectoryRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement -} - -Describe "New-EntraDirectoryRoleAssignment" { -Context "Test for New-EntraDirectoryRoleAssignment" { - It "Should return created Ms role assignment" { - $result = New-EntraDirectoryRoleAssignment -PrincipalId "aaaaaaaa-bbbb-cccc-1111-222222222222" -RoleDefinitionId "54d418b2-4cc0-47ee-9b39-e8f84ed8e073" -DirectoryScopeId "/54d418b2-4cc0-47ee-9b39-e8f84ed8e073" - $result | Should -Not -BeNullOrEmpty - $result.PrincipalId | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" - $result.RoleDefinitionId | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - $result.DirectoryScopeId | Should -Be "/00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - - Should -Invoke -CommandName New-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 - } - It "Should fail when PrincipalId is empty" { - { New-EntraDirectoryRoleAssignment -PrincipalId -RoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -DirectoryScopeId "/00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } | Should -Throw "Missing an argument for parameter 'PrincipalId'*" - } - It "Should fail when PrincipalId is invalid" { - { New-EntraDirectoryRoleAssignment -PrincipalId "" -RoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -DirectoryScopeId "/00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } | Should -Throw "Cannot bind argument to parameter 'PrincipalId' because it is an empty string." - } - It "Should fail when RoleDefinitionId is empty" { - { New-EntraDirectoryRoleAssignment -PrincipalId "aaaaaaaa-bbbb-cccc-1111-222222222222" -RoleDefinitionId -DirectoryScopeId "/00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } | Should -Throw "Missing an argument for parameter 'RoleDefinitionId'*" - } - It "Should fail when RoleDefinitionId is invalid" { - { New-EntraDirectoryRoleAssignment -PrincipalId "aaaaaaaa-bbbb-cccc-1111-222222222222" -RoleDefinitionId "" -DirectoryScopeId "/00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } | Should -Throw "Cannot bind argument to parameter 'RoleDefinitionId' because it is an empty string." - } - It "Should fail when DirectoryScopeId is empty" { - { New-EntraDirectoryRoleAssignment -PrincipalId "aaaaaaaa-bbbb-cccc-1111-222222222222" -RoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -DirectoryScopeId } | Should -Throw "Missing an argument for parameter 'DirectoryScopeId'*" - } - It "Result should Contain ObjectId" { - $result = New-EntraDirectoryRoleAssignment -PrincipalId "aaaaaaaa-bbbb-cccc-1111-222222222222" -RoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -DirectoryScopeId "/00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - $result.ObjectId | should -Be "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" - } - It "Should contain 'User-Agent' header" { - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraDirectoryRoleAssignment" - - New-EntraDirectoryRoleAssignment -PrincipalId "aaaaaaaa-bbbb-cccc-1111-222222222222" -RoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -DirectoryScopeId "/00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraDirectoryRoleAssignment" - - Should -Invoke -CommandName New-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { - $Headers.'User-Agent' | Should -Be $userAgentHeaderValue - $true - } - } - It "Should execute successfully without throwing an error" { - # Disable confirmation prompts - $originalDebugPreference = $DebugPreference - $DebugPreference = 'Continue' - - try { - # Act & Assert: Ensure the function doesn't throw an exception - { New-EntraDirectoryRoleAssignment -PrincipalId "aaaaaaaa-bbbb-cccc-1111-222222222222" -RoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -DirectoryScopeId "/00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Debug } | Should -Not -Throw - } finally { - # Restore original confirmation preference - $DebugPreference = $originalDebugPreference - } - } - } -} diff --git a/testVNext/Entra/DirectoryManagement/New-EntraDomain.Tests.ps1 b/testVNext/Entra/DirectoryManagement/New-EntraDomain.Tests.ps1 index 526f492be..8bc101403 100644 --- a/testVNext/Entra/DirectoryManagement/New-EntraDomain.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/New-EntraDomain.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -29,7 +29,7 @@ BeforeAll { ) } - Mock -CommandName New-MgDomain -MockWith $scriptBlock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgDomain -MockWith $scriptBlock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "New-EntraDomain" { @@ -39,7 +39,7 @@ Describe "New-EntraDomain" { $result.ObjectId | should -Be "lala.uk" $result.Name | should -Be "lala.uk" - Should -Invoke -CommandName New-MgDomain -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgDomain -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Create a new Domain with a list of domain capabilities" { @@ -88,7 +88,7 @@ Describe "New-EntraDomain" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraDomain" - Should -Invoke -CommandName New-MgDomain -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgDomain -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Remove-EntraAdministrativeUnit.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Remove-EntraAdministrativeUnit.Tests.ps1 index eaec460fe..54abf0818 100644 --- a/testVNext/Entra/DirectoryManagement/Remove-EntraAdministrativeUnit.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Remove-EntraAdministrativeUnit.Tests.ps1 @@ -2,19 +2,19 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Test for Remove-EntraAdministrativeUnit" { It "Should return empty object" { $result = Remove-EntraAdministrativeUnit -AdministrativeUnitId bbbbbbbb-1111-1111-1111-cccccccccccc $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when AdministrativeUnitId is empty" { { Remove-EntraAdministrativeUnit -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" @@ -32,7 +32,7 @@ Describe "Test for Remove-EntraAdministrativeUnit" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraAdministrativeUnit" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Remove-EntraAdministrativeUnitMember.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Remove-EntraAdministrativeUnitMember.Tests.ps1 index 9aa44a82f..624069e0f 100644 --- a/testVNext/Entra/DirectoryManagement/Remove-EntraAdministrativeUnitMember.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Remove-EntraAdministrativeUnitMember.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $auId = "bbbbbbbb-1111-1111-1111-cccccccccccc" $memId = "bbbbbbbb-2222-2222-2222-cccccccccccc" @@ -17,12 +17,12 @@ Describe "Test for Remove-EntraAdministrativeUnitMember" { It "Should return empty object" { $result = Remove-EntraAdministrativeUnitMember -AdministrativeUnitId $auId -MemberId $memId $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return empty object with ObjectId" { $result = Remove-EntraAdministrativeUnitMember -ObjectId $auId -MemberId $memId $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when AdministrativeUnitId is empty" { { Remove-EntraAdministrativeUnitMember -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" @@ -46,7 +46,7 @@ Describe "Test for Remove-EntraAdministrativeUnitMember" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraAdministrativeUnitMember" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Remove-EntraDevice.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Remove-EntraDevice.Tests.ps1 index 1cc157005..c78c13796 100644 --- a/testVNext/Entra/DirectoryManagement/Remove-EntraDevice.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Remove-EntraDevice.Tests.ps1 @@ -3,12 +3,12 @@ # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgDevice -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDevice -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Remove-EntraDevice" { @@ -17,13 +17,13 @@ Describe "Remove-EntraDevice" { $result = Remove-EntraDevice -DeviceId bbbbbbbb-1111-2222-3333-cccccccccccc $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgDevice -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should execute successfully with Alias" { $result = Remove-EntraDevice -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgDevice -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DeviceId is invalid" { { Remove-EntraDevice -DeviceId "" } | Should -Throw "Cannot bind argument to parameter 'DeviceId' because it is an empty string." @@ -32,7 +32,7 @@ Describe "Remove-EntraDevice" { { Remove-EntraDevice -DeviceId } | Should -Throw "Missing an argument for parameter 'DeviceId'*" } It "Should contain DeviceId in parameters when passed DeviceId to it" { - Mock -CommandName Remove-MgDevice -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDevice -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Remove-EntraDevice -DeviceId bbbbbbbb-1111-2222-3333-cccccccccccc $params = Get-Parameters -data $result @@ -45,7 +45,7 @@ Describe "Remove-EntraDevice" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDevice" - Should -Invoke -CommandName Remove-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgDevice -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Remove-EntraDeviceRegisteredOwner.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Remove-EntraDeviceRegisteredOwner.Tests.ps1 index 3e7a53107..9c70ddd44 100644 --- a/testVNext/Entra/DirectoryManagement/Remove-EntraDeviceRegisteredOwner.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Remove-EntraDeviceRegisteredOwner.Tests.ps1 @@ -2,13 +2,13 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - #Import-Module .\bin\Microsoft.Graph.Entra.psm1 -Force - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + #Import-Module .\bin\Microsoft.Graph.Entra.DirectoryManagement.psm1 -Force + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module .\test\module\Common-Functions.ps1 -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgDeviceRegisteredOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDeviceRegisteredOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Remove-EntraDeviceRegisteredOwner" { @@ -17,13 +17,13 @@ Describe "Remove-EntraDeviceRegisteredOwner" { $result = Remove-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should execute successfully with Alias" { $result = Remove-EntraDeviceRegisteredOwner -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DeviceId is empty" { { Remove-EntraDeviceRegisteredOwner -DeviceId -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -Throw "Missing an argument for parameter 'DeviceId'*" } @@ -38,14 +38,14 @@ Describe "Remove-EntraDeviceRegisteredOwner" { { Remove-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "" | Should -Throw "Cannot bind argument to parameter 'OwnerId' because it is an empty string.*" } } It "Should contain DeviceId in parameters when passed OwnerId to it" { - Mock -CommandName Remove-MgDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Remove-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.DeviceId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain DirectoryObjectId in parameters when passed OwnerId to it" { - Mock -CommandName Remove-MgDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDeviceRegisteredOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Remove-EntraDeviceRegisteredOwner -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -OwnerId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result @@ -59,7 +59,7 @@ Describe "Remove-EntraDeviceRegisteredOwner" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDeviceRegisteredOwner" - Should -Invoke -CommandName Remove-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgDeviceRegisteredOwnerByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Remove-EntraDeviceRegisteredUser.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Remove-EntraDeviceRegisteredUser.Tests.ps1 index b2f4e8fa4..162f66890 100644 --- a/testVNext/Entra/DirectoryManagement/Remove-EntraDeviceRegisteredUser.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Remove-EntraDeviceRegisteredUser.Tests.ps1 @@ -2,13 +2,13 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - #Import-Module .\bin\Microsoft.Graph.Entra.psm1 -Force - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + #Import-Module .\bin\Microsoft.Graph.Entra.DirectoryManagement.psm1 -Force + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module .\test\module\Common-Functions.ps1 -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgDeviceRegisteredUserByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDeviceRegisteredUserByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Remove-EntraDeviceRegisteredUser" { @@ -17,13 +17,13 @@ Describe "Remove-EntraDeviceRegisteredUser" { $result = Remove-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should execute successfully with Alias" { $result = Remove-EntraDeviceRegisteredUser -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DeviceId is empty" { { Remove-EntraDeviceRegisteredUser -DeviceId -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" | Should -Throw "Missing an argument for parameter 'DeviceId'*" } @@ -38,14 +38,14 @@ Describe "Remove-EntraDeviceRegisteredUser" { { Remove-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "" | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string.*" } } It "Should contain DeviceId in parameters when passed UserId to it" { - Mock -CommandName Remove-MgDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Remove-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.DeviceId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain DirectoryObjectId in parameters when passed UserId to it" { - Mock -CommandName Remove-MgDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDeviceRegisteredUserByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Remove-EntraDeviceRegisteredUser -DeviceId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result @@ -59,7 +59,7 @@ Describe "Remove-EntraDeviceRegisteredUser" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDeviceRegisteredUser" - Should -Invoke -CommandName Remove-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgDeviceRegisteredUserByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Remove-EntraDirectoryRoleMember.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Remove-EntraDirectoryRoleMember.Tests.ps1 index a7f52b489..3b0ebcb55 100644 --- a/testVNext/Entra/DirectoryManagement/Remove-EntraDirectoryRoleMember.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Remove-EntraDirectoryRoleMember.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgDirectoryRoleMemberByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDirectoryRoleMemberByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Remove-EntraDirectoryRoleMember" { @@ -16,13 +16,13 @@ Describe "Remove-EntraDirectoryRoleMember" { $result = Remove-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return empty object with alias" { $result = Remove-EntraDirectoryRoleMember -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DirectoryRoleId is empty" { { Remove-EntraDirectoryRoleMember -DirectoryRoleId -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'DirectoryRoleId'*" @@ -37,14 +37,14 @@ Describe "Remove-EntraDirectoryRoleMember" { { Remove-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "" } | Should -Throw "Cannot bind argument to parameter 'MemberId' because it is an empty string." } It "Should contain DirectoryRoleId in parameters when passed ObjectId to it" { - Mock -CommandName Remove-MgDirectoryRoleMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDirectoryRoleMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Remove-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result $params.DirectoryRoleId | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" } It "Should contain DirectoryObjectId in parameters when passed RefObjectId to it" { - Mock -CommandName Remove-MgDirectoryRoleMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDirectoryRoleMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Remove-EntraDirectoryRoleMember -DirectoryRoleId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -MemberId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result @@ -57,7 +57,7 @@ Describe "Remove-EntraDirectoryRoleMember" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDirectoryRoleMember" - Should -Invoke -CommandName Remove-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgDirectoryRoleMemberByRef -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Remove-EntraDomain.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Remove-EntraDomain.Tests.ps1 index eefa38c96..a14ef7328 100644 --- a/testVNext/Entra/DirectoryManagement/Remove-EntraDomain.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Remove-EntraDomain.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgDomain -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDomain -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Remove-EntraDomain" { @@ -16,7 +16,7 @@ Describe "Remove-EntraDomain" { $result = Remove-EntraDomain -Name "Contoso.com" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgDomain -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgDomain -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Name is empty" { @@ -28,7 +28,7 @@ Describe "Remove-EntraDomain" { } It "Should contain DomainId in parameters when passed Name to it" { - Mock -CommandName Remove-MgDomain -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgDomain -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Remove-EntraDomain -Name "Contoso.com" $params = Get-Parameters -data $result @@ -42,7 +42,7 @@ Describe "Remove-EntraDomain" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraDomain" - Should -Invoke -CommandName Remove-MgDomain -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgDomain -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Remove-EntraScopedRoleMembership.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Remove-EntraScopedRoleMembership.Tests.ps1 index 31a0e682a..31800cc99 100644 --- a/testVNext/Entra/DirectoryManagement/Remove-EntraScopedRoleMembership.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Remove-EntraScopedRoleMembership.Tests.ps1 @@ -2,24 +2,24 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Test for Remove-EntraScopedRoleMembership" { It "Should return empty object" { $result = Remove-EntraScopedRoleMembership -AdministrativeUnitId bbbbbbbb-1111-1111-1111-cccccccccccc -ScopedRoleMembershipId bbbbbbbb-2222-2222-2222-cccccccccccc $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return empty object with ObjectId" { $result = Remove-EntraScopedRoleMembership -ObjectId bbbbbbbb-1111-1111-1111-cccccccccccc -ScopedRoleMembershipId bbbbbbbb-2222-2222-2222-cccccccccccc $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when AdministrativeUnitId is empty" { { Remove-EntraScopedRoleMembership -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" @@ -43,7 +43,7 @@ Describe "Test for Remove-EntraScopedRoleMembership" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraScopedRoleMembership" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Restore-EntraDeletedDirectoryObject.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Restore-EntraDeletedDirectoryObject.Tests.ps1 index b8b20e12f..a8c74dc31 100644 --- a/testVNext/Entra/DirectoryManagement/Restore-EntraDeletedDirectoryObject.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Restore-EntraDeletedDirectoryObject.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -23,7 +23,7 @@ BeforeAll { ) } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Restore-EntraDeletedDirectoryObject" { Context "Restore-EntraDeletedDirectoryObject" { @@ -31,13 +31,13 @@ Describe "Restore-EntraDeletedDirectoryObject" { $result = Restore-EntraDeletedDirectoryObject -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return specific MS deleted directory object with AutoReconcileProxyConflict" { $result = Restore-EntraDeletedDirectoryObject -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AutoReconcileProxyConflict $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Id is empty" { { Restore-EntraDeletedDirectoryObject -Id } | Should -Throw "Missing an argument for parameter 'Id'*" @@ -54,7 +54,7 @@ Describe "Restore-EntraDeletedDirectoryObject" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Restore-EntraDeletedDirectoryObject" Restore-EntraDeletedDirectoryObject -Id "11112222-bbbb-3333-cccc-4444dddd5555" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Restore-EntraDeletedDirectoryObject" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Set-EntraAdministrativeUnit.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Set-EntraAdministrativeUnit.Tests.ps1 index 93b6de6e8..5f6339076 100644 --- a/testVNext/Entra/DirectoryManagement/Set-EntraAdministrativeUnit.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Set-EntraAdministrativeUnit.Tests.ps1 @@ -2,24 +2,24 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Test for Set-EntraAdministrativeUnit" { It "Should return empty object" { $result = Set-EntraAdministrativeUnit -AdministrativeUnitId bbbbbbbb-1111-1111-1111-cccccccccccc -DisplayName "test" -Description "test" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should return empty object withObjectID" { $result = Set-EntraAdministrativeUnit -ObjectId bbbbbbbb-1111-1111-1111-cccccccccccc -DisplayName "test" -Description "test" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when AdministrativeUnitId is empty" { { Set-EntraAdministrativeUnit -AdministrativeUnitId "" } | Should -Throw "Cannot bind argument to parameter 'AdministrativeUnitId'*" @@ -33,7 +33,7 @@ Describe "Test for Set-EntraAdministrativeUnit" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraAdministrativeUnit" Set-EntraAdministrativeUnit -AdministrativeUnitId bbbbbbbb-1111-1111-1111-cccccccccccc -DisplayName "test" -Description "test" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Set-EntraAttributeSet.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Set-EntraAttributeSet.Tests.ps1 index c3ea97c21..00f0c4fdd 100644 --- a/testVNext/Entra/DirectoryManagement/Set-EntraAttributeSet.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Set-EntraAttributeSet.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } diff --git a/testVNext/Entra/DirectoryManagement/Set-EntraCustomSecurityAttributeDefinition.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Set-EntraCustomSecurityAttributeDefinition.Tests.ps1 index 5fe403004..50c707cdf 100644 --- a/testVNext/Entra/DirectoryManagement/Set-EntraCustomSecurityAttributeDefinition.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Set-EntraCustomSecurityAttributeDefinition.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } diff --git a/testVNext/Entra/DirectoryManagement/Set-EntraCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Set-EntraCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 index bc5943b56..8af4d0030 100644 --- a/testVNext/Entra/DirectoryManagement/Set-EntraCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Set-EntraCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } diff --git a/testVNext/Entra/DirectoryManagement/Set-EntraDevice.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Set-EntraDevice.Tests.ps1 index 2c5566fe0..b5abc863b 100644 --- a/testVNext/Entra/DirectoryManagement/Set-EntraDevice.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Set-EntraDevice.Tests.ps1 @@ -3,12 +3,12 @@ # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Update-MgDevice -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgDevice -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Set-EntraDevice"{ @@ -17,13 +17,13 @@ Describe "Set-EntraDevice"{ $result = Set-EntraDevice -DeviceObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "Mock-App" -AccountEnabled $true $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgDevice -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should execute successfully with Alias" { $result = Set-EntraDevice -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "Mock-App" -AccountEnabled $true $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgDevice -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DeviceObjectId is invalid" { { Set-EntraDevice -DeviceObjectId "" } | Should -Throw "Cannot bind argument to parameter 'DeviceObjectId' because it is an empty string." @@ -32,7 +32,7 @@ Describe "Set-EntraDevice"{ { Set-EntraDevice -DeviceObjectId } | Should -Throw "Missing an argument for parameter 'DeviceObjectId'*" } It "Should contain DeviceId in parameters when passed DeviceObjectId to it" { - Mock -CommandName Update-MgDevice -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgDevice -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Set-EntraDevice -DeviceObjectId bbbbbbbb-1111-2222-3333-cccccccccccc $params = Get-Parameters -data $result @@ -45,7 +45,7 @@ Describe "Set-EntraDevice"{ $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraDevice" - Should -Invoke -CommandName Update-MgDevice -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgDevice -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Set-EntraDirSyncConfiguration.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Set-EntraDirSyncConfiguration.Tests.ps1 index d10e09444..6dc0fca71 100644 --- a/testVNext/Entra/DirectoryManagement/Set-EntraDirSyncConfiguration.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Set-EntraDirSyncConfiguration.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( [PSCustomObject]@{ @@ -14,16 +14,16 @@ BeforeAll { } ) } - Mock -CommandName Get-MgDirectoryOnPremiseSynchronization -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDirectoryOnPremiseSynchronization -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement - Mock -CommandName Update-MgDirectoryOnPremiseSynchronization -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgDirectoryOnPremiseSynchronization -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Set-EntraDirSyncConfiguration" { Context "Test for Set-EntraDirSyncConfiguration" { It "Should Modifies the directory synchronization settings." { $result = Set-EntraDirSyncConfiguration -AccidentalDeletionThreshold "111" -TenantId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Force $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when AccidentalDeletionThreshold is empty" { @@ -52,7 +52,7 @@ Describe "Set-EntraDirSyncConfiguration" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraDirSyncConfiguration" - Should -Invoke -CommandName Update-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Set-EntraDirSyncEnabled.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Set-EntraDirSyncEnabled.Tests.ps1 index 790d50fd1..a79acb5bb 100644 --- a/testVNext/Entra/DirectoryManagement/Set-EntraDirSyncEnabled.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Set-EntraDirSyncEnabled.Tests.ps1 @@ -3,12 +3,12 @@ # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Set-EntraDirSyncEnabled" { @@ -16,7 +16,7 @@ Describe "Set-EntraDirSyncEnabled" { It "Should return empty object" { $result = Set-EntraDirSyncEnabled -EnableDirsync $True -TenantId 'aaaaaaaa-1111-1111-1111-000000000000' -Force $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when EnableDirsync is empty" { @@ -41,7 +41,7 @@ Describe "Set-EntraDirSyncEnabled" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraDirSyncEnabled" Set-EntraDirSyncEnabled -EnableDirsync $True -TenantId 'aaaaaaaa-1111-1111-1111-000000000000' -Force | Out-Null - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Set-EntraDirSyncFeature.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Set-EntraDirSyncFeature.Tests.ps1 index ecea93e5c..82211abc7 100644 --- a/testVNext/Entra/DirectoryManagement/Set-EntraDirSyncFeature.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Set-EntraDirSyncFeature.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( [PSCustomObject]@{ @@ -14,16 +14,16 @@ BeforeAll { } ) } - Mock -CommandName Get-MgDirectoryOnPremiseSynchronization -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDirectoryOnPremiseSynchronization -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement - Mock -CommandName Update-MgDirectoryOnPremiseSynchronization -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgDirectoryOnPremiseSynchronization -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Set-EntraDirSyncFeature" { Context "Test for Set-EntraDirSyncFeature" { It "Should sets identity synchronization features for a tenant." { $result = Set-EntraDirSyncFeature -Feature "BypassDirSyncOverrides" -Enabled $false -TenantId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Force $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Feature is empty" { @@ -60,7 +60,7 @@ Describe "Set-EntraDirSyncFeature" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraDirSyncFeature" - Should -Invoke -CommandName Update-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgDirectoryOnPremiseSynchronization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Set-EntraDirectoryRoleDefinition.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Set-EntraDirectoryRoleDefinition.Tests.ps1 deleted file mode 100644 index b47a11005..000000000 --- a/testVNext/Entra/DirectoryManagement/Set-EntraDirectoryRoleDefinition.Tests.ps1 +++ /dev/null @@ -1,110 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. -# ------------------------------------------------------------------------------ -BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ - Import-Module Microsoft.Graph.Entra.DirectoryManagement - } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force - - Mock -CommandName Update-MgRoleManagementDirectoryRoleDefinition -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement -} - -Describe "Set-EntraDirectoryRoleDefinition" { - Context "Test for Set-EntraDirectoryRoleDefinition" { - It "Should return empty object" { - $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission - $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - $result = Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions $RolePermissions -IsEnabled $false -DisplayName 'Mock-App' -ResourceScopes "/" -Description "Mock-App" -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 3 - $result | Should -BeNullOrEmpty - - Should -Invoke -CommandName Update-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 - } - It "Should execute successfully with Alias" { - $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission - $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - $result = Set-EntraDirectoryRoleDefinition -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions $RolePermissions -IsEnabled $false -DisplayName 'Mock-App' -ResourceScopes "/" -Description "Mock-App" -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 3 - $result | Should -BeNullOrEmpty - - Should -Invoke -CommandName Update-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 - } - It "Should fail when UnifiedRoleDefinitionId is empty" { - { Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId -DisplayName 'Mock-App' -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" } | Should -Throw "Missing an argument for parameter 'UnifiedRoleDefinitionId'*" - } - It "Should fail when UnifiedRoleDefinitionId is invalid" { - { Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "" -IsEnabled $false -DisplayName 'Mock-App' -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 3 } | Should -Throw "Cannot bind argument to parameter 'UnifiedRoleDefinitionId' because it is an empty string*" - } - It "Should fail when RolePermissions is empty" { - {Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions } | Should -Throw "Missing an argument for parameter 'RolePermissions'*" - } - It "Should fail when IsEnabled is empty" { - $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission - $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - {Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -IsEnabled } | Should -Throw "Missing an argument for parameter 'IsEnabled'*" - } - It "Should fail when DisplayName is empty" { - $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission - $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - {Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -DisplayName } | Should -Throw "Missing an argument for parameter 'DisplayName'*" - } - It "Should fail when ResourceScopes is empty" { - $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission - $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - {Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -ResourceScopes } | Should -Throw "Missing an argument for parameter 'ResourceScopes'*" - } - It "Should fail when Description is empty" { - $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission - $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - {Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Description } | Should -Throw "Missing an argument for parameter 'Description'*" - } - It "Should fail when TemplateId is empty" { - $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission - $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - {Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -TemplateId } | Should -Throw "Missing an argument for parameter 'TemplateId'*" - } - It "Should fail when Version is empty" { - $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission - $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - {Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -Version } | Should -Throw "Missing an argument for parameter 'Version'*" - } - It "Should contain UnifiedRoleDefinitionId in parameters when passed Id to it" { - Mock -CommandName Update-MgRoleManagementDirectoryRoleDefinition -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement - - $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission - $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - $result = Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions $RolePermissions -IsEnabled $false -DisplayName 'Mock-App' -ResourceScopes "/" -Description "Mock-App" -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 2 - $params = Get-Parameters -data $result - $params.UnifiedRoleDefinitionId | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - } - It "Should contain 'User-Agent' header" { - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraDirectoryRoleDefinition" - - $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission - $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions $RolePermissions -IsEnabled $false -DisplayName 'Mock-App' -ResourceScopes "/" -Description "Mock-App" -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 2 - - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraDirectoryRoleDefinition" - - Should -Invoke -CommandName Update-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { - $Headers.'User-Agent' | Should -Be $userAgentHeaderValue - $true - } - } - It "Should execute successfully without throwing an error" { - # Disable confirmation prompts - $originalDebugPreference = $DebugPreference - $DebugPreference = 'Continue' - $RolePermissions = New-object Microsoft.Open.MSGraph.Model.RolePermission - $RolePermissions.AllowedResourceActions = @("microsoft.directory/applications/basic/read") - - try { - # Act & Assert: Ensure the function doesn't throw an exception - { Set-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -RolePermissions $RolePermissions -IsEnabled $false -DisplayName 'Mock-App' -ResourceScopes "/" -Description "Mock-App" -TemplateId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" -Version 2 -Debug } | Should -Not -Throw - } finally { - # Restore original confirmation preference - $DebugPreference = $originalDebugPreference - } - } - - } -} diff --git a/testVNext/Entra/DirectoryManagement/Set-EntraDomain.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Set-EntraDomain.Tests.ps1 index b17118a9a..c5d627715 100644 --- a/testVNext/Entra/DirectoryManagement/Set-EntraDomain.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Set-EntraDomain.Tests.ps1 @@ -2,13 +2,13 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ - Import-Module Microsoft.Graph.Entra + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Update-MgDomain -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgDomain -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Set-EntraDomain"{ @@ -17,7 +17,7 @@ Describe "Set-EntraDomain"{ $result = Set-EntraDomain -Name "test.mail.onmicrosoft.com" -IsDefault $True -SupportedServices @("OrgIdAuthentication") $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgDomain -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgDomain -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when Name is empty" { { Set-EntraDomain -Name } | Should -Throw "Missing an argument for parameter 'Name'*" @@ -40,7 +40,7 @@ Describe "Set-EntraDomain"{ } It "Should contain DomainId in parameters when passed Name to it" { - Mock -CommandName Update-MgDomain -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgDomain -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Set-EntraDomain -Name "test.mail.onmicrosoft.com" $params = Get-Parameters -data $result @@ -53,7 +53,7 @@ Describe "Set-EntraDomain"{ $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraDomain" - Should -Invoke -CommandName Update-MgDomain -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgDomain -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Set-EntraDomainFederationSettings.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Set-EntraDomainFederationSettings.Tests.ps1 index 382c9fca5..28e1ed12b 100644 --- a/testVNext/Entra/DirectoryManagement/Set-EntraDomainFederationSettings.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Set-EntraDomainFederationSettings.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( [PSCustomObject]@{ @@ -29,16 +29,16 @@ BeforeAll { } ) } - Mock -CommandName Get-MgDomainFederationConfiguration -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDomainFederationConfiguration -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement - Mock -CommandName Update-MgDomainFederationConfiguration -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgDomainFederationConfiguration -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Set-EntraDomainFederationSettings" { Context "Test for Set-EntraDomainFederationSettings" { It "Should Updates settings for a federated domain." { $result = Set-EntraDomainFederationSettings -DomainName "contoso.com" -LogOffUri "https://adfs1.manan.lab/adfs/" -PassiveLogOnUri "https://adfs1.manan.lab/adfs/" -ActiveLogOnUri "https://adfs1.manan.lab/adfs/services/trust/2005/" -IssuerUri "http://adfs1.manan.lab/adfs/services/" -FederationBrandName "ADFS" -MetadataExchangeUri "https://adfs1.manan.lab/adfs/services/trust/" -PreferredAuthenticationProtocol "saml" -PromptLoginBehavior "nativeSupport" -SigningCertificate "Testcertificate" -NextSigningCertificate "Testcertificate" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgDomainFederationConfiguration -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgDomainFederationConfiguration -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when DomainName is empty" { @@ -63,7 +63,7 @@ Describe "Set-EntraDomainFederationSettings" { {Set-EntraDomainFederationSettings -Demo } | Should -Throw "A parameter cannot be found that matches parameter name 'Demo'*" } It "Should contain DomainId in parameters when DomainName to it" { - Mock -CommandName Update-MgDomainFederationConfiguration -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgDomainFederationConfiguration -MockWith {$args} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Set-EntraDomainFederationSettings -DomainName "contoso.com" $params = Get-Parameters -data $result $a= $params | ConvertTo-json | ConvertFrom-Json @@ -76,7 +76,7 @@ Describe "Set-EntraDomainFederationSettings" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraDomainFederationSettings" - Should -Invoke -CommandName Update-MgDomainFederationConfiguration -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgDomainFederationConfiguration -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Set-EntraPartnerInformation.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Set-EntraPartnerInformation.Tests.ps1 index ee9509eb9..152d68323 100644 --- a/testVNext/Entra/DirectoryManagement/Set-EntraPartnerInformation.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Set-EntraPartnerInformation.Tests.ps1 @@ -3,12 +3,12 @@ # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null) { + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Invoke-MgGraphRequest -ModuleName Microsoft.Graph.Entra -MockWith { + Mock -CommandName Invoke-MgGraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -MockWith { return @{ value = @( @{ @@ -23,10 +23,10 @@ BeforeAll { Describe "Set-EntraPartnerInformation" { Context "Test for Set-EntraPartnerInformation" { It "Should return empty object" { - Mock -CommandName Invoke-MgGraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-MgGraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Set-EntraPartnerInformation -PartnerSupportUrl "http://www.test1.com" -PartnerCommerceUrl "http://www.test1.com" -PartnerHelpUrl "http://www.test1.com" -PartnerSupportEmails "contoso@example.com" -PartnerSupportTelephones "2342" -TenantId b73cc049-a025-4441-ba3a-8826d9a68ecc $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-MgGraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-MgGraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when PartnerSupportUrl is empty" { { Set-EntraPartnerInformation -PartnerSupportUrl } | Should -Throw "Missing an argument for parameter 'PartnerSupportUrl'*" @@ -66,7 +66,7 @@ Describe "Set-EntraPartnerInformation" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraPartnerInformation" - Should -Invoke -CommandName Invoke-MgGraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-MgGraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Set-EntraTenantDetail.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Set-EntraTenantDetail.Tests.ps1 index 24ce2b025..07a69df17 100644 --- a/testVNext/Entra/DirectoryManagement/Set-EntraTenantDetail.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Set-EntraTenantDetail.Tests.ps1 @@ -2,8 +2,8 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } $scriptblock = { @@ -11,9 +11,9 @@ BeforeAll { "Id" = "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" } } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force - Mock -CommandName Get-MgOrganization -MockWith {$scriptblock} -ModuleName Microsoft.Graph.Entra - Mock -CommandName Update-MgOrganization -MockWith {} -ModuleName Microsoft.Graph.Entra + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force + Mock -CommandName Get-MgOrganization -MockWith {$scriptblock} -ModuleName Microsoft.Graph.Entra.DirectoryManagement + Mock -CommandName Update-MgOrganization -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement } Describe "Set-EntraTenantDetail" { @@ -21,7 +21,7 @@ Describe "Set-EntraTenantDetail" { It "Should return empty object" { $result = Set-EntraTenantDetail -MarketingNotificationEmails "amy@contoso.com","henry@contoso.com" -SecurityComplianceNotificationMails "john@contoso.com","mary@contoso.com" -SecurityComplianceNotificationPhones "1-555-625-9999", "1-555-233-5544" -TechnicalNotificationMails "peter@contoso.com" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgOrganization -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgOrganization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } It "Should fail when MarketingNotificationEmails is empty" { { Set-EntraTenantDetail -MarketingNotificationEmails } | Should -Throw "Missing an argument for parameter 'MarketingNotificationEmails'.*" @@ -42,7 +42,7 @@ Describe "Set-EntraTenantDetail" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraTenantDetail" - Should -Invoke -CommandName Update-MgOrganization -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgOrganization -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Valid.Tests.ps1 b/testVNext/Entra/DirectoryManagement/Valid.Tests.ps1 index 5013e8327..bad9e7540 100644 --- a/testVNext/Entra/DirectoryManagement/Valid.Tests.ps1 +++ b/testVNext/Entra/DirectoryManagement/Valid.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll{ - if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module Microsoft.Graph.Entra + if($null -eq (Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement)){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement } - Import-Module (Join-Path $psscriptroot ".\EntraCmdletsMap.ps1") -Force + Import-Module (Join-Path $psscriptroot "..\EntraCmdletsMap.ps1") -Force - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement } Describe "Valid parameter Tests"{ @@ -20,23 +20,23 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | Select-Object -expand Name) - if($params.count -eq 1 -and $params -eq 'Id'){ + if(($params -eq 'Id') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'Id')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { Write-Host "$command" $commandScriptBlock = [scriptblock]::Create("$commandName -Id 056b2531-005e-4f3e-be78-01a71ea30a04") if($filter.IsApi){ - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } else { - Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } } catch { @@ -58,23 +58,23 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | select -expand Name) - if($params.count -eq 1 -and $params -eq 'ObjectId'){ + if(($params -eq 'ObjectId') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'ObjectId')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { Write-Host "$command" $commandScriptBlock = [scriptblock]::Create("$commandName -ObjectId 056b2531-005e-4f3e-be78-01a71ea30a04") if($filter.IsApi){ - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } else { - Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra.DirectoryManagement $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 } } catch { diff --git a/testVNext/Entra/Entra.Tests.ps1 b/testVNext/Entra/Entra.Tests.ps1 new file mode 100644 index 000000000..db2f14645 --- /dev/null +++ b/testVNext/Entra/Entra.Tests.ps1 @@ -0,0 +1,54 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ + +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Authentication)){ + Import-Module Microsoft.Graph.Entra.Authentication -Force +} +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Applications)){ + Import-Module Microsoft.Graph.Entra.Applications -Force +} +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement)){ + Import-Module Microsoft.Graph.Entra.DirectoryManagement -Force +} +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Governance)){ + Import-Module Microsoft.Graph.Entra.Governance -Force +} +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Users)){ + Import-Module Microsoft.Graph.Entra.Users -Force +} +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Groups)){ + Import-Module Microsoft.Graph.Entra.Groups -Force +} +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Reports)){ + Import-Module Microsoft.Graph.Entra.Reports -Force +} +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.SignIns)){ + Import-Module Microsoft.Graph.Entra.SignIns -Force +} + +Import-Module Pester + +#$psmPath = (Get-Module Microsoft.Graph.Entra.Applications).Path +$ps1FilesPath = join-path $psscriptroot "..\..\moduleVNext\Entra\Microsoft.Graph.Entra" +$testReportPath = join-path $psscriptroot "..\..\TestReport\Entra" +$mockScriptsPath = join-path $psscriptroot "..\..\testVNext\Entra\*\*.Tests.ps1" + +$testOutputFile = "$testReportPath\TestResults.xml" +if (!(test-path -path $testReportPath)) {new-item -path $testReportPath -itemtype directory} + +$mockScripts = Get-ChildItem -Path $mockScriptsPath -Exclude "Entra.Tests.ps1" | ForEach-Object { $_.FullName } + +$config = New-PesterConfiguration +$config.Run.Path = $mockScripts +$config.Run.PassThru = $true +$config.Run.Exit = $true +$config.CodeCoverage.Enabled = $true +$config.CodeCoverage.CoveragePercentTarget = 100 +#$config.CodeCoverage.Path = $psmPath +$config.CodeCoverage.Path = $ps1FilesPath +$config.TestResult.Enabled = $true +$config.TestResult.OutputPath = $testOutputFile +$config.Output.Verbosity = "Detailed" + +Invoke-Pester -Configuration $config \ No newline at end of file diff --git a/testVNext/Entra/EntraCmdletsMap.ps1 b/testVNext/Entra/EntraCmdletsMap.ps1 new file mode 100644 index 000000000..d83a5ca5b --- /dev/null +++ b/testVNext/Entra/EntraCmdletsMap.ps1 @@ -0,0 +1,413 @@ +$cmdlets = @( + @{ + SourceName = "Remove-EntraAdministrativeUnit"; + TargetName = "Remove-MgDirectoryAdministrativeUnit"; + IsApi = $false + }, + @{ + SourceName = "Remove-EntraDeletedDirectoryObject"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Remove-EntraGroup"; + TargetName = "Remove-MgGroup"; + IsApi = $false + }, + @{ + SourceName = "Remove-EntraGroupLifecyclePolicy"; + TargetName = "Remove-MgGroupLifecyclePolicy"; + IsApi = $false + }, + @{ + SourceName = "Remove-EntraIdentityProvider"; + TargetName = "Remove-MgIdentityProvider"; + IsApi = $false + }, + @{ + SourceName = "Remove-EntraPermissionGrantPolicy"; + TargetName = "Remove-MgPolicyPermissionGrantPolicy"; + IsApi = $false + }, + @{ + SourceName = "Remove-EntraRoleAssignment"; + TargetName = "Remove-MgRoleManagementDirectoryRoleAssignment" + IsApi = $false + }, + @{ + SourceName = "Remove-EntraRoleDefinition"; + TargetName = "Remove-MgRoleManagementDirectoryRoleDefinition"; + IsApi = $false + }, + # @{ + # SourceName = "Remove-EntraApplication"; + # TargetName = "Remove-MgApplication"; + # IsApi = $false + # }, + @{ + SourceName = "Remove-EntraContact"; + TargetName = "Remove-MgContact"; + IsApi = $false + }, + @{ + SourceName = "Remove-EntraDeletedApplication"; + TargetName = "Remove-MgDirectoryDeletedItem"; + IsApi = $false + }, + @{ + SourceName = "Remove-EntraDevice"; + TargetName = "Remove-MgDevice"; + IsApi = $false + }, + # @{ + # SourceName = "Remove-EntraGroup"; + # TargetName = "Remove-MgGroup"; + # IsApi = $false + # }, + @{ + SourceName = "Remove-EntraApplication"; + TargetName = "Remove-MgApplication"; + IsApi = $false + }, + @{ + SourceName = "Remove-EntraApplicationKey"; + TargetName = "Remove-MgApplicationKey"; + IsApi = $false + }, + @{ + SourceName = "Remove-EntraApplicationPassword"; + TargetName = "Remove-MgApplicationPassword"; + IsApi = $false + }, + @{ + SourceName = "Remove-EntraOAuth2PermissionGrant"; + TargetName = "Remove-MgOAuth2PermissionGrant"; + IsApi = $false + }, + @{ + SourceName = "Remove-EntraServicePrincipal"; + TargetName = "Remove-MgServicePrincipal"; + IsApi = $false + }, + @{ + SourceName = "Remove-EntraUser"; + TargetName = "Remove-MgUser"; + IsApi = $false + }, + @{ + SourceName = "Remove-EntraUserManager"; + TargetName = "Remove-MgUserManagerByRef"; + IsApi = $false + } +) + +$cmdlets2 = @( + @{ + SourceName = "Get-EntraApplication"; + TargetName = "Get-MgApplication"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraApplicationExtensionProperty"; + TargetName = "Get-MgApplicationExtensionProperty"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraApplicationKeyCredential"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraApplicationLogo"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraApplicationOwner"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraApplicationPasswordCredential"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraApplicationServiceEndpoint"; + TargetName = "Get-MgServicePrincipalEndpoint"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraContact"; + TargetName = "Get-MgContact"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraContactDirectReport"; + TargetName = "Get-MgContactDirectReport"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraContactManager"; + TargetName = "Get-MgContactManager"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraContactMembership"; + TargetName = "Get-MgContactMemberOf"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraContract"; + TargetName = "Get-MgContract"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraDevice"; + TargetName = "Get-MgDevice"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraDeviceRegisteredOwner"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraDeviceRegisteredUser"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraDirectoryRole"; + TargetName = "Get-MgDirectoryRole"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraDirectoryRoleMember"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraGroup"; + TargetName = "Get-MgGroup"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraGroupAppRoleAssignment"; + TargetName = "Get-MgGroupAppRoleAssignment"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraGroupMember"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraGroupOwner"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraServiceAppRoleAssignedTo"; + TargetName = "Get-MgServicePrincipalAppRoleAssignment"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraServiceAppRoleAssignment"; + TargetName = "Get-MgServicePrincipalAppRoleAssignedTo"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraServicePrincipal"; + TargetName = "Get-MgServicePrincipal"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraServicePrincipalCreatedObject"; + TargetName = "Get-MgServicePrincipalCreatedObject"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraServicePrincipalKeyCredential"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraServicePrincipalMembership"; + TargetName = "Get-MgServicePrincipalTransitiveMemberOf"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraServicePrincipalOAuth2PermissionGrant"; + TargetName = "Get-MgServicePrincipalOauth2PermissionGrant"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraServicePrincipalOwnedObject"; + TargetName = "Get-MgServicePrincipalOwnedObject"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraServicePrincipalOwner"; + TargetName = "Get-MgServicePrincipalOwner"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraServicePrincipalPasswordCredential"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraSubscribedSku"; + TargetName = "Get-MgSubscribedSku"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraUser"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraUserAppRoleAssignment"; + TargetName = "Get-MgUserAppRoleAssignment"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraUserCreatedObject"; + TargetName = "Get-MgUserCreatedObject"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraUserDirectReport"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraUserExtension"; + TargetName = "Get-MgUserExtension"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraUserLicenseDetail"; + TargetName = "Get-MgUserLicenseDetail"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraUserManager"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraUserMembership"; + TargetName = "Get-MgUserMemberOf"; + IsApi = $true + }, + @{ + SourceName = "Get-EntraUserOAuth2PermissionGrant"; + TargetName = "Get-MgUserOAuth2PermissionGrant"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraUserOwnedDevice"; + TargetName = "Get-MgUserOwnedDevice"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraUserOwnedObject"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraUserRegisteredDevice"; + TargetName = "Get-MgUserRegisteredDevice"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraUserThumbnailPhoto"; + TargetName = "Get-MgUserPhoto"; + IsApi = $false + } +) +$cmdlets3 = @( + @{ + SourceName = "Get-EntraAdministrativeUnit"; + TargetName = "Get-MgDirectoryAdministrativeUnit"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraAdministrativeUnitMember"; + TargetName = "Get-MgDirectoryAdministrativeUnitMember"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraAttributeSet"; + TargetName = ""; + IsApi = $true + } + , + @{ + SourceName = "Get-EntraDeletedDirectoryObject"; + TargetName = "Get-MgDirectoryDeletedItem"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraDeletedGroup"; + TargetName = "Get-MgDirectoryDeletedItemAsGroup"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraGroupLifecyclePolicy"; + TargetName = "Get-MgGroupLifecyclePolicy"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraGroupPermissionGrant"; + TargetName = "Get-MgGroupPermissionGrant"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraIdentityProvider"; + TargetName = "Get-MgIdentityProvider"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraLifecyclePolicyGroup"; + TargetName = "Get-MgGroupLifecyclePolicyByGroup"; + IsApi = $false + }, + # @{ + # SourceName = "Get-EntraPermissionGrantConditionSet"; + # TargetName = "Get-MgPolicyPermissionGrantPolicyInclude"; + # IsApi = $false + # }, + @{ + SourceName = "Get-EntraPermissionGrantPolicy"; + TargetName = "Get-MgPolicyPermissionGrantPolicy"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraPolicy"; + TargetName = ""; + IsApi = $true + }, + @{ + SourceName = "Get-EntraRoleAssignment"; + TargetName = "Get-MgRoleManagementDirectoryRoleAssignment"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraRoleDefinition"; + TargetName = "Get-MgRoleManagementDirectoryRoleDefinition"; + IsApi = $false + }, + @{ + SourceName = "Get-EntraScopedRoleMembership"; + TargetName = "Get-MgDirectoryAdministrativeUnitScopedRoleMember"; + IsApi = $false + } + # @{ + # SourceName = "Get-EntraServicePrincipalDelegatedPermissionClassification"; + # TargetName = "Get-MgServicePrincipalDelegatedPermissionClassification"; + # IsApi = $false + # } +) \ No newline at end of file diff --git a/testVNext/Entra/Governance/Entra.Tests.ps1 b/testVNext/Entra/Governance/Entra.Tests.ps1 deleted file mode 100644 index fdbfdf603..000000000 --- a/testVNext/Entra/Governance/Entra.Tests.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. -# ------------------------------------------------------------------------------ - -if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Governance)){ - Import-Module .\bin\Microsoft.Graph.Entra.Governance.psd1 -Force -} - -Import-Module Pester - -$psmPath = (Get-Module Microsoft.Graph.Entra.Governance).Path -$testReportPath = join-path $psscriptroot "..\..\..\TestReport\Entra" -$mockScriptsPath = join-path $psscriptroot "..\..\..\test\module\Entra\*.Tests.ps1" - -$testOutputFile = "$testReportPath\TestResults.xml" -if (!(test-path -path $testReportPath)) {new-item -path $testReportPath -itemtype directory} - -$mockScripts = Get-ChildItem -Path $mockScriptsPath -Exclude "Entra.Tests.ps1" | ForEach-Object { $_.FullName } - -$config = New-PesterConfiguration -$config.Run.Path = $mockScripts -$config.Run.PassThru = $true -$config.Run.Exit = $true -$config.CodeCoverage.Enabled = $true -$config.CodeCoverage.CoveragePercentTarget = 100 -$config.CodeCoverage.Path = $psmPath -$config.TestResult.Enabled = $true -$config.TestResult.OutputPath = $testOutputFile -$config.Output.Verbosity = "Detailed" - -Invoke-Pester -Configuration $config diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRoleAssignment.Tests.ps1 b/testVNext/Entra/Governance/Get-EntraDirectoryRoleAssignment.Tests.ps1 similarity index 88% rename from testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRoleAssignment.Tests.ps1 rename to testVNext/Entra/Governance/Get-EntraDirectoryRoleAssignment.Tests.ps1 index 1fd5f9225..98a2326d2 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRoleAssignment.Tests.ps1 +++ b/testVNext/Entra/Governance/Get-EntraDirectoryRoleAssignment.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ - Import-Module Microsoft.Graph.Entra.DirectoryManagement + if((Get-Module -Name Microsoft.Graph.Entra.Governance) -eq $null){ + Import-Module Microsoft.Graph.Entra.Governance } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -26,7 +26,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgRoleManagementDirectoryRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement + Mock -CommandName Get-MgRoleManagementDirectoryRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Governance } Describe "Get-EntraDirectoryRoleAssignment" { @@ -35,13 +35,13 @@ Describe "Get-EntraDirectoryRoleAssignment" { $result = Get-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.Governance -Times 1 } It "Should execute successfully with Alias" { $result = Get-EntraDirectoryRoleAssignment -Id "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.Governance -Times 1 } It "Should fail when Get-EntraDirectoryRoleAssignment is empty" { { Get-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId } | Should -Throw "Missing an argument for parameter 'UnifiedRoleAssignmentId'*" @@ -53,7 +53,7 @@ Describe "Get-EntraDirectoryRoleAssignment" { $result = Get-EntraDirectoryRoleAssignment -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.Governance -Times 1 } It "Should fail when All is invalid" { { Get-EntraDirectoryRoleAssignment -All XY } | Should -Throw "A positional parameter cannot be found that accepts argument 'xy'.*" @@ -62,7 +62,7 @@ Describe "Get-EntraDirectoryRoleAssignment" { $result = Get-EntraDirectoryRoleAssignment -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.Governance -Times 1 } It "Should fail when Top is empty" { { Get-EntraDirectoryRoleAssignment -Top } | Should -Throw "Missing an argument for parameter 'Top'*" @@ -75,7 +75,7 @@ Describe "Get-EntraDirectoryRoleAssignment" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2' - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.Governance -Times 1 } It "Should fail when filter is empty" { { Get-EntraDirectoryRoleAssignment -Filter } | Should -Throw "Missing an argument for parameter 'Filter'*" @@ -95,7 +95,7 @@ Describe "Get-EntraDirectoryRoleAssignment" { $result | Should -Not -BeNullOrEmpty $result.PrincipalId | Should -Be 'aaaaaaaa-bbbb-cccc-1111-222222222222' - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.Governance -Times 1 } It "Should fail when Property is empty" { { Get-EntraDirectoryRoleAssignment -UnifiedRoleAssignmentId "Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -107,7 +107,7 @@ Describe "Get-EntraDirectoryRoleAssignment" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirectoryRoleAssignment" - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleAssignment -ModuleName Microsoft.Graph.Entra.Governance -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRoleDefinition.Tests.ps1 b/testVNext/Entra/Governance/Get-EntraDirectoryRoleDefinition.Tests.ps1 similarity index 88% rename from testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRoleDefinition.Tests.ps1 rename to testVNext/Entra/Governance/Get-EntraDirectoryRoleDefinition.Tests.ps1 index 11ee77562..bef299fde 100644 --- a/testVNext/Entra/DirectoryManagement/Get-EntraDirectoryRoleDefinition.Tests.ps1 +++ b/testVNext/Entra/Governance/Get-EntraDirectoryRoleDefinition.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra.DirectoryManagement) -eq $null){ - Import-Module Microsoft.Graph.Entra.DirectoryManagement + if((Get-Module -Name Microsoft.Graph.Entra.Governance) -eq $null){ + Import-Module Microsoft.Graph.Entra.Governance } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -29,7 +29,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgRoleManagementDirectoryRoleDefinition -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.DirectoryManagement + Mock -CommandName Get-MgRoleManagementDirectoryRoleDefinition -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Governance } Describe "Get-EntraDirectoryRoleDefinition" { @@ -40,7 +40,7 @@ Describe "Get-EntraDirectoryRoleDefinition" { $result.DisplayName | Should -Be "Mock-App" $result.Id | Should -Be "0000aaaa-11bb-cccc-dd22-eeeeee333333" - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.Governance -Times 1 } It "Should return specificrole Defination With Alias" { $result = Get-EntraDirectoryRoleDefinition -Id "0000aaaa-11bb-cccc-dd22-eeeeee333333" @@ -48,7 +48,7 @@ Describe "Get-EntraDirectoryRoleDefinition" { $result.DisplayName | Should -Be "Mock-App" $result.Id | Should -Be "0000aaaa-11bb-cccc-dd22-eeeeee333333" - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.Governance -Times 1 } It "Should fail when UnifiedRoleDefinitionId is empty" { { Get-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId } | Should -Throw "Missing an argument for parameter 'UnifiedRoleDefinitionId'*" @@ -60,7 +60,7 @@ Describe "Get-EntraDirectoryRoleDefinition" { $result = Get-EntraDirectoryRoleDefinition -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.Governance -Times 1 } It "Should fail when All is invalid" { { Get-EntraDirectoryRoleDefinition -All XY } | Should -Throw "A positional parameter cannot be found that accepts argument 'xy'.*" @@ -69,7 +69,7 @@ Describe "Get-EntraDirectoryRoleDefinition" { $result = Get-EntraDirectoryRoleDefinition -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.Governance -Times 1 } It "Should fail when Top is empty" { { Get-EntraDirectoryRoleDefinition -Top } | Should -Throw "Missing an argument for parameter 'Top'*" @@ -82,7 +82,7 @@ Describe "Get-EntraDirectoryRoleDefinition" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Mock-App' - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.Governance -Times 1 } It "Should fail when String is empty" { { Get-EntraDirectoryRoleDefinition -SearchString } | Should -Throw "Missing an argument for parameter 'SearchString'*" @@ -92,7 +92,7 @@ Describe "Get-EntraDirectoryRoleDefinition" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Mock-App' - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.Governance -Times 1 } It "Should fail when filter is empty" { { Get-EntraDirectoryRoleDefinition -Filter } | Should -Throw "Missing an argument for parameter 'Filter'*" @@ -111,7 +111,7 @@ Describe "Get-EntraDirectoryRoleDefinition" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock-App' - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.Governance -Times 1 } It "Should fail when Property is empty" { { Get-EntraDirectoryRoleDefinition -UnifiedRoleDefinitionId "0000aaaa-11bb-cccc-dd22-eeeeee333333" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -123,7 +123,7 @@ Describe "Get-EntraDirectoryRoleDefinition" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDirectoryRoleDefinition" - Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.DirectoryManagement -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgRoleManagementDirectoryRoleDefinition -ModuleName Microsoft.Graph.Entra.Governance -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Governance/New-EntraDirectoryRoleAssignment.Tests.ps1 b/testVNext/Entra/Governance/New-EntraDirectoryRoleAssignment.Tests.ps1 index aa606d76f..ca62493b3 100644 --- a/testVNext/Entra/Governance/New-EntraDirectoryRoleAssignment.Tests.ps1 +++ b/testVNext/Entra/Governance/New-EntraDirectoryRoleAssignment.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Governance) -eq $null){ Import-Module Microsoft.Graph.Entra.Governance } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/Entra/Governance/New-EntraDirectoryRoleDefinition.Tests.ps1 b/testVNext/Entra/Governance/New-EntraDirectoryRoleDefinition.Tests.ps1 index 3fe6f7b7c..7cd12e45a 100644 --- a/testVNext/Entra/Governance/New-EntraDirectoryRoleDefinition.Tests.ps1 +++ b/testVNext/Entra/Governance/New-EntraDirectoryRoleDefinition.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Governance) -eq $null){ Import-Module Microsoft.Graph.Entra.Governance } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/Entra/Governance/Remove-EntraDirectoryRoleAssignment.Tests.ps1 b/testVNext/Entra/Governance/Remove-EntraDirectoryRoleAssignment.Tests.ps1 index 9d8aa5f6b..87f3ecd29 100644 --- a/testVNext/Entra/Governance/Remove-EntraDirectoryRoleAssignment.Tests.ps1 +++ b/testVNext/Entra/Governance/Remove-EntraDirectoryRoleAssignment.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Governance) -eq $null){ Import-Module Microsoft.Graph.Entra.Governance } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgRoleManagementDirectoryRoleAssignment -MockWith {} -ModuleName Microsoft.Graph.Entra.Governance } diff --git a/testVNext/Entra/Governance/Remove-EntraDirectoryRoleDefinition.Tests.ps1 b/testVNext/Entra/Governance/Remove-EntraDirectoryRoleDefinition.Tests.ps1 index 712c43d66..228d3ba69 100644 --- a/testVNext/Entra/Governance/Remove-EntraDirectoryRoleDefinition.Tests.ps1 +++ b/testVNext/Entra/Governance/Remove-EntraDirectoryRoleDefinition.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Governance) -eq $null){ Import-Module Microsoft.Graph.Entra.Governance } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgRoleManagementDirectoryRoleDefinition -MockWith {} -ModuleName Microsoft.Graph.Entra.Governance } diff --git a/testVNext/Entra/Governance/Set-EntraDirectoryRoleDefinition.Tests.ps1 b/testVNext/Entra/Governance/Set-EntraDirectoryRoleDefinition.Tests.ps1 index 6cf8fe222..e22a6dc8a 100644 --- a/testVNext/Entra/Governance/Set-EntraDirectoryRoleDefinition.Tests.ps1 +++ b/testVNext/Entra/Governance/Set-EntraDirectoryRoleDefinition.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Governance) -eq $null){ Import-Module Microsoft.Graph.Entra.Governance } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Update-MgRoleManagementDirectoryRoleDefinition -MockWith {} -ModuleName Microsoft.Graph.Entra.Governance } diff --git a/testVNext/Entra/Governance/Valid.Tests.ps1 b/testVNext/Entra/Governance/Valid.Tests.ps1 index 0e82decbb..cfd385b6f 100644 --- a/testVNext/Entra/Governance/Valid.Tests.ps1 +++ b/testVNext/Entra/Governance/Valid.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll{ if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Governance)){ Import-Module Microsoft.Graph.Entra.Governance } - Import-Module (Join-Path $psscriptroot ".\EntraCmdletsMap.ps1") -Force + Import-Module (Join-Path $psscriptroot "..\EntraCmdletsMap.ps1") -Force $module = Get-Module -Name Microsoft.Graph.Entra.Governance } @@ -20,7 +20,7 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | Select-Object -expand Name) - if($params.count -eq 1 -and $params -eq 'Id'){ + if(($params -eq 'Id') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'Id')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { @@ -58,7 +58,7 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | select -expand Name) - if($params.count -eq 1 -and $params -eq 'ObjectId'){ + if(($params -eq 'ObjectId') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'ObjectId')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { diff --git a/testVNext/Entra/Groups/Add-EntraGroupMember.Tests.ps1 b/testVNext/Entra/Groups/Add-EntraGroupMember.Tests.ps1 index 86896d7b9..9ad88c866 100644 --- a/testVNext/Entra/Groups/Add-EntraGroupMember.Tests.ps1 +++ b/testVNext/Entra/Groups/Add-EntraGroupMember.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName New-MgGroupMember -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgGroupMember -MockWith {} -ModuleName Microsoft.Graph.Entra.Groups } Describe "Add-EntraGroupMember" { @@ -16,7 +16,7 @@ Describe "Add-EntraGroupMember" { $result = Add-EntraGroupMember -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName New-MgGroupMember -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgGroupMember -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupId is empty" { @@ -36,7 +36,7 @@ Describe "Add-EntraGroupMember" { } It "Should contain GroupId in parameters when passed GroupId to it" { - Mock -CommandName New-MgGroupMember -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgGroupMember -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Groups $result = Add-EntraGroupMember -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result @@ -44,7 +44,7 @@ Describe "Add-EntraGroupMember" { } It "Should contain DirectoryObjectId in parameters when passed RefObjectId to it" { - Mock -CommandName New-MgGroupMember -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgGroupMember -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Groups $result = Add-EntraGroupMember -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result @@ -58,7 +58,7 @@ Describe "Add-EntraGroupMember" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraGroupMember" - Should -Invoke -CommandName New-MgGroupMember -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgGroupMember -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Add-EntraGroupOwner.Tests.ps1 b/testVNext/Entra/Groups/Add-EntraGroupOwner.Tests.ps1 index e2c005024..31d7ddd50 100644 --- a/testVNext/Entra/Groups/Add-EntraGroupOwner.Tests.ps1 +++ b/testVNext/Entra/Groups/Add-EntraGroupOwner.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName New-MgGroupOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgGroupOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Groups } Describe "Add-EntraGroupOwner" { @@ -16,7 +16,7 @@ Describe "Add-EntraGroupOwner" { $result = Add-EntraGroupOwner -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName New-MgGroupOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgGroupOwnerByRef -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupId is empty" { @@ -36,7 +36,7 @@ Describe "Add-EntraGroupOwner" { } It "Should contain GroupId in parameters when passed GroupId to it" { - Mock -CommandName New-MgGroupOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgGroupOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Groups $result = Add-EntraGroupOwner -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $params = Get-Parameters -data $result @@ -47,7 +47,7 @@ Describe "Add-EntraGroupOwner" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraGroupOwner" Add-EntraGroupOwner -GroupId "aaaaaaaa-1111-2222-3333-cccccccccccc" -RefObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraGroupOwner" - Should -Invoke -CommandName New-MgGroupOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgGroupOwnerByRef -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Add-EntraLifecyclePolicyGroup.Tests.ps1 b/testVNext/Entra/Groups/Add-EntraLifecyclePolicyGroup.Tests.ps1 index 95070b8ea..5370eb284 100644 --- a/testVNext/Entra/Groups/Add-EntraLifecyclePolicyGroup.Tests.ps1 +++ b/testVNext/Entra/Groups/Add-EntraLifecyclePolicyGroup.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null) { + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -17,7 +17,7 @@ BeforeAll { ) } - Mock -CommandName Add-MgGroupToLifecyclePolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Add-MgGroupToLifecyclePolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups } Describe "Add-EntraLifecyclePolicyGroup" { @@ -27,14 +27,14 @@ Describe "Add-EntraLifecyclePolicyGroup" { $result | Should -Not -BeNullOrEmpty" $result.Value | should -Be "True" - Should -Invoke -CommandName Add-MgGroupToLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Add-MgGroupToLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should return created LifecyclePolicyGroup with alias" { $result = Add-EntraLifecyclePolicyGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff $result | Should -Not -BeNullOrEmpty" $result.Value | should -Be "True" - Should -Invoke -CommandName Add-MgGroupToLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Add-MgGroupToLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupLifecyclePolicyId is invalid" { { Add-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "" -GroupId "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" } | Should -Throw "Cannot bind argument to parameter 'GroupLifecyclePolicyId' because it is an empty string.*" @@ -55,7 +55,7 @@ Describe "Add-EntraLifecyclePolicyGroup" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraLifecyclePolicyGroup" - Should -Invoke -CommandName Add-MgGroupToLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Add-MgGroupToLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Entra.Tests.ps1 b/testVNext/Entra/Groups/Entra.Tests.ps1 deleted file mode 100644 index e6b0c3179..000000000 --- a/testVNext/Entra/Groups/Entra.Tests.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. -# ------------------------------------------------------------------------------ - -if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module .\bin\Microsoft.Graph.Entra.psd1 -Force -} - -Import-Module Pester - -$psmPath = (Get-Module Microsoft.Graph.Entra).Path -$testReportPath = join-path $psscriptroot "..\..\..\TestReport\Entra" -$mockScriptsPath = join-path $psscriptroot "..\..\..\test\module\Entra\*.Tests.ps1" - -$testOutputFile = "$testReportPath\TestResults.xml" -if (!(test-path -path $testReportPath)) {new-item -path $testReportPath -itemtype directory} - -$mockScripts = Get-ChildItem -Path $mockScriptsPath -Exclude "Entra.Tests.ps1" | ForEach-Object { $_.FullName } - -$config = New-PesterConfiguration -$config.Run.Path = $mockScripts -$config.Run.PassThru = $true -$config.Run.Exit = $true -$config.CodeCoverage.Enabled = $true -$config.CodeCoverage.CoveragePercentTarget = 100 -$config.CodeCoverage.Path = $psmPath -$config.TestResult.Enabled = $true -$config.TestResult.OutputPath = $testOutputFile -$config.Output.Verbosity = "Detailed" - -Invoke-Pester -Configuration $config \ No newline at end of file diff --git a/testVNext/Entra/Groups/Get-EntraDeletedGroup.Tests.ps1 b/testVNext/Entra/Groups/Get-EntraDeletedGroup.Tests.ps1 index 62599d6be..0ddac6e10 100644 --- a/testVNext/Entra/Groups/Get-EntraDeletedGroup.Tests.ps1 +++ b/testVNext/Entra/Groups/Get-EntraDeletedGroup.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -25,7 +25,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgDirectoryDeletedItemAsGroup -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgDirectoryDeletedItemAsGroup -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups } Describe "Get-EntraDeletedGroup" { @@ -37,7 +37,7 @@ Context "Test for Get-EntraDeletedGroup" { $result.DisplayName | Should -Be "Mock-App" $result.GroupTypes | Should -Be "Unified" - Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should return specific Deleted Group with alias" { $result = Get-EntraDeletedGroup -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" @@ -46,7 +46,7 @@ Context "Test for Get-EntraDeletedGroup" { $result.DisplayName | Should -Be "Mock-App" $result.GroupTypes | Should -Be "Unified" - Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupId is empty" { { Get-EntraDeletedGroup -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" @@ -58,7 +58,7 @@ Context "Test for Get-EntraDeletedGroup" { $result = Get-EntraDeletedGroup -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when All is invalid" { { Get-EntraDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" @@ -70,7 +70,7 @@ Context "Test for Get-EntraDeletedGroup" { $result.DisplayName | Should -Be "Mock-App" $result.GroupTypes | Should -Be "Unified" - Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when Top is empty" { { Get-EntraDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" @@ -85,7 +85,7 @@ Context "Test for Get-EntraDeletedGroup" { $result.DisplayName | Should -Be "Mock-App" $result.GroupTypes | Should -Be "Unified" - Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when filter is empty" { { Get-EntraDeletedGroup -Filter } | Should -Throw "Missing an argument for parameter 'Filter'*" @@ -97,7 +97,7 @@ Context "Test for Get-EntraDeletedGroup" { $result.MailNickname | Should -Be "Demo-Mock-App" $result.DisplayName | Should -Be "Mock-App" - Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when searchstring is empty" { { Get-EntraDeletedGroup -SearchString } | Should -Throw "Missing an argument for parameter 'SearchString'*" @@ -107,7 +107,7 @@ Context "Test for Get-EntraDeletedGroup" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock-App' - Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when Property is empty" { { Get-EntraDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -127,7 +127,7 @@ Context "Test for Get-EntraDeletedGroup" { $result = Get-EntraDeletedGroup -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraDeletedGroup" - Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgDirectoryDeletedItemAsGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Get-EntraGroup.Tests.ps1 b/testVNext/Entra/Groups/Get-EntraGroup.Tests.ps1 index b57241c64..e643ec070 100644 --- a/testVNext/Entra/Groups/Get-EntraGroup.Tests.ps1 +++ b/testVNext/Entra/Groups/Get-EntraGroup.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Get-EntraGroup with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -22,7 +22,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgGroup -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgGroup -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups } Describe "Get-EntraGroup" { @@ -32,7 +32,7 @@ Describe "Get-EntraGroup" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'bbbbbbbb-1111-2222-3333-cccccccccccc' - Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupId is empty" { { Get-EntraGroup -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" @@ -53,7 +53,7 @@ Describe "Get-EntraGroup" { $result = Get-EntraGroup -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when All has an argument" { { Get-EntraGroup -All $true} | Should -Throw "A positional parameter cannot be found that accepts argument 'True'." @@ -63,20 +63,20 @@ Describe "Get-EntraGroup" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'demo' - Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should return specific group by filter" { $result = Get-EntraGroup -Filter "DisplayName -eq 'demo'" $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'demo' - Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should return top group" { $result = Get-EntraGroup -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Result should Contain ObjectId" { $result = Get-EntraGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" @@ -97,7 +97,7 @@ Describe "Get-EntraGroup" { $result = Get-EntraGroup -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroup" - Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Get-EntraGroupAppRoleAssignment.Tests.ps1 b/testVNext/Entra/Groups/Get-EntraGroupAppRoleAssignment.Tests.ps1 index aef1d6a5f..1fbf2f27e 100644 --- a/testVNext/Entra/Groups/Get-EntraGroupAppRoleAssignment.Tests.ps1 +++ b/testVNext/Entra/Groups/Get-EntraGroupAppRoleAssignment.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -25,7 +25,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgGroupAppRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgGroupAppRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups } Describe "Get-EntraGroupAppRoleAssignment" { @@ -39,7 +39,7 @@ Context "Test for Get-EntraGroupAppRoleAssignment" { $result.AppRoleId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" - Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should return specific Group AppRole Assignment with alias" { $result = Get-EntraGroupAppRoleAssignment -objectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" @@ -50,7 +50,7 @@ Context "Test for Get-EntraGroupAppRoleAssignment" { $result.AppRoleId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" - Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when ObjectlId is empty" { { Get-EntraGroupAppRoleAssignment -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" @@ -67,7 +67,7 @@ Context "Test for Get-EntraGroupAppRoleAssignment" { $result.AppRoleId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" - Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when All is invalid" { { Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" @@ -81,7 +81,7 @@ Context "Test for Get-EntraGroupAppRoleAssignment" { $result.AppRoleId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" - Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when Top is empty" { { Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" @@ -94,7 +94,7 @@ Context "Test for Get-EntraGroupAppRoleAssignment" { $result | Should -Not -BeNullOrEmpty $result.PrincipalDisplayName | Should -Be 'Mock-Group' - Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when Property is empty" { { Get-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -116,7 +116,7 @@ Context "Test for Get-EntraGroupAppRoleAssignment" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroupAppRoleAssignment" - Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Get-EntraGroupLifecyclePolicy.Tests.ps1 b/testVNext/Entra/Groups/Get-EntraGroupLifecyclePolicy.Tests.ps1 index 01c6b17d2..061882aaf 100644 --- a/testVNext/Entra/Groups/Get-EntraGroupLifecyclePolicy.Tests.ps1 +++ b/testVNext/Entra/Groups/Get-EntraGroupLifecyclePolicy.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -19,7 +19,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgGroupLifecyclePolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgGroupLifecyclePolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups } Describe "Get-EntraGroupLifecyclePolicy" { @@ -32,7 +32,7 @@ Describe "Get-EntraGroupLifecyclePolicy" { $result.Id | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result.ManagedGroupTypes | Should -Be "All" - Should -Invoke -CommandName Get-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should execute successfully with Alias" { $result = Get-EntraGroupLifecyclePolicy -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" @@ -49,7 +49,7 @@ Describe "Get-EntraGroupLifecyclePolicy" { $result.Id | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result.ManagedGroupTypes | Should -Be "All" - Should -Invoke -CommandName Get-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupLifecyclePolicyId is empty" { @@ -71,7 +71,7 @@ Describe "Get-EntraGroupLifecyclePolicy" { $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - Should -Invoke -CommandName Get-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when Property is empty" { @@ -86,7 +86,7 @@ Describe "Get-EntraGroupLifecyclePolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroupLifecyclePolicy" - Should -Invoke -CommandName Get-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Get-EntraGroupMember.Tests.ps1 b/testVNext/Entra/Groups/Get-EntraGroupMember.Tests.ps1 index 15be33b61..c4ced384c 100644 --- a/testVNext/Entra/Groups/Get-EntraGroupMember.Tests.ps1 +++ b/testVNext/Entra/Groups/Get-EntraGroupMember.Tests.ps1 @@ -3,10 +3,10 @@ # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null) { + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -21,7 +21,7 @@ BeforeAll { ) } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups } Describe "Get-EntraGroupMember" { @@ -31,7 +31,7 @@ Describe "Get-EntraGroupMember" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Contain 'bbbbbbbb-1111-2222-3333-cccccccccccc' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupId is invalid" { { Get-EntraGroupMember -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." @@ -52,7 +52,7 @@ Describe "Get-EntraGroupMember" { $result = Get-EntraGroupMember -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when All has an argument" { @@ -63,7 +63,7 @@ Describe "Get-EntraGroupMember" { $result | Should -Not -BeNullOrEmpty $result | Should -HaveCount 1 - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Property parameter should work" { @@ -71,7 +71,7 @@ Describe "Get-EntraGroupMember" { $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when Property is empty" { @@ -86,7 +86,7 @@ Describe "Get-EntraGroupMember" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroupMember" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Get-EntraGroupOwner.Tests.ps1 b/testVNext/Entra/Groups/Get-EntraGroupOwner.Tests.ps1 index 2186d3ffb..f1b95bc9e 100644 --- a/testVNext/Entra/Groups/Get-EntraGroupOwner.Tests.ps1 +++ b/testVNext/Entra/Groups/Get-EntraGroupOwner.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $mockResponse = { return @{ @@ -29,7 +29,7 @@ BeforeAll { ) } } - Mock -CommandName Invoke-GraphRequest -MockWith $mockResponse -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $mockResponse -ModuleName Microsoft.Graph.Entra.Groups } Describe "Get-EntraGroupOwner" { @@ -40,7 +40,7 @@ Describe "Get-EntraGroupOwner" { $result.Id | should -Be 'bbbbbbbb-1111-2222-3333-cccccccccccc' $result.DeletedDateTime | should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Get a group owner by alias" { $result = Get-EntraGroupOwner -ObjectId "bbbbbbbb-1111-2222-3333-cccccccccccc" @@ -48,7 +48,7 @@ Describe "Get-EntraGroupOwner" { $result.Id | should -Be 'bbbbbbbb-1111-2222-3333-cccccccccccc' $result.DeletedDateTime | should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupId is empty" { @@ -63,7 +63,7 @@ Describe "Get-EntraGroupOwner" { $result = Get-EntraGroupOwner -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when All has an argument" { @@ -74,7 +74,7 @@ Describe "Get-EntraGroupOwner" { $result = Get-EntraGroupOwner -GroupId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Top 2 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when top is empty" { @@ -102,7 +102,7 @@ Describe "Get-EntraGroupOwner" { $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when Property is empty" { @@ -117,7 +117,7 @@ Describe "Get-EntraGroupOwner" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraGroupOwner" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Get-EntraLifecyclePolicyGroup.Tests.ps1 b/testVNext/Entra/Groups/Get-EntraLifecyclePolicyGroup.Tests.ps1 index f7f49d164..c64b13959 100644 --- a/testVNext/Entra/Groups/Get-EntraLifecyclePolicyGroup.Tests.ps1 +++ b/testVNext/Entra/Groups/Get-EntraLifecyclePolicyGroup.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -19,7 +19,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgGroupLifecyclePolicyByGroup -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgGroupLifecyclePolicyByGroup -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups } Describe "Get-EntraLifecyclePolicyGroup" { @@ -33,7 +33,7 @@ Describe "Get-EntraLifecyclePolicyGroup" { $result.Id | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result.ManagedGroupTypes | Should -Be "All" - Should -Invoke -CommandName Get-MgGroupLifecyclePolicyByGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroupLifecyclePolicyByGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Retrieve lifecycle policy object with alias" { @@ -45,7 +45,7 @@ Describe "Get-EntraLifecyclePolicyGroup" { $result.Id | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result.ManagedGroupTypes | Should -Be "All" - Should -Invoke -CommandName Get-MgGroupLifecyclePolicyByGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroupLifecyclePolicyByGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupId is empty" { @@ -67,7 +67,7 @@ Describe "Get-EntraLifecyclePolicyGroup" { $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - Should -Invoke -CommandName Get-MgGroupLifecyclePolicyByGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroupLifecyclePolicyByGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when Property is empty" { @@ -82,7 +82,7 @@ Describe "Get-EntraLifecyclePolicyGroup" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraLifecyclePolicyGroup" - Should -Invoke -CommandName Get-MgGroupLifecyclePolicyByGroup -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgGroupLifecyclePolicyByGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Get-EntraObjectSetting.Tests.ps1 b/testVNext/Entra/Groups/Get-EntraObjectSetting.Tests.ps1 index aaf8c9088..08c3b12e1 100644 --- a/testVNext/Entra/Groups/Get-EntraObjectSetting.Tests.ps1 +++ b/testVNext/Entra/Groups/Get-EntraObjectSetting.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null) { Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Get-EntraObjectSetting with parameters: $($args | ConvertTo-Json -Depth 3)" diff --git a/testVNext/Entra/Groups/Invalid.Tests.ps1 b/testVNext/Entra/Groups/Invalid.Tests.ps1 index 6d5381a10..d5a5c36d9 100644 --- a/testVNext/Entra/Groups/Invalid.Tests.ps1 +++ b/testVNext/Entra/Groups/Invalid.Tests.ps1 @@ -1,17 +1,17 @@ -if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module Microsoft.Graph.Entra +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Groups)){ + Import-Module Microsoft.Graph.Entra.Groups } Describe "Invalid Tests"{ It "Should fail when parameters are invalid"{ - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Groups $module.ExportedCommands.Keys | ForEach-Object{ $command = Get-Command $_ { Invoke-Command $command -demo "" } | Should -Throw "A parameter cannot be found that matches parameter name 'demo'." } } It "Should fail with 'TenantId' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Groups $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'TenantId'){ @@ -21,7 +21,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Id' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Groups $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Id'){ @@ -31,7 +31,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'ObjectId' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Groups $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'ObjectId'){ @@ -41,7 +41,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'All' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Groups $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'All'){ @@ -56,7 +56,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Top' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Groups $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Top'){ @@ -66,7 +66,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Filter' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Groups $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Filter'){ @@ -76,7 +76,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'SearchString' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Groups $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'SearchString'){ diff --git a/testVNext/Entra/Groups/Module.Tests.ps1 b/testVNext/Entra/Groups/Module.Tests.ps1 index cc40ad720..e4ba28e9d 100644 --- a/testVNext/Entra/Groups/Module.Tests.ps1 +++ b/testVNext/Entra/Groups/Module.Tests.ps1 @@ -2,39 +2,39 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ -Describe "Microsoft.Graph.Entra Module" { +Describe "Microsoft.Graph.Entra.Groups Module" { Context "On module import" { BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } } It "Should have exported commands" { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Groups $PSModuleInfo | Should -Not -BeNullOrEmpty $PSModuleInfo.ExportedFunctions.Count | Should -Not -Be 0 } It 'Should be compatible with PS core and desktop' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Groups $PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop") } It 'Should point to script module' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra - $PSModuleInfo.RootModule | Should -BeLikeExactly "*Microsoft.Graph.Entra.psm1" + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Groups + $PSModuleInfo.RootModule | Should -BeLikeExactly "*Microsoft.Graph.Entra.Groups.psm1" } It 'Should lock GUID' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Groups $PSModuleInfo.Guid | Should -Be "742dccd1-bf4b-46a0-a3f2-14e0bb508233" } It "Module import should not write to error and information streams" { $ps = [powershell]::Create() - $ps.AddScript("Import-Module Microsoft.Graph.Entra -ErrorAction SilentlyContinue").Invoke() + $ps.AddScript("Import-Module Microsoft.Graph.Entra.Groups -ErrorAction SilentlyContinue").Invoke() "Checking Information stream" | Out-Host $ps.Streams.Information.Count | Should -Be 0 "Checking Error stream" | Out-Host diff --git a/testVNext/Entra/Groups/New-EntraGroup.Tests.ps1 b/testVNext/Entra/Groups/New-EntraGroup.Tests.ps1 index 6c16d0b3e..aeffb5bdc 100644 --- a/testVNext/Entra/Groups/New-EntraGroup.Tests.ps1 +++ b/testVNext/Entra/Groups/New-EntraGroup.Tests.ps1 @@ -3,10 +3,10 @@ # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null) { + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { #Write-Host "Mocking New-EntraGroup with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -23,7 +23,7 @@ BeforeAll { ) } - Mock -CommandName New-MgGroup -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgGroup -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups } Describe "New-EntraGroup" { @@ -36,7 +36,7 @@ Describe "New-EntraGroup" { $result.SecurityEnabled | should -Be "True" $result.Description | should -Be "test" - Should -Invoke -CommandName New-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when parameters are invalid" { { New-EntraGroup -DisplayName "" -MailEnabled "" -SecurityEnabled "" -MailNickName "" -Description "" } | Should -Throw "Cannot bind argument to parameter*" @@ -53,7 +53,7 @@ Describe "New-EntraGroup" { $result = New-EntraGroup -DisplayName "demo" -MailEnabled $false -SecurityEnabled $true -MailNickName "demoNickname" -Description "test" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraGroup" - Should -Invoke -CommandName New-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/New-EntraGroupAppRoleAssignment.Tests.ps1 b/testVNext/Entra/Groups/New-EntraGroupAppRoleAssignment.Tests.ps1 index efc0c1430..021dbb5c9 100644 --- a/testVNext/Entra/Groups/New-EntraGroupAppRoleAssignment.Tests.ps1 +++ b/testVNext/Entra/Groups/New-EntraGroupAppRoleAssignment.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -25,7 +25,7 @@ BeforeAll { ) } - Mock -CommandName New-MgGroupAppRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgGroupAppRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups } Describe "New-EntraGroupAppRoleAssignment" { @@ -39,7 +39,7 @@ Context "Test for New-EntraGroupAppRoleAssignment" { $result.AppRoleId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" - Should -Invoke -CommandName New-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should return created Group AppRole Assignment with alias" { $result = New-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" @@ -50,7 +50,7 @@ Context "Test for New-EntraGroupAppRoleAssignment" { $result.AppRoleId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" - Should -Invoke -CommandName New-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when ObjectlId is empty" { { New-EntraGroupAppRoleAssignment -GroupId -PrincipalId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -ResourceId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" } | Should -Throw "Missing an argument for parameter 'GroupId'*" @@ -93,7 +93,7 @@ Context "Test for New-EntraGroupAppRoleAssignment" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraGroupAppRoleAssignment" - Should -Invoke -CommandName New-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/New-EntraGroupLifecyclePolicy.Tests.ps1 b/testVNext/Entra/Groups/New-EntraGroupLifecyclePolicy.Tests.ps1 index f6eb58547..03bd4e7b9 100644 --- a/testVNext/Entra/Groups/New-EntraGroupLifecyclePolicy.Tests.ps1 +++ b/testVNext/Entra/Groups/New-EntraGroupLifecyclePolicy.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null) { + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -19,7 +19,7 @@ BeforeAll { ) } - Mock -CommandName New-MgGroupLifecyclePolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgGroupLifecyclePolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups } Describe "New-EntraGroupLifecyclePolicy" { @@ -32,7 +32,7 @@ Describe "New-EntraGroupLifecyclePolicy" { $result.ManagedGroupTypes | should -Be "Selected" $result.AlternateNotificationEmails | should -Be "example@contoso.com" - Should -Invoke -CommandName New-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupLifetimeInDays is invalid" { { New-EntraGroupLifecyclePolicy -GroupLifetimeInDays a -ManagedGroupTypes "Selected" -AlternateNotificationEmails "example@contoso.com" } | Should -Throw "Cannot process argument transformation on parameter 'GroupLifetimeInDays'.*" @@ -64,7 +64,7 @@ Describe "New-EntraGroupLifecyclePolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraGroupLifecyclePolicy" - Should -Invoke -CommandName New-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Remove-EntraGroup.Tests.ps1 b/testVNext/Entra/Groups/Remove-EntraGroup.Tests.ps1 index 202708749..6428a8001 100644 --- a/testVNext/Entra/Groups/Remove-EntraGroup.Tests.ps1 +++ b/testVNext/Entra/Groups/Remove-EntraGroup.Tests.ps1 @@ -3,12 +3,12 @@ # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgGroup -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgGroup -MockWith {} -ModuleName Microsoft.Graph.Entra.Groups } Describe "Remove-EntraGroup" { @@ -17,13 +17,13 @@ Describe "Remove-EntraGroup" { $result = Remove-EntraGroup -GroupId bbbbbbbb-1111-2222-3333-cccccccccccc $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should execute successfully with Alias" { $result = Remove-EntraGroup -ObjectId bbbbbbbb-1111-2222-3333-cccccccccccc $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupId is invalid" { { Remove-EntraGroup -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." @@ -32,7 +32,7 @@ Describe "Remove-EntraGroup" { { Remove-EntraGroup -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" } It "Should contain GroupId in parameters when passed GroupId to it" { - Mock -CommandName Remove-MgGroup -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgGroup -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Groups $result = Remove-EntraGroup -GroupId bbbbbbbb-1111-2222-3333-cccccccccccc $params = Get-Parameters -data $result @@ -45,7 +45,7 @@ Describe "Remove-EntraGroup" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroup" - Should -Invoke -CommandName Remove-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Remove-EntraGroupAppRoleAssignment.Tests.ps1 b/testVNext/Entra/Groups/Remove-EntraGroupAppRoleAssignment.Tests.ps1 index ae40a78f5..2675331bd 100644 --- a/testVNext/Entra/Groups/Remove-EntraGroupAppRoleAssignment.Tests.ps1 +++ b/testVNext/Entra/Groups/Remove-EntraGroupAppRoleAssignment.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module .\test\module\Common-Functions.ps1 -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgGroupAppRoleAssignment -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgGroupAppRoleAssignment -MockWith {} -ModuleName Microsoft.Graph.Entra.Groups } Describe "Remove-EntraGroupAppRoleAssignment" { @@ -16,13 +16,13 @@ Describe "Remove-EntraGroupAppRoleAssignment" { $result = Remove-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should return empty object with Alias" { $result = Remove-EntraGroupAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupId is empty" { { Remove-EntraGroupAppRoleAssignment -GroupId -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" } | Should -Throw "Missing an argument for parameter 'GroupId'*" @@ -37,7 +37,7 @@ Describe "Remove-EntraGroupAppRoleAssignment" { { Remove-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "" } | Should -Throw "Cannot bind argument to parameter 'AppRoleAssignmentId' because it is an empty string." } It "Should contain GroupId in parameters when passed GroupId to it" { - Mock -CommandName Remove-MgGroupAppRoleAssignment -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgGroupAppRoleAssignment -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Groups $result = Remove-EntraGroupAppRoleAssignment -GroupId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1" $params = Get-Parameters -data $result @@ -50,7 +50,7 @@ Describe "Remove-EntraGroupAppRoleAssignment" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroupAppRoleAssignment" - Should -Invoke -CommandName Remove-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgGroupAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Remove-EntraGroupLifecyclePolicy.Tests.ps1 b/testVNext/Entra/Groups/Remove-EntraGroupLifecyclePolicy.Tests.ps1 index 9fd8573ed..43418b65d 100644 --- a/testVNext/Entra/Groups/Remove-EntraGroupLifecyclePolicy.Tests.ps1 +++ b/testVNext/Entra/Groups/Remove-EntraGroupLifecyclePolicy.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgGroupLifecyclePolicy -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgGroupLifecyclePolicy -MockWith {} -ModuleName Microsoft.Graph.Entra.Groups } Describe "Remove-EntraGroupLifecyclePolicy" { @@ -16,13 +16,13 @@ Describe "Remove-EntraGroupLifecyclePolicy" { $result = Remove-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "aaaabbbb-0000-cccc-1111-dddd2222eeee" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should execute successfully with Alias" { $result = Remove-EntraGroupLifecyclePolicy -Id "aaaabbbb-0000-cccc-1111-dddd2222eeee" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupLifecyclePolicyId is empty" { { Remove-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId } | Should -Throw "Missing an argument for parameter 'GroupLifecyclePolicyId'*" @@ -33,7 +33,7 @@ Describe "Remove-EntraGroupLifecyclePolicy" { } It "Should contain GroupLifecyclePolicyId in parameters when passed GroupLifecyclePolicyId to it" { - Mock -CommandName Remove-MgGroupLifecyclePolicy -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgGroupLifecyclePolicy -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Groups $result = Remove-EntraGroupLifecyclePolicy -GroupLifecyclePolicyId "aaaabbbb-0000-cccc-1111-dddd2222eeee" $params = Get-Parameters -data $result @@ -47,7 +47,7 @@ Describe "Remove-EntraGroupLifecyclePolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroupLifecyclePolicy" - Should -Invoke -CommandName Remove-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Remove-EntraGroupMember.Tests.ps1 b/testVNext/Entra/Groups/Remove-EntraGroupMember.Tests.ps1 index cc7fe1b85..511131eb2 100644 --- a/testVNext/Entra/Groups/Remove-EntraGroupMember.Tests.ps1 +++ b/testVNext/Entra/Groups/Remove-EntraGroupMember.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgGroupMemberByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgGroupMemberByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Groups } Describe "Remove-EntraGroupMember" { @@ -16,7 +16,7 @@ Describe "Remove-EntraGroupMember" { $result = Remove-EntraGroupMember -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -MemberId "00001111-aaaa-2222-bbbb-3333cccc4444" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgGroupMemberByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgGroupMemberByRef -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupId is empty" { @@ -36,7 +36,7 @@ Describe "Remove-EntraGroupMember" { } It "Should contain GroupId in parameters when passed GroupId to it" { - Mock -CommandName Remove-MgGroupMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgGroupMemberByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Groups $result = Remove-EntraGroupMember -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -MemberId "00001111-aaaa-2222-bbbb-3333cccc4444" $params = Get-Parameters -data $result @@ -50,7 +50,7 @@ Describe "Remove-EntraGroupMember" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroupMember" - Should -Invoke -CommandName Remove-MgGroupMemberByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgGroupMemberByRef -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Remove-EntraGroupOwner.Tests.ps1 b/testVNext/Entra/Groups/Remove-EntraGroupOwner.Tests.ps1 index 84decd9dd..e79061b99 100644 --- a/testVNext/Entra/Groups/Remove-EntraGroupOwner.Tests.ps1 +++ b/testVNext/Entra/Groups/Remove-EntraGroupOwner.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgGroupOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgGroupOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Groups } Describe "Remove-EntraGroupOwner" { @@ -16,7 +16,7 @@ Describe "Remove-EntraGroupOwner" { $result = Remove-EntraGroupOwner -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -OwnerId "00001111-aaaa-2222-bbbb-3333cccc4444" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgGroupOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgGroupOwnerByRef -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupId is empty" { @@ -36,7 +36,7 @@ Describe "Remove-EntraGroupOwner" { } It "Should contain GroupId in parameters when passed GroupId to it" { - Mock -CommandName Remove-MgGroupOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgGroupOwnerByRef -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Groups $result = Remove-EntraGroupOwner -GroupId "11112222-bbbb-3333-cccc-4444dddd5555" -OwnerId "00001111-aaaa-2222-bbbb-3333cccc4444" $params = Get-Parameters -data $result @@ -50,7 +50,7 @@ Describe "Remove-EntraGroupOwner" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraGroupOwner" - Should -Invoke -CommandName Remove-MgGroupOwnerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgGroupOwnerByRef -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Remove-EntraLifecyclePolicyGroup.Tests.ps1 b/testVNext/Entra/Groups/Remove-EntraLifecyclePolicyGroup.Tests.ps1 index 952dacff0..72baf13dc 100644 --- a/testVNext/Entra/Groups/Remove-EntraLifecyclePolicyGroup.Tests.ps1 +++ b/testVNext/Entra/Groups/Remove-EntraLifecyclePolicyGroup.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -15,7 +15,7 @@ BeforeAll { } ) } - Mock -CommandName Remove-MgGroupFromLifecyclePolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgGroupFromLifecyclePolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups } Describe "Remove-EntraLifecyclePolicyGroup" { @@ -24,14 +24,14 @@ Describe "Remove-EntraLifecyclePolicyGroup" { $result = Remove-EntraLifecyclePolicyGroup -GroupLifecyclePolicyId "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId "ccccdddd-2222-eeee-3333-ffff4444aaaa" $result.Value | Should -Be $true - Should -Invoke -CommandName Remove-MgGroupFromLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgGroupFromLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should remove a group from a lifecycle policy with alias" { $result = Remove-EntraLifecyclePolicyGroup -Id "bbbbcccc-1111-dddd-2222-eeee3333ffff" -GroupId "ccccdddd-2222-eeee-3333-ffff4444aaaa" $result.Value | Should -Be $true - Should -Invoke -CommandName Remove-MgGroupFromLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgGroupFromLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupLifecyclePolicyId is empty" { @@ -69,7 +69,7 @@ Describe "Remove-EntraLifecyclePolicyGroup" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraLifecyclePolicyGroup" - Should -Invoke -CommandName Remove-MgGroupFromLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgGroupFromLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Reset-EntraLifeCycleGroup.Tests.ps1 b/testVNext/Entra/Groups/Reset-EntraLifeCycleGroup.Tests.ps1 index b4ec97694..b949aebfa 100644 --- a/testVNext/Entra/Groups/Reset-EntraLifeCycleGroup.Tests.ps1 +++ b/testVNext/Entra/Groups/Reset-EntraLifeCycleGroup.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Invoke-MgRenewGroup -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-MgRenewGroup -MockWith {} -ModuleName Microsoft.Graph.Entra.Groups } Describe "Reset-EntraLifeCycleGroup" { @@ -16,7 +16,7 @@ Describe "Reset-EntraLifeCycleGroup" { $result = Reset-EntraLifeCycleGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-MgRenewGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-MgRenewGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when Id is empty" { @@ -28,7 +28,7 @@ Describe "Reset-EntraLifeCycleGroup" { } It "Should contain GroupId in parameters when passed Id to it" { - Mock -CommandName Invoke-MgRenewGroup -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-MgRenewGroup -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Groups $result = Reset-EntraLifeCycleGroup -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $params = Get-Parameters -data $result @@ -42,7 +42,7 @@ Describe "Reset-EntraLifeCycleGroup" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Reset-EntraLifeCycleGroup" - Should -Invoke -CommandName Invoke-MgRenewGroup -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-MgRenewGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Select-EntraGroupIdsContactIsMemberOf.Tests.ps1 b/testVNext/Entra/Groups/Select-EntraGroupIdsContactIsMemberOf.Tests.ps1 index 4d8dcd66c..2d39ef482 100644 --- a/testVNext/Entra/Groups/Select-EntraGroupIdsContactIsMemberOf.Tests.ps1 +++ b/testVNext/Entra/Groups/Select-EntraGroupIdsContactIsMemberOf.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -15,7 +15,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgContactMemberOfAsGroup -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgContactMemberOfAsGroup -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups } Describe "Select-EntraGroupIdsContactIsMemberOf" { @@ -28,7 +28,7 @@ Describe "Select-EntraGroupIdsContactIsMemberOf" { $result | Should -Not -BeNullOrEmpty $result | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Get-MgContactMemberOfAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgContactMemberOfAsGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when ObjectId is missing" { @@ -63,7 +63,7 @@ Describe "Select-EntraGroupIdsContactIsMemberOf" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Select-EntraGroupIdsContactIsMemberOf" - Should -Invoke -CommandName Get-MgContactMemberOfAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgContactMemberOfAsGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Select-EntraGroupIdsGroupIsMemberOf.Tests.ps1 b/testVNext/Entra/Groups/Select-EntraGroupIdsGroupIsMemberOf.Tests.ps1 index 8171a0356..b154a818e 100644 --- a/testVNext/Entra/Groups/Select-EntraGroupIdsGroupIsMemberOf.Tests.ps1 +++ b/testVNext/Entra/Groups/Select-EntraGroupIdsGroupIsMemberOf.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -29,8 +29,8 @@ BeforeAll { } ) } - Mock -CommandName Get-MgGroupMemberOf -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra - Mock -CommandName Get-MgGroup -MockWith $scriptblock2 -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgGroupMemberOf -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups + Mock -CommandName Get-MgGroup -MockWith $scriptblock2 -ModuleName Microsoft.Graph.Entra.Groups } Describe "Select-EntraGroupIdsGroupIsMemberOf" { @@ -43,7 +43,7 @@ Describe "Select-EntraGroupIdsGroupIsMemberOf" { $result | Should -Not -BeNullOrEmpty $result | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Get-MgGroupMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgGroupMemberOf -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when ObjectId is missing" { @@ -77,7 +77,7 @@ Describe "Select-EntraGroupIdsGroupIsMemberOf" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Select-EntraGroupIdsGroupIsMemberOf" - Should -Invoke -CommandName Get-MgGroupMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgGroupMemberOf -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Select-EntraGroupIdsUserIsMemberOf.Tests.ps1 b/testVNext/Entra/Groups/Select-EntraGroupIdsUserIsMemberOf.Tests.ps1 index ef839b024..cc296e593 100644 --- a/testVNext/Entra/Groups/Select-EntraGroupIdsUserIsMemberOf.Tests.ps1 +++ b/testVNext/Entra/Groups/Select-EntraGroupIdsUserIsMemberOf.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null) { + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -16,7 +16,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgUserMemberOfAsGroup -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgUserMemberOfAsGroup -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups } Describe "Select-EntraGroupIdsUserIsMemberOf" { @@ -29,7 +29,7 @@ Describe "Select-EntraGroupIdsUserIsMemberOf" { $result | Should -Not -BeNullOrEmpty $result | Should -Be '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' - Should -Invoke -CommandName Get-MgUserMemberOfAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserMemberOfAsGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when UserID is invalid " { @@ -50,7 +50,7 @@ Describe "Select-EntraGroupIdsUserIsMemberOf" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Select-entraGroupIdsUserIsMemberOf" - Should -Invoke -CommandName Get-MgUserMemberOfAsGroup -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgUserMemberOfAsGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Set-EntraGroup.Tests.ps1 b/testVNext/Entra/Groups/Set-EntraGroup.Tests.ps1 index 13be7dbd2..18b3a9246 100644 --- a/testVNext/Entra/Groups/Set-EntraGroup.Tests.ps1 +++ b/testVNext/Entra/Groups/Set-EntraGroup.Tests.ps1 @@ -3,12 +3,12 @@ # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Update-MgGroup -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgGroup -MockWith {} -ModuleName Microsoft.Graph.Entra.Groups } Describe "Set-EntraGroup" { @@ -17,13 +17,13 @@ Describe "Set-EntraGroup" { $result = Set-EntraGroup -GroupId bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "demo" -MailEnabled $false -SecurityEnabled $true -MailNickName "demoNickname" -Description "test" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should execute successfully with Alias" { $result = Set-EntraGroup -Id bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "demo" -MailEnabled $false -SecurityEnabled $true -MailNickName "demoNickname" -Description "test" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should fail when GroupId is invalid" { { Set-EntraGroup -GroupId "" } | Should -Throw "Cannot bind argument to parameter 'GroupId' because it is an empty string." @@ -32,7 +32,7 @@ Describe "Set-EntraGroup" { { Set-EntraGroup -GroupId } | Should -Throw "Missing an argument for parameter 'GroupId'*" } It "Should contain GroupId in parameters when passed GroupId to it" { - Mock -CommandName Update-MgGroup -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgGroup -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Groups $result = Set-EntraGroup -GroupId bbbbbbbb-1111-2222-3333-cccccccccccc $params = Get-Parameters -data $result @@ -44,7 +44,7 @@ Describe "Set-EntraGroup" { Set-EntraGroup -Id bbbbbbbb-1111-2222-3333-cccccccccccc $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraGroup" - Should -Invoke -CommandName Update-MgGroup -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgGroup -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Set-EntraGroupLifecyclePolicy.Tests.ps1 b/testVNext/Entra/Groups/Set-EntraGroupLifecyclePolicy.Tests.ps1 index a215df644..a6d2479b3 100644 --- a/testVNext/Entra/Groups/Set-EntraGroupLifecyclePolicy.Tests.ps1 +++ b/testVNext/Entra/Groups/Set-EntraGroupLifecyclePolicy.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Groups) -eq $null) { + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -19,7 +19,7 @@ BeforeAll { ) } - Mock -CommandName Update-MgGroupLifecyclePolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgGroupLifecyclePolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Groups } Describe "Set-EntraGroupLifecyclePolicy" { @@ -32,7 +32,7 @@ Describe "Set-EntraGroupLifecyclePolicy" { $result.ManagedGroupTypes | should -Be "All" $result.AlternateNotificationEmails | should -Be "admingroup@contoso.com" - Should -Invoke -CommandName Update-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } It "Should execute successfully with Alias" { $result = Set-EntraGroupLifecyclePolicy -Id "a47d4510-08c8-4437-99e9-71ca88e7af0f" -GroupLifetimeInDays 200 -AlternateNotificationEmails "admingroup@contoso.com" -ManagedGroupTypes "All" @@ -68,7 +68,7 @@ Describe "Set-EntraGroupLifecyclePolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraGroupLifecyclePolicy" - Should -Invoke -CommandName Update-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgGroupLifecyclePolicy -ModuleName Microsoft.Graph.Entra.Groups -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Groups/Valid.Tests.ps1 b/testVNext/Entra/Groups/Valid.Tests.ps1 index 5013e8327..924359246 100644 --- a/testVNext/Entra/Groups/Valid.Tests.ps1 +++ b/testVNext/Entra/Groups/Valid.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll{ - if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module Microsoft.Graph.Entra + if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Groups)){ + Import-Module Microsoft.Graph.Entra.Groups } - Import-Module (Join-Path $psscriptroot ".\EntraCmdletsMap.ps1") -Force + Import-Module (Join-Path $psscriptroot "..\EntraCmdletsMap.ps1") -Force - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Groups } Describe "Valid parameter Tests"{ @@ -20,23 +20,23 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | Select-Object -expand Name) - if($params.count -eq 1 -and $params -eq 'Id'){ + if(($params -eq 'Id') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'Id')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { Write-Host "$command" $commandScriptBlock = [scriptblock]::Create("$commandName -Id 056b2531-005e-4f3e-be78-01a71ea30a04") if($filter.IsApi){ - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Groups $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } else { - Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra.Groups $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } } catch { @@ -58,23 +58,23 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | select -expand Name) - if($params.count -eq 1 -and $params -eq 'ObjectId'){ + if(($params -eq 'ObjectId') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'ObjectId')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { Write-Host "$command" $commandScriptBlock = [scriptblock]::Create("$commandName -ObjectId 056b2531-005e-4f3e-be78-01a71ea30a04") if($filter.IsApi){ - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Groups $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } else { - Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra.Groups $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra.Groups -Times 1 } } catch { diff --git a/testVNext/Entra/New-EntraInvitation.Tests.ps1 b/testVNext/Entra/New-EntraInvitation.Tests.ps1 index ef281ac53..acea6a2ca 100644 --- a/testVNext/Entra/New-EntraInvitation.Tests.ps1 +++ b/testVNext/Entra/New-EntraInvitation.Tests.ps1 @@ -1,230 +1,230 @@ # ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ -BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra - } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force +# BeforeAll { +# if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ +# Import-Module Microsoft.Graph.Entra +# } +# Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - $scriptblock = { - return @( - [PSCustomObject]@{ - "Id" = "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" - "InviteRedeemUrl" = "https://login.microsoftonline.com/redeem?rd=https%3a%2f%2finvitations.microsoft.com%2fredeem%2f%3ftenant%3dd5aec55f-2d12-4442-8d2f-ccca95d4390e%26user%3d3135a58d-b417-40ae-bb44-a82df52b7957%26ticket%3dzbiyasVbMTkRKVom98YD%25252fOJvkr2WRQsI2Om6Z62TDYg%25253d%26ver%3d2.0" - "InviteRedirectUrl" = "http://myapps.contoso.com/" - "InvitedUser" = @{ - "AboutMe" = "" - "AccountEnabled" = "" - "Activities" = "" - "AgeGroup" = "" - "AgreementAcceptances" = "" - "AppRoleAssignments" = "" - "AssignedLicenses" = "" - "AssignedPlans" = "" - "Authentication" = "" - "AuthorizationInfo" = "" - "Birthday" = "" - "BusinessPhones" = "" - "Calendar" = "" - "CalendarGroups" = "" - "CalendarView" = "" - "Calendars" = "" - "Chats" = "" - "City" = "" - "CompanyName" = "" - "ConsentProvidedForMinor" = "" - "ContactFolders" = "" - "Contacts" = "" - "Country" = "" - "CreatedDateTime" = "" - "CreatedObjects" = "" - "CreationType" = "" - "CustomSecurityAttributes" = "" - "DeletedDateTime" = "" - "Department" = "" - "DeviceEnrollmentLimit" = "" - "DeviceManagementTroubleshootingEvents" = "" - "DirectReports" = "" - "DisplayName" = "" - "Drive" = "" - "Drives" = "" - "EmployeeExperience" = "" - "EmployeeHireDate" = "" - "EmployeeId" = "" - "EmployeeLeaveDateTime" = "" - "EmployeeOrgData" = "" - "EmployeeType" = "" - "Events" = "" - "Extensions" = "" - "ExternalUserState" = "" - "ExternalUserStateChangeDateTime" = "" - "FaxNumber" = "" - "FollowedSites" = "" - "GivenName" = "" - "HireDate" = "" - "Id" = "bbbbbbbb-1111-2222-3333-cccccccccccc" - "Identities" = "" - "ImAddresses" = "" - "InferenceClassification" = "" - "Insights" = "" - "Interests" = "" - "IsResourceAccount" = "" - "JobTitle" = "" - "JoinedTeams" = "" - "LastPasswordChangeDateTime" = "" - "LegalAgeGroupClassification" = "" - "LicenseAssignmentStates" = "" - "LicenseDetails" = "" - "Mail" = "" - "MailFolders" = "" - "MailNickname" = "" - "MailboxSettings" = "" - "ManagedAppRegistrations" = "" - "ManagedDevices" = "" - "Manager" = "" - "MemberOf" = "" - "Messages" = "" - "MobilePhone" = "" - "MySite" = "" - "Oauth2PermissionGrants" = "" - "OfficeLocation" = "" - "OnPremisesDistinguishedName" = "" - "OnPremisesDomainName" = "" - "OnPremisesExtensionAttributes" = "" - "OnPremisesImmutableId" = "" - "OnPremisesLastSyncDateTime" = "" - "OnPremisesProvisioningErrors" = "" - "OnPremisesSamAccountName" = "" - "OnPremisesSecurityIdentifier" = "" - "OnPremisesSyncEnabled" = "" - "OnPremisesUserPrincipalName" = "" - "Onenote" = "" - "OnlineMeetings" = "" - "OtherMails" = "" - "Outlook" = "" - "OwnedDevices" = "" - "OwnedObjects" = "" - "PasswordPolicies" = "" - "PasswordProfile" = "" - "PastProjects" = "" - "People" = "" - "PermissionGrants" = "" - "Photo" = "" - "Photos" = "" - "Planner" = "" - "PostalCode" = "" - "PreferredDataLocation" = "" - "PreferredLanguage" = "" - "PreferredName" = "" - "Presence" = "" - "Print" = "" - "ProvisionedPlans" = "" - "ProxyAddresses" = "" - "RegisteredDevices" = "" - "Responsibilities" = "" - "Schools" = "" - "ScopedRoleMemberOf" = "" - "SecurityIdentifier" = "" - "ServiceProvisioningErrors" = "" - "Settings" = "" - "ShowInAddressList" = "" - "SignInActivity" = "" - "SignInSessionsValidFromDateTime" = "" - "Skills" = "" - "State" = "" - "StreetAddress" = "" - "Surname" = "" - "Teamwork" = "" - "Todo" = "" - "TransitiveMemberOf" = "" - "UsageLocation" = "" - "UserPrincipalName" = "SawyerM@contoso.com" - "UserType" = "Guest" - } - "InvitedUserDisplayName" = "" - "InvitedUserEmailAddress" = "SawyerM@contoso.com" - "InvitedUserMessageInfo" = @{ - "CcRecipients" = [System.Object]@() - "CustomizedMessageBody" = "" - "MessageLanguage" = "" - } - "InvitedUserType" = "Guest" - "ResetRedemption" = $false - "SendInvitationMessage" = $true - "Status" = "PendingAcceptance" - "AdditionalProperties" = @{ - "@odata.context" = "https://graph.microsoft.com/v1.0/$metadata#invitations/$entity" - } - "Parameters" = $args - } - ) - } - Mock -CommandName New-MgInvitation -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra -} +# $scriptblock = { +# return @( +# [PSCustomObject]@{ +# "Id" = "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" +# "InviteRedeemUrl" = "https://login.microsoftonline.com/redeem?rd=https%3a%2f%2finvitations.microsoft.com%2fredeem%2f%3ftenant%3dd5aec55f-2d12-4442-8d2f-ccca95d4390e%26user%3d3135a58d-b417-40ae-bb44-a82df52b7957%26ticket%3dzbiyasVbMTkRKVom98YD%25252fOJvkr2WRQsI2Om6Z62TDYg%25253d%26ver%3d2.0" +# "InviteRedirectUrl" = "http://myapps.contoso.com/" +# "InvitedUser" = @{ +# "AboutMe" = "" +# "AccountEnabled" = "" +# "Activities" = "" +# "AgeGroup" = "" +# "AgreementAcceptances" = "" +# "AppRoleAssignments" = "" +# "AssignedLicenses" = "" +# "AssignedPlans" = "" +# "Authentication" = "" +# "AuthorizationInfo" = "" +# "Birthday" = "" +# "BusinessPhones" = "" +# "Calendar" = "" +# "CalendarGroups" = "" +# "CalendarView" = "" +# "Calendars" = "" +# "Chats" = "" +# "City" = "" +# "CompanyName" = "" +# "ConsentProvidedForMinor" = "" +# "ContactFolders" = "" +# "Contacts" = "" +# "Country" = "" +# "CreatedDateTime" = "" +# "CreatedObjects" = "" +# "CreationType" = "" +# "CustomSecurityAttributes" = "" +# "DeletedDateTime" = "" +# "Department" = "" +# "DeviceEnrollmentLimit" = "" +# "DeviceManagementTroubleshootingEvents" = "" +# "DirectReports" = "" +# "DisplayName" = "" +# "Drive" = "" +# "Drives" = "" +# "EmployeeExperience" = "" +# "EmployeeHireDate" = "" +# "EmployeeId" = "" +# "EmployeeLeaveDateTime" = "" +# "EmployeeOrgData" = "" +# "EmployeeType" = "" +# "Events" = "" +# "Extensions" = "" +# "ExternalUserState" = "" +# "ExternalUserStateChangeDateTime" = "" +# "FaxNumber" = "" +# "FollowedSites" = "" +# "GivenName" = "" +# "HireDate" = "" +# "Id" = "bbbbbbbb-1111-2222-3333-cccccccccccc" +# "Identities" = "" +# "ImAddresses" = "" +# "InferenceClassification" = "" +# "Insights" = "" +# "Interests" = "" +# "IsResourceAccount" = "" +# "JobTitle" = "" +# "JoinedTeams" = "" +# "LastPasswordChangeDateTime" = "" +# "LegalAgeGroupClassification" = "" +# "LicenseAssignmentStates" = "" +# "LicenseDetails" = "" +# "Mail" = "" +# "MailFolders" = "" +# "MailNickname" = "" +# "MailboxSettings" = "" +# "ManagedAppRegistrations" = "" +# "ManagedDevices" = "" +# "Manager" = "" +# "MemberOf" = "" +# "Messages" = "" +# "MobilePhone" = "" +# "MySite" = "" +# "Oauth2PermissionGrants" = "" +# "OfficeLocation" = "" +# "OnPremisesDistinguishedName" = "" +# "OnPremisesDomainName" = "" +# "OnPremisesExtensionAttributes" = "" +# "OnPremisesImmutableId" = "" +# "OnPremisesLastSyncDateTime" = "" +# "OnPremisesProvisioningErrors" = "" +# "OnPremisesSamAccountName" = "" +# "OnPremisesSecurityIdentifier" = "" +# "OnPremisesSyncEnabled" = "" +# "OnPremisesUserPrincipalName" = "" +# "Onenote" = "" +# "OnlineMeetings" = "" +# "OtherMails" = "" +# "Outlook" = "" +# "OwnedDevices" = "" +# "OwnedObjects" = "" +# "PasswordPolicies" = "" +# "PasswordProfile" = "" +# "PastProjects" = "" +# "People" = "" +# "PermissionGrants" = "" +# "Photo" = "" +# "Photos" = "" +# "Planner" = "" +# "PostalCode" = "" +# "PreferredDataLocation" = "" +# "PreferredLanguage" = "" +# "PreferredName" = "" +# "Presence" = "" +# "Print" = "" +# "ProvisionedPlans" = "" +# "ProxyAddresses" = "" +# "RegisteredDevices" = "" +# "Responsibilities" = "" +# "Schools" = "" +# "ScopedRoleMemberOf" = "" +# "SecurityIdentifier" = "" +# "ServiceProvisioningErrors" = "" +# "Settings" = "" +# "ShowInAddressList" = "" +# "SignInActivity" = "" +# "SignInSessionsValidFromDateTime" = "" +# "Skills" = "" +# "State" = "" +# "StreetAddress" = "" +# "Surname" = "" +# "Teamwork" = "" +# "Todo" = "" +# "TransitiveMemberOf" = "" +# "UsageLocation" = "" +# "UserPrincipalName" = "SawyerM@contoso.com" +# "UserType" = "Guest" +# } +# "InvitedUserDisplayName" = "" +# "InvitedUserEmailAddress" = "SawyerM@contoso.com" +# "InvitedUserMessageInfo" = @{ +# "CcRecipients" = [System.Object]@() +# "CustomizedMessageBody" = "" +# "MessageLanguage" = "" +# } +# "InvitedUserType" = "Guest" +# "ResetRedemption" = $false +# "SendInvitationMessage" = $true +# "Status" = "PendingAcceptance" +# "AdditionalProperties" = @{ +# "@odata.context" = "https://graph.microsoft.com/v1.0/$metadata#invitations/$entity" +# } +# "Parameters" = $args +# } +# ) +# } +# Mock -CommandName New-MgInvitation -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra +# } -Describe "New-EntraInvitation" { - Context "Test for New-EntraInvitation" { - It "Should invite a new external user to your directory" { - $result = New-EntraInvitation -InvitedUserEmailAddress SawyerM@contoso.com -SendInvitationMessage $True -InviteRedirectUrl "http://myapps.contoso.com" - $result | Should -Not -BeNullOrEmpty - $result.Id | Should -Be "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" - $result.Status | Should -Be "PendingAcceptance" - $result.InvitedUser.Id | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" - $result.InvitedUser.UserPrincipalName | Should -Be "SawyerM@contoso.com" - $result.InvitedUser.UserType | Should -Be "Guest" - $result.InvitedUserEmailAddress | Should -Be "SawyerM@contoso.com" - $result.InvitedUserType | Should -Be "Guest" - $result.ResetRedemption | Should -Be $false - $result.SendInvitationMessage | Should -Be $true - $result.InvitedUserDisplayName | Should -BeNullOrEmpty +# Describe "New-EntraInvitation" { +# Context "Test for New-EntraInvitation" { +# It "Should invite a new external user to your directory" { +# $result = New-EntraInvitation -InvitedUserEmailAddress SawyerM@contoso.com -SendInvitationMessage $True -InviteRedirectUrl "http://myapps.contoso.com" +# $result | Should -Not -BeNullOrEmpty +# $result.Id | Should -Be "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" +# $result.Status | Should -Be "PendingAcceptance" +# $result.InvitedUser.Id | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" +# $result.InvitedUser.UserPrincipalName | Should -Be "SawyerM@contoso.com" +# $result.InvitedUser.UserType | Should -Be "Guest" +# $result.InvitedUserEmailAddress | Should -Be "SawyerM@contoso.com" +# $result.InvitedUserType | Should -Be "Guest" +# $result.ResetRedemption | Should -Be $false +# $result.SendInvitationMessage | Should -Be $true +# $result.InvitedUserDisplayName | Should -BeNullOrEmpty - Should -Invoke -CommandName New-MgInvitation -ModuleName Microsoft.Graph.Entra -Times 1 - } +# Should -Invoke -CommandName New-MgInvitation -ModuleName Microsoft.Graph.Entra -Times 1 +# } - It "Should fail when parameters are empty" { - { New-EntraInvitation -InvitedUserEmailAddress -SendInvitationMessage -InviteRedirectUrl } | Should -Throw "Missing an argument for parameter*" - } +# It "Should fail when parameters are empty" { +# { New-EntraInvitation -InvitedUserEmailAddress -SendInvitationMessage -InviteRedirectUrl } | Should -Throw "Missing an argument for parameter*" +# } - It "Should fail when InviteRedirectUrl parameter are Invalid" { - { New-EntraInvitation -InvitedUserEmailAddress SawyerM@contoso.com -SendInvitationMessage $True -InviteRedirectUrl "" } | Should -Throw "Cannot bind argument to parameter 'InviteRedirectUrl' because it is an empty string." - } +# It "Should fail when InviteRedirectUrl parameter are Invalid" { +# { New-EntraInvitation -InvitedUserEmailAddress SawyerM@contoso.com -SendInvitationMessage $True -InviteRedirectUrl "" } | Should -Throw "Cannot bind argument to parameter 'InviteRedirectUrl' because it is an empty string." +# } - It "Should fail when SendInvitationMessage parameter are Invalid" { - { New-EntraInvitation -InvitedUserEmailAddress SawyerM@contoso.com -SendInvitationMessage "123" -InviteRedirectUrl "http://myapps.contoso.com" } | Should -Throw "Cannot process argument transformation on parameter*" - } +# It "Should fail when SendInvitationMessage parameter are Invalid" { +# { New-EntraInvitation -InvitedUserEmailAddress SawyerM@contoso.com -SendInvitationMessage "123" -InviteRedirectUrl "http://myapps.contoso.com" } | Should -Throw "Cannot process argument transformation on parameter*" +# } - It "Should fail when InvitedUserEmailAddress parameter are Invalid" { - { New-EntraInvitation -InvitedUserEmailAddress "" -SendInvitationMessage $True -InviteRedirectUrl "http://myapps.contoso.com" } | Should -Throw "Cannot bind argument to parameter 'InvitedUserEmailAddress' because it is an empty string." - } +# It "Should fail when InvitedUserEmailAddress parameter are Invalid" { +# { New-EntraInvitation -InvitedUserEmailAddress "" -SendInvitationMessage $True -InviteRedirectUrl "http://myapps.contoso.com" } | Should -Throw "Cannot bind argument to parameter 'InvitedUserEmailAddress' because it is an empty string." +# } - It "Should contain ObjectId in result" { - $result = New-EntraInvitation -InvitedUserEmailAddress SawyerM@contoso.com -SendInvitationMessage $True -InviteRedirectUrl "http://myapps.contoso.com" - $result.ObjectId | should -Be "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" - } +# It "Should contain ObjectId in result" { +# $result = New-EntraInvitation -InvitedUserEmailAddress SawyerM@contoso.com -SendInvitationMessage $True -InviteRedirectUrl "http://myapps.contoso.com" +# $result.ObjectId | should -Be "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" +# } - It "Should contain 'User-Agent' header" { - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraInvitation" - $result = New-EntraInvitation -InvitedUserEmailAddress SawyerM@contoso.com -SendInvitationMessage $True -InviteRedirectUrl "http://myapps.contoso.com" - $result | Should -Not -BeNullOrEmpty - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraInvitation" - Should -Invoke -CommandName New-MgInvitation -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { - $Headers.'User-Agent' | Should -Be $userAgentHeaderValue - $true - } - } - It "Should execute successfully without throwing an error " { - # Disable confirmation prompts - $originalDebugPreference = $DebugPreference - $DebugPreference = 'Continue' +# It "Should contain 'User-Agent' header" { +# $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraInvitation" +# $result = New-EntraInvitation -InvitedUserEmailAddress SawyerM@contoso.com -SendInvitationMessage $True -InviteRedirectUrl "http://myapps.contoso.com" +# $result | Should -Not -BeNullOrEmpty +# $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraInvitation" +# Should -Invoke -CommandName New-MgInvitation -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { +# $Headers.'User-Agent' | Should -Be $userAgentHeaderValue +# $true +# } +# } +# It "Should execute successfully without throwing an error " { +# # Disable confirmation prompts +# $originalDebugPreference = $DebugPreference +# $DebugPreference = 'Continue' - try { - # Act & Assert: Ensure the function doesn't throw an exception - { New-EntraInvitation -InvitedUserEmailAddress SawyerM@contoso.com -SendInvitationMessage $True -InviteRedirectUrl "http://myapps.contoso.com" -Debug } | Should -Not -Throw - } finally { - # Restore original confirmation preference - $DebugPreference = $originalDebugPreference - } - } - } -} +# try { +# # Act & Assert: Ensure the function doesn't throw an exception +# { New-EntraInvitation -InvitedUserEmailAddress SawyerM@contoso.com -SendInvitationMessage $True -InviteRedirectUrl "http://myapps.contoso.com" -Debug } | Should -Not -Throw +# } finally { +# # Restore original confirmation preference +# $DebugPreference = $originalDebugPreference +# } +# } +# } +# } diff --git a/testVNext/Entra/Reports/Entra.Tests.ps1 b/testVNext/Entra/Reports/Entra.Tests.ps1 deleted file mode 100644 index 51b69725f..000000000 --- a/testVNext/Entra/Reports/Entra.Tests.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. -# ------------------------------------------------------------------------------ - -if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Reports)){ - Import-Module .\bin\Microsoft.Graph.Entra.Reports.psd1 -Force -} - -Import-Module Pester - -$psmPath = (Get-Module Microsoft.Graph.Entra.Reports).Path -$testReportPath = join-path $psscriptroot "..\..\..\TestReport\Entra" -$mockScriptsPath = join-path $psscriptroot "..\..\..\test\module\Entra\*.Tests.ps1" - -$testOutputFile = "$testReportPath\TestResults.xml" -if (!(test-path -path $testReportPath)) {new-item -path $testReportPath -itemtype directory} - -$mockScripts = Get-ChildItem -Path $mockScriptsPath -Exclude "Entra.Tests.ps1" | ForEach-Object { $_.FullName } - -$config = New-PesterConfiguration -$config.Run.Path = $mockScripts -$config.Run.PassThru = $true -$config.Run.Exit = $true -$config.CodeCoverage.Enabled = $true -$config.CodeCoverage.CoveragePercentTarget = 100 -$config.CodeCoverage.Path = $psmPath -$config.TestResult.Enabled = $true -$config.TestResult.OutputPath = $testOutputFile -$config.Output.Verbosity = "Detailed" - -Invoke-Pester -Configuration $config diff --git a/testVNext/Entra/Reports/Get-EntraAuditDirectoryLog.Tests.ps1 b/testVNext/Entra/Reports/Get-EntraAuditDirectoryLog.Tests.ps1 index e18155a03..8b98d2528 100644 --- a/testVNext/Entra/Reports/Get-EntraAuditDirectoryLog.Tests.ps1 +++ b/testVNext/Entra/Reports/Get-EntraAuditDirectoryLog.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Reports) -eq $null) { Import-Module Microsoft.Graph.Entra.Reports } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Get-EntraAuditDirectoryLog with parameters: $($args | ConvertTo-Json -Depth 3)" diff --git a/testVNext/Entra/Reports/Get-EntraAuditSignInLog.Tests.ps1 b/testVNext/Entra/Reports/Get-EntraAuditSignInLog.Tests.ps1 index 4334a5845..4efece827 100644 --- a/testVNext/Entra/Reports/Get-EntraAuditSignInLog.Tests.ps1 +++ b/testVNext/Entra/Reports/Get-EntraAuditSignInLog.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Reports) -eq $null) { Import-Module Microsoft.Graph.Entra.Reports } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Get-EntraAuditSignInLog with parameters: $($args | ConvertTo-Json -Depth 3)" diff --git a/testVNext/Entra/Reports/Valid.Tests.ps1 b/testVNext/Entra/Reports/Valid.Tests.ps1 index 808f8a92b..efe88f1a5 100644 --- a/testVNext/Entra/Reports/Valid.Tests.ps1 +++ b/testVNext/Entra/Reports/Valid.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll{ if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Reports)){ Import-Module Microsoft.Graph.Entra.Reports } - Import-Module (Join-Path $psscriptroot ".\EntraCmdletsMap.ps1") -Force + Import-Module (Join-Path $psscriptroot "..\EntraCmdletsMap.ps1") -Force $module = Get-Module -Name Microsoft.Graph.Entra.Reports } @@ -20,7 +20,7 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | Select-Object -expand Name) - if($params.count -eq 1 -and $params -eq 'Id'){ + if(($params -eq 'Id') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'Id')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { @@ -58,7 +58,7 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | select -expand Name) - if($params.count -eq 1 -and $params -eq 'ObjectId'){ + if(($params -eq 'ObjectId') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'ObjectId')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { diff --git a/testVNext/Entra/SignIns/Entra.Tests.ps1 b/testVNext/Entra/SignIns/Entra.Tests.ps1 deleted file mode 100644 index e6b0c3179..000000000 --- a/testVNext/Entra/SignIns/Entra.Tests.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. -# ------------------------------------------------------------------------------ - -if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module .\bin\Microsoft.Graph.Entra.psd1 -Force -} - -Import-Module Pester - -$psmPath = (Get-Module Microsoft.Graph.Entra).Path -$testReportPath = join-path $psscriptroot "..\..\..\TestReport\Entra" -$mockScriptsPath = join-path $psscriptroot "..\..\..\test\module\Entra\*.Tests.ps1" - -$testOutputFile = "$testReportPath\TestResults.xml" -if (!(test-path -path $testReportPath)) {new-item -path $testReportPath -itemtype directory} - -$mockScripts = Get-ChildItem -Path $mockScriptsPath -Exclude "Entra.Tests.ps1" | ForEach-Object { $_.FullName } - -$config = New-PesterConfiguration -$config.Run.Path = $mockScripts -$config.Run.PassThru = $true -$config.Run.Exit = $true -$config.CodeCoverage.Enabled = $true -$config.CodeCoverage.CoveragePercentTarget = 100 -$config.CodeCoverage.Path = $psmPath -$config.TestResult.Enabled = $true -$config.TestResult.OutputPath = $testOutputFile -$config.Output.Verbosity = "Detailed" - -Invoke-Pester -Configuration $config \ No newline at end of file diff --git a/testVNext/Entra/SignIns/Get-EntraAuthorizationPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Get-EntraAuthorizationPolicy.Tests.ps1 index f327dcf44..8c263652f 100644 --- a/testVNext/Entra/SignIns/Get-EntraAuthorizationPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Get-EntraAuthorizationPolicy.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null) { + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -30,7 +30,7 @@ BeforeAll { ) } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Get-EntraAuthorizationPolicy" { @@ -48,14 +48,14 @@ Describe "Get-EntraAuthorizationPolicy" { $result.AllowedToUseSspr | should -Be $True $result.BlockMsolPowerShell | should -Be $True - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should return AuthorizationPolicy when passed Id" { $result = Get-EntraAuthorizationPolicy -Id 'authorizationPolicy' $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'authorizationPolicy' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Id is invalid" { {Get-EntraAuthorizationPolicy -Id ''} | Should -Throw 'Exception calling "Substring" with "2" argument*' @@ -68,7 +68,7 @@ Describe "Get-EntraAuthorizationPolicy" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'AuthorizationPolicy' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Property is empty" { { Get-EntraAuthorizationPolicy -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -80,7 +80,7 @@ Describe "Get-EntraAuthorizationPolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraAuthorizationPolicy" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Get-EntraConditionalAccessPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Get-EntraConditionalAccessPolicy.Tests.ps1 index aeeb70015..2df798c93 100644 --- a/testVNext/Entra/SignIns/Get-EntraConditionalAccessPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Get-EntraConditionalAccessPolicy.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -39,7 +39,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgIdentityConditionalAccessPolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgIdentityConditionalAccessPolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Get-EntraConditionalAccessPolicy" { @@ -52,7 +52,7 @@ Describe "Get-EntraConditionalAccessPolicy" { $result.DisplayName | Should -Be "MFA policy" $result.State | Should -Be "enabled" - Should -Invoke -CommandName Get-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should retrieves a list of all conditional access policies in Microsoft Entra ID" { @@ -61,7 +61,7 @@ Describe "Get-EntraConditionalAccessPolicy" { $result.Id | Should -Contain "aaaaaaaa-1111-2222-3333-ccccccccccc" $result.ObjectId | Should -Contain "aaaaaaaa-1111-2222-3333-ccccccccccc" - Should -Invoke -CommandName Get-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Property parameter should work" { @@ -94,7 +94,7 @@ Describe "Get-EntraConditionalAccessPolicy" { $result = Get-EntraConditionalAccessPolicy -PolicyId "aaaaaaaa-1111-2222-3333-ccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraConditionalAccessPolicy" - Should -Invoke -CommandName Get-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Get-EntraFeatureRolloutPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Get-EntraFeatureRolloutPolicy.Tests.ps1 index 08cd32dee..420ed9c00 100644 --- a/testVNext/Entra/SignIns/Get-EntraFeatureRolloutPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Get-EntraFeatureRolloutPolicy.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null) { Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/Entra/SignIns/Get-EntraIdentityProvider.Tests.ps1 b/testVNext/Entra/SignIns/Get-EntraIdentityProvider.Tests.ps1 index 39a158c21..5c839ba39 100644 --- a/testVNext/Entra/SignIns/Get-EntraIdentityProvider.Tests.ps1 +++ b/testVNext/Entra/SignIns/Get-EntraIdentityProvider.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -24,7 +24,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgIdentityProvider -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgIdentityProvider -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Get-EntraIdentityProvider" { @@ -36,7 +36,7 @@ Context "Test for Get-EntraIdentityProvider" { $result.DisplayName | Should -Be "Mock-App" $result.identityProviderType | Should -Be "Google" - Should -Invoke -CommandName Get-MgIdentityProvider -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgIdentityProvider -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should return specific identity provider with alias" { $result = Get-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" @@ -45,7 +45,7 @@ Context "Test for Get-EntraIdentityProvider" { $result.DisplayName | Should -Be "Mock-App" $result.identityProviderType | Should -Be "Google" - Should -Invoke -CommandName Get-MgIdentityProvider -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgIdentityProvider -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Id is empty" { { Get-EntraIdentityProvider -IdentityProviderBaseId } | Should -Throw "Missing an argument for parameter 'IdentityProviderBaseId'*" @@ -70,7 +70,7 @@ Context "Test for Get-EntraIdentityProvider" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock-App' - Should -Invoke -CommandName Get-MgIdentityProvider -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgIdentityProvider -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Property is empty" { { Get-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -82,7 +82,7 @@ Context "Test for Get-EntraIdentityProvider" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraIdentityProvider" - Should -Invoke -CommandName Get-MgIdentityProvider -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgIdentityProvider -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Get-EntraOAuth2PermissionGrant.Tests.ps1 b/testVNext/Entra/SignIns/Get-EntraOAuth2PermissionGrant.Tests.ps1 index 44603b282..0cb735357 100644 --- a/testVNext/Entra/SignIns/Get-EntraOAuth2PermissionGrant.Tests.ps1 +++ b/testVNext/Entra/SignIns/Get-EntraOAuth2PermissionGrant.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -22,7 +22,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgOAuth2PermissionGrant -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgOAuth2PermissionGrant -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Get-EntraOAuth2PermissionGrant" { @@ -35,7 +35,7 @@ Context "Test for Get-EntraOAuth2PermissionGrant" { $result.PrincipalId | Should -BeNullOrEmpty $result.ClientId | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" - Should -Invoke -CommandName Get-MgOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should return All Group AppRole Assignment" { $result = Get-EntraOAuth2PermissionGrant -All @@ -46,7 +46,7 @@ Context "Test for Get-EntraOAuth2PermissionGrant" { $result.ClientId | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" - Should -Invoke -CommandName Get-MgOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when All is invalid" { { Get-EntraOAuth2PermissionGrant -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" @@ -60,7 +60,7 @@ Context "Test for Get-EntraOAuth2PermissionGrant" { $result.ClientId | Should -Be "aaaaaaaa-bbbb-cccc-1111-222222222222" - Should -Invoke -CommandName Get-MgOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Top is empty" { { Get-EntraOAuth2PermissionGrant -Top } | Should -Throw "Missing an argument for parameter 'Top'*" @@ -77,7 +77,7 @@ Context "Test for Get-EntraOAuth2PermissionGrant" { $result | Should -Not -BeNullOrEmpty $result.ConsentType | Should -Be 'AllPrincipals' - Should -Invoke -CommandName Get-MgOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Property is empty" { { Get-EntraOAuth2PermissionGrant -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -90,7 +90,7 @@ Context "Test for Get-EntraOAuth2PermissionGrant" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraOAuth2PermissionGrant" - Should -Invoke -CommandName Get-MgOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Get-EntraPermissionGrantConditionSet.Tests.ps1 b/testVNext/Entra/SignIns/Get-EntraPermissionGrantConditionSet.Tests.ps1 index ef9361ca2..e8a95c285 100644 --- a/testVNext/Entra/SignIns/Get-EntraPermissionGrantConditionSet.Tests.ps1 +++ b/testVNext/Entra/SignIns/Get-EntraPermissionGrantConditionSet.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -20,20 +20,20 @@ BeforeAll { ) } - Mock -CommandName Get-MgPolicyPermissionGrantPolicyInclude -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgPolicyPermissionGrantPolicyInclude -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns - Mock -CommandName Get-MgPolicyPermissionGrantPolicyExclude -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgPolicyPermissionGrantPolicyExclude -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Get-EntraPermissionGrantConditionSet"{ It "Should not return empty object for condition set 'includes'"{ $result = Get-EntraPermissionGrantConditionSet -PolicyId "policy1" -ConditionSetType "includes" -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should not return empty object for condition set 'excludes'"{ $result = Get-EntraPermissionGrantConditionSet -PolicyId "policy1" -ConditionSetType "excludes" -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgPolicyPermissionGrantPolicyExclude -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgPolicyPermissionGrantPolicyExclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when parameters are empty" { { Get-EntraPermissionGrantConditionSet -PolicyId "" -ConditionSetType "" -Id ""} | Should -Throw "Cannot bind argument to parameter*" @@ -56,7 +56,7 @@ Describe "Get-EntraPermissionGrantConditionSet"{ $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" - Should -Invoke -CommandName Get-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Property is empty" { @@ -67,7 +67,7 @@ Describe "Get-EntraPermissionGrantConditionSet"{ $result = Get-EntraPermissionGrantConditionSet -PolicyId "policy1" -ConditionSetType "includes" -Id "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraPermissionGrantConditionSet" - Should -Invoke -CommandName Get-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Get-EntraPermissionGrantPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Get-EntraPermissionGrantPolicy.Tests.ps1 index 1a2147369..0a005309f 100644 --- a/testVNext/Entra/SignIns/Get-EntraPermissionGrantPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Get-EntraPermissionGrantPolicy.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null) { + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -21,7 +21,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgPolicyPermissionGrantPolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgPolicyPermissionGrantPolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Get-EntraPermissionGrantPolicy" { @@ -31,7 +31,7 @@ Describe "Get-EntraPermissionGrantPolicy" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be "microsoft-all-application-permissions" - Should -Invoke -CommandName Get-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Id is empty" { { Get-EntraPermissionGrantPolicy -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." @@ -53,7 +53,7 @@ Describe "Get-EntraPermissionGrantPolicy" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'All application' - Should -Invoke -CommandName Get-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Property is empty" { { Get-EntraPermissionGrantPolicy -Id "microsoft-all-application-permissions" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -66,7 +66,7 @@ Describe "Get-EntraPermissionGrantPolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraPermissionGrantPolicy" - Should -Invoke -CommandName Get-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Get-EntraPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Get-EntraPolicy.Tests.ps1 index 50e32a259..2dd83a26f 100644 --- a/testVNext/Entra/SignIns/Get-EntraPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Get-EntraPolicy.Tests.ps1 @@ -3,11 +3,11 @@ # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null) { + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $ScriptBlock = { @@ -42,7 +42,7 @@ BeforeAll { return $response } - Mock -CommandName Invoke-GraphRequest -MockWith $ScriptBlock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $ScriptBlock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Get-EntraPolicy" { Context "Test for Get-EntraPolicy" { @@ -52,20 +52,20 @@ Describe "Get-EntraPolicy" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Contain 'bbbbbbbb-1111-2222-3333-cccccccccccc' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should return all Policies" { $result = Get-EntraPolicy -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should return all Policy" { $result = Get-EntraPolicy -Top 1 $result | Should -Not -BeNullOrEmpty $result | Should -HaveCount 1 - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Id is invalid" { { Get-EntraPolicy -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string." @@ -87,7 +87,7 @@ Describe "Get-EntraPolicy" { $result = Get-EntraPolicy -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraPolicy" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Get-EntraTrustedCertificateAuthority.Tests.ps1 b/testVNext/Entra/SignIns/Get-EntraTrustedCertificateAuthority.Tests.ps1 index 299af79aa..239e7c7dd 100644 --- a/testVNext/Entra/SignIns/Get-EntraTrustedCertificateAuthority.Tests.ps1 +++ b/testVNext/Entra/SignIns/Get-EntraTrustedCertificateAuthority.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { @{ @@ -40,20 +40,20 @@ BeforeAll { } - Mock -CommandName Get-MgContext -MockWith $tenantObj -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgContext -MockWith $tenantObj -ModuleName Microsoft.Graph.Entra.SignIns - Mock -CommandName Get-MgOrganizationCertificateBasedAuthConfiguration -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgOrganizationCertificateBasedAuthConfiguration -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Get-EntraTrustedCertificateAuthority"{ It "Result should not be empty when no parameter passed" { $result = Get-EntraTrustedCertificateAuthority $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgOrganizationCertificateBasedAuthConfiguration -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgOrganizationCertificateBasedAuthConfiguration -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Result should not be empty when parameters are empty" { $result = Get-EntraTrustedCertificateAuthority -TrustedIssuer '' -TrustedIssuerSki '' $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgOrganizationCertificateBasedAuthConfiguration -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgOrganizationCertificateBasedAuthConfiguration -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Property parameter should work" { $result = Get-EntraTrustedCertificateAuthority -Property TrustedIssuerSki @@ -70,7 +70,7 @@ Describe "Get-EntraTrustedCertificateAuthority"{ $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraTrustedCertificateAuthority" Get-EntraTrustedCertificateAuthority $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraTrustedCertificateAuthority" - Should -Invoke -CommandName Get-MgOrganizationCertificateBasedAuthConfiguration -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgOrganizationCertificateBasedAuthConfiguration -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Invalid.Tests.ps1 b/testVNext/Entra/SignIns/Invalid.Tests.ps1 index 6d5381a10..a3c5cd01a 100644 --- a/testVNext/Entra/SignIns/Invalid.Tests.ps1 +++ b/testVNext/Entra/SignIns/Invalid.Tests.ps1 @@ -1,17 +1,17 @@ -if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module Microsoft.Graph.Entra +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.SignIns)){ + Import-Module Microsoft.Graph.Entra.SignIns } Describe "Invalid Tests"{ It "Should fail when parameters are invalid"{ - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.SignIns $module.ExportedCommands.Keys | ForEach-Object{ $command = Get-Command $_ { Invoke-Command $command -demo "" } | Should -Throw "A parameter cannot be found that matches parameter name 'demo'." } } It "Should fail with 'TenantId' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.SignIns $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'TenantId'){ @@ -21,7 +21,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Id' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.SignIns $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Id'){ @@ -31,7 +31,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'ObjectId' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.SignIns $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'ObjectId'){ @@ -41,7 +41,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'All' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.SignIns $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'All'){ @@ -56,7 +56,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Top' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.SignIns $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Top'){ @@ -66,7 +66,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Filter' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.SignIns $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Filter'){ @@ -76,7 +76,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'SearchString' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.SignIns $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'SearchString'){ diff --git a/testVNext/Entra/SignIns/Module.Tests.ps1 b/testVNext/Entra/SignIns/Module.Tests.ps1 index cc40ad720..46b6aad65 100644 --- a/testVNext/Entra/SignIns/Module.Tests.ps1 +++ b/testVNext/Entra/SignIns/Module.Tests.ps1 @@ -2,39 +2,39 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ -Describe "Microsoft.Graph.Entra Module" { +Describe "Microsoft.Graph.Entra.SignIns Module" { Context "On module import" { BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } } It "Should have exported commands" { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.SignIns $PSModuleInfo | Should -Not -BeNullOrEmpty $PSModuleInfo.ExportedFunctions.Count | Should -Not -Be 0 } It 'Should be compatible with PS core and desktop' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.SignIns $PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop") } It 'Should point to script module' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra - $PSModuleInfo.RootModule | Should -BeLikeExactly "*Microsoft.Graph.Entra.psm1" + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.SignIns + $PSModuleInfo.RootModule | Should -BeLikeExactly "*Microsoft.Graph.Entra.SignIns.psm1" } It 'Should lock GUID' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.SignIns $PSModuleInfo.Guid | Should -Be "742dccd1-bf4b-46a0-a3f2-14e0bb508233" } It "Module import should not write to error and information streams" { $ps = [powershell]::Create() - $ps.AddScript("Import-Module Microsoft.Graph.Entra -ErrorAction SilentlyContinue").Invoke() + $ps.AddScript("Import-Module Microsoft.Graph.Entra.SignIns -ErrorAction SilentlyContinue").Invoke() "Checking Information stream" | Out-Host $ps.Streams.Information.Count | Should -Be 0 "Checking Error stream" | Out-Host diff --git a/testVNext/Entra/SignIns/New-EntraConditionalAccessPolicy.Tests.ps1 b/testVNext/Entra/SignIns/New-EntraConditionalAccessPolicy.Tests.ps1 index 302e5e557..8a3ad5b7d 100644 --- a/testVNext/Entra/SignIns/New-EntraConditionalAccessPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/New-EntraConditionalAccessPolicy.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -39,7 +39,7 @@ BeforeAll { } ) } - Mock -CommandName New-MgIdentityConditionalAccessPolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgIdentityConditionalAccessPolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "New-EntraConditionalAccessPolicy" { @@ -62,7 +62,7 @@ Describe "New-EntraConditionalAccessPolicy" { $result.State | Should -Be "enabled" - Should -Invoke -CommandName New-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when DisplayName parameter is empty" { @@ -110,7 +110,7 @@ Describe "New-EntraConditionalAccessPolicy" { $params = Get-Parameters -data $result.Parameters $params.Conditions.Users.IncludeUsers | Should -Be "all" - Should -Invoke -CommandName New-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should contain BuiltInControls in parameters when passed GrantControls to it" { @@ -128,7 +128,7 @@ Describe "New-EntraConditionalAccessPolicy" { $params = Get-Parameters -data $result.Parameters $params.GrantControls.BuiltInControls | Should -Be "mfa" - Should -Invoke -CommandName New-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should contain 'User-Agent' header" { @@ -145,7 +145,7 @@ Describe "New-EntraConditionalAccessPolicy" { $result = New-EntraConditionalAccessPolicy -DisplayName "MFA policy" -State "Enabled" -Conditions $conditions -GrantControls $controls -SessionControls $SessionControls $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraConditionalAccessPolicy" - Should -Invoke -CommandName New-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/New-EntraFeatureRolloutPolicy.Tests.ps1 b/testVNext/Entra/SignIns/New-EntraFeatureRolloutPolicy.Tests.ps1 index 3edbe8297..e2f797bf0 100644 --- a/testVNext/Entra/SignIns/New-EntraFeatureRolloutPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/New-EntraFeatureRolloutPolicy.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null) { Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/Entra/SignIns/New-EntraIdentityProvider.Tests.ps1 b/testVNext/Entra/SignIns/New-EntraIdentityProvider.Tests.ps1 index cd8cc17d4..55e2b4c5f 100644 --- a/testVNext/Entra/SignIns/New-EntraIdentityProvider.Tests.ps1 +++ b/testVNext/Entra/SignIns/New-EntraIdentityProvider.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -24,7 +24,7 @@ BeforeAll { ) } - Mock -CommandName New-MgIdentityProvider -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgIdentityProvider -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "New-EntraIdentityProvider" { @@ -36,7 +36,7 @@ Context "Test for New-EntraIdentityProvider" { $result.DisplayName | Should -Be "Mock-App" $result.identityProviderType | Should -Be "Google" - Should -Invoke -CommandName New-MgIdentityProvider -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgIdentityProvider -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Type is empty" { { New-EntraIdentityProvider -Type -Name "Mock-App" -ClientId "Google123" -ClientSecret "GoogleId" } | Should -Throw "Missing an argument for parameter 'Type'*" @@ -87,7 +87,7 @@ Context "Test for New-EntraIdentityProvider" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraIdentityProvider" - Should -Invoke -CommandName New-MgIdentityProvider -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgIdentityProvider -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/New-EntraNamedLocationPolicy.Tests.ps1 b/testVNext/Entra/SignIns/New-EntraNamedLocationPolicy.Tests.ps1 index 69b58b6e2..2e4a996a0 100644 --- a/testVNext/Entra/SignIns/New-EntraNamedLocationPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/New-EntraNamedLocationPolicy.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -28,7 +28,7 @@ BeforeAll { ) } - Mock -CommandName New-MgIdentityConditionalAccessNamedLocation -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgIdentityConditionalAccessNamedLocation -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "New-EntraNamedLocationPolicy" { @@ -42,7 +42,7 @@ Context "Test for New-EntraNamedLocationPolicy" { $result.DisplayName | Should -Be "Mock-App policies" $result.CreatedDateTime | Should -Be "14-05-2024 09:38:07" - Should -Invoke -CommandName New-MgIdentityConditionalAccessNamedLocation -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgIdentityConditionalAccessNamedLocation -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when OdataType is empty" { { New-EntraNamedLocationPolicy -OdataType } | Should -Throw "Missing an argument for parameter 'OdataType'*" @@ -81,7 +81,7 @@ Context "Test for New-EntraNamedLocationPolicy" { $result.ObjectId | should -Be "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" } It "Should contain @odata.type in bodyparameters when passed OdataId to it" { - Mock -CommandName New-MgIdentityConditionalAccessNamedLocation -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgIdentityConditionalAccessNamedLocation -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns $ipRanges = New-Object -TypeName Microsoft.Open.MSGraph.Model.IpRange $ipRanges.cidrAddress = "6.5.4.1/30" @@ -98,7 +98,7 @@ Context "Test for New-EntraNamedLocationPolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraNamedLocationPolicy" - Should -Invoke -CommandName New-MgIdentityConditionalAccessNamedLocation -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgIdentityConditionalAccessNamedLocation -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/New-EntraOauth2PermissionGrant.Tests.ps1 b/testVNext/Entra/SignIns/New-EntraOauth2PermissionGrant.Tests.ps1 index f5ec1c445..4af685ac8 100644 --- a/testVNext/Entra/SignIns/New-EntraOauth2PermissionGrant.Tests.ps1 +++ b/testVNext/Entra/SignIns/New-EntraOauth2PermissionGrant.Tests.ps1 @@ -3,10 +3,10 @@ # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null) { + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -20,7 +20,7 @@ BeforeAll { ) } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "New-EntraOauth2PermissionGrant" { @@ -33,7 +33,7 @@ Describe "New-EntraOauth2PermissionGrant" { $result.ResourceId | should -Be "bbbbbbbb-1111-2222-3333-rrrrrrrrrrrr" $result.Scope | should -Be "DelegatedPermissionGrant.ReadWrite.All" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when ClientId is invalid" { { New-EntraOauth2PermissionGrant -ClientId "" } | Should -Throw "Cannot bind argument to parameter 'ClientId'*" @@ -58,7 +58,7 @@ Describe "New-EntraOauth2PermissionGrant" { $result = New-EntraOauth2PermissionGrant -ClientId "bbbbbbbb-1111-2222-3333-cccccccccccc" -ConsentType "AllPrincipals" -ResourceId "bbbbbbbb-1111-2222-3333-rrrrrrrrrrrr" -Scope "DelegatedPermissionGrant.ReadWrite.All" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraOauth2PermissionGrant" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/New-EntraPermissionGrantConditionSet.Tests.ps1 b/testVNext/Entra/SignIns/New-EntraPermissionGrantConditionSet.Tests.ps1 index 46bc3fd7c..1a89cfb3f 100644 --- a/testVNext/Entra/SignIns/New-EntraPermissionGrantConditionSet.Tests.ps1 +++ b/testVNext/Entra/SignIns/New-EntraPermissionGrantConditionSet.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -22,20 +22,20 @@ BeforeAll { ) } - Mock -CommandName New-MgPolicyPermissionGrantPolicyInclude -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgPolicyPermissionGrantPolicyInclude -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns - Mock -CommandName New-MgPolicyPermissionGrantPolicyExclude -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgPolicyPermissionGrantPolicyExclude -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "New-EntraPermissionGrantConditionSet"{ It "Should not return empty object for condition set 'includes'"{ $result = New-EntraPermissionGrantConditionSet -PolicyId "test1" -ConditionSetType "includes" -PermissionType "delegated" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName New-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should not return empty object for condition set 'excludes'"{ $result = New-EntraPermissionGrantConditionSet -PolicyId "test1" -ConditionSetType "excludes" -PermissionType "delegated" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName New-MgPolicyPermissionGrantPolicyExclude -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgPolicyPermissionGrantPolicyExclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when parameters are empty" { { New-EntraPermissionGrantConditionSet -PolicyId "" -ConditionSetType ""} | Should -Throw "Cannot bind argument to parameter*" @@ -53,7 +53,7 @@ Describe "New-EntraPermissionGrantConditionSet"{ $result = New-EntraPermissionGrantConditionSet -PolicyId "test1" -ConditionSetType "includes" -PermissionType "delegated" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraPermissionGrantConditionSet" - Should -Invoke -CommandName New-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/New-EntraPermissionGrantPolicy.Tests.ps1 b/testVNext/Entra/SignIns/New-EntraPermissionGrantPolicy.Tests.ps1 index 7151be40d..a24022852 100644 --- a/testVNext/Entra/SignIns/New-EntraPermissionGrantPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/New-EntraPermissionGrantPolicy.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null) { + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -21,7 +21,7 @@ BeforeAll { ) } - Mock -CommandName New-MgPolicyPermissionGrantPolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgPolicyPermissionGrantPolicy -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "New-EntraPermissionGrantPolicy" { @@ -35,7 +35,7 @@ Describe "New-EntraPermissionGrantPolicy" { $result.Includes | should -Be @("22cc22cc-dd33-ee44-ff55-66aa66aa66aa") $result.DeletedDateTime | should -Be "2/8/2024 6:39:16 AM" - Should -Invoke -CommandName New-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Id is empty" { { New-EntraPermissionGrantPolicy -Id -DisplayName "MyNewPermissionGrantPolicy" -Description "My new permission grant policy" } | Should -Throw "Missing an argument for parameter 'Id'.*" @@ -58,7 +58,7 @@ Describe "New-EntraPermissionGrantPolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraPermissionGrantPolicy" - Should -Invoke -CommandName New-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/New-EntraPolicy.Tests.ps1 b/testVNext/Entra/SignIns/New-EntraPolicy.Tests.ps1 index 24afef76d..4500f49c6 100644 --- a/testVNext/Entra/SignIns/New-EntraPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/New-EntraPolicy.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null) { + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { #Write-Host "Mocking New-EntraPolicy with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -20,7 +20,7 @@ BeforeAll { ) } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "New-EntraPolicy" { @@ -35,7 +35,7 @@ Describe "New-EntraPolicy" { $result.Id | should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" $result.IsOrganizationDefault | should -Be "False" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when parameters are invalid" { { New-EntraPolicy -Definition "" -DisplayName "" -Type "" -IsOrganizationDefault "" -AlternativeIdentifier "" } | Should -Throw "Cannot bind argument to parameter*" @@ -52,7 +52,7 @@ Describe "New-EntraPolicy" { $result = New-EntraPolicy -Definition @('{ "definition": [ "{\"ClaimsMappingPolicy\":{\"Version\":1,\"IncludeBasicClaimSet\":\"true\",\"ClaimsSchema\":[{\"Source\":\"user\",\"ID\":\"userPrincipalName\",\"SAMLClaimType\":\"http://xyz.xmlsoap.org/ws/2005/05/pqr/claims/name\",\"JwtClaimType\":\"xyz\"},{\"Source\":\"user\",\"ID\":\"displayName\",\"SAMLClaimType\":\"http://xxx.yyy.com/identity/claims/displayname\",\"JwtClaimType\":\"ppp\"}]}}" ], "displayName": "test Claims Issuance Policy", "isOrganizationDefault": false }') -DisplayName "Claimstest" -Type "claimsMappingPolicies" -IsOrganizationDefault $false -AlternativeIdentifier "1f587daa-d6fc-433f-88ee-ccccccccc111" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraPolicy" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/New-EntraTrustedCertificateAuthority.Tests.ps1 b/testVNext/Entra/SignIns/New-EntraTrustedCertificateAuthority.Tests.ps1 index c62e83ef5..c1a1fdcf3 100644 --- a/testVNext/Entra/SignIns/New-EntraTrustedCertificateAuthority.Tests.ps1 +++ b/testVNext/Entra/SignIns/New-EntraTrustedCertificateAuthority.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $tenantObj = { @@ -17,7 +17,7 @@ BeforeAll { } - Mock -CommandName Get-MgContext -MockWith $tenantObj -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgContext -MockWith $tenantObj -ModuleName Microsoft.Graph.Entra.SignIns $scriptblock = { return @( @@ -37,7 +37,7 @@ BeforeAll { ) } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns $scriptblock2 = { return @( @@ -55,7 +55,7 @@ BeforeAll { } - Mock -CommandName Get-MgOrganizationCertificateBasedAuthConfiguration -MockWith $scriptblock2 -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgOrganizationCertificateBasedAuthConfiguration -MockWith $scriptblock2 -ModuleName Microsoft.Graph.Entra.SignIns } @@ -78,7 +78,7 @@ Describe "New-EntraTrustedCertificateAuthority" { $result.certificateAuthorities.AuthorityType| Should -Be "RootAuthority" $result.certificateAuthorities.TrustedIssuerSki| Should -Be "66aa66aa-bb77-cc88-dd99-00ee00ee00ee" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when parameters are empty" { @@ -105,7 +105,7 @@ Describe "New-EntraTrustedCertificateAuthority" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraTrustedCertificateAuthority" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Remove-EntraFeatureRolloutPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Remove-EntraFeatureRolloutPolicy.Tests.ps1 index dc181dba8..83fa25c7e 100644 --- a/testVNext/Entra/SignIns/Remove-EntraFeatureRolloutPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Remove-EntraFeatureRolloutPolicy.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns } diff --git a/testVNext/Entra/SignIns/Remove-EntraFeatureRolloutPolicyDirectoryObject.Tests.ps1 b/testVNext/Entra/SignIns/Remove-EntraFeatureRolloutPolicyDirectoryObject.Tests.ps1 index c7e05c4ec..1af8be8fe 100644 --- a/testVNext/Entra/SignIns/Remove-EntraFeatureRolloutPolicyDirectoryObject.Tests.ps1 +++ b/testVNext/Entra/SignIns/Remove-EntraFeatureRolloutPolicyDirectoryObject.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns } diff --git a/testVNext/Entra/SignIns/Remove-EntraIdentityProvider.Tests.ps1 b/testVNext/Entra/SignIns/Remove-EntraIdentityProvider.Tests.ps1 index 3e37fa4d9..54e1a2fff 100644 --- a/testVNext/Entra/SignIns/Remove-EntraIdentityProvider.Tests.ps1 +++ b/testVNext/Entra/SignIns/Remove-EntraIdentityProvider.Tests.ps1 @@ -2,13 +2,13 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgIdentityProvider -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgIdentityProvider -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Remove-EntraIdentityProvider" { @@ -17,13 +17,13 @@ Context "Test for Remove-EntraIdentityProvider" { $result = Remove-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgIdentityProvider -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgIdentityProvider -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should execute successfully with Alias" { $result = Remove-EntraIdentityProvider -Id "Google-OAUTH" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgIdentityProvider -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgIdentityProvider -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Id is empty" { { Remove-EntraIdentityProvider -IdentityProviderBaseId } | Should -Throw "Missing an argument for parameter 'IdentityProviderBaseId'*" @@ -32,7 +32,7 @@ Context "Test for Remove-EntraIdentityProvider" { { Remove-EntraIdentityProvider -IdentityProviderBaseId "" } | Should -Throw "Cannot bind argument to parameter 'IdentityProviderBaseId' because it is an empty string." } It "Should contain IdentityProviderBaseId in parameters when passed IdentityProviderBaseId to it" { - Mock -CommandName Remove-MgIdentityProvider -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgIdentityProvider -MockWith {$args} -ModuleName Microsoft.Graph.Entra.SignIns $result = Remove-EntraIdentityProvider -IdentityProviderBaseId "Google-OAUTH" $params = Get-Parameters -data $result @@ -45,7 +45,7 @@ Context "Test for Remove-EntraIdentityProvider" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraIdentityProvider" - Should -Invoke -CommandName Remove-MgIdentityProvider -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgIdentityProvider -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Remove-EntraNamedLocationPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Remove-EntraNamedLocationPolicy.Tests.ps1 index f4e169c20..6bcfd858b 100644 --- a/testVNext/Entra/SignIns/Remove-EntraNamedLocationPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Remove-EntraNamedLocationPolicy.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module .\test\module\Common-Functions.ps1 -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgIdentityConditionalAccessNamedLocation -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgIdentityConditionalAccessNamedLocation -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Remove-EntraNamedLocationPolicy" { @@ -16,7 +16,7 @@ Describe "Remove-EntraNamedLocationPolicy" { $result = Remove-EntraNamedLocationPolicy -PolicyId "1aaaaaa1-2bb2-3cc3-4dd4-5eeeeeeeeee5" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgIdentityConditionalAccessNamedLocation -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgIdentityConditionalAccessNamedLocation -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when PolicyId is empty" { { Remove-EntraNamedLocationPolicy -PolicyId } | Should -Throw "Missing an argument for parameter 'PolicyId'*" @@ -25,7 +25,7 @@ Describe "Remove-EntraNamedLocationPolicy" { { Remove-EntraNamedLocationPolicy -PolicyId "" } | Should -Throw "Cannot bind argument to parameter 'PolicyId' because it is an empty string*" } It "Should contain NamedLocationId in parameters when passed PolicyId to it" { - Mock -CommandName Remove-MgIdentityConditionalAccessNamedLocation -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgIdentityConditionalAccessNamedLocation -MockWith {$args} -ModuleName Microsoft.Graph.Entra.SignIns $result = Remove-EntraNamedLocationPolicy -PolicyId "1aaaaaa1-2bb2-3cc3-4dd4-5eeeeeeeeee5" $params = Get-Parameters -data $result @@ -38,7 +38,7 @@ Describe "Remove-EntraNamedLocationPolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraNamedLocationPolicy" - Should -Invoke -CommandName Remove-MgIdentityConditionalAccessNamedLocation -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgIdentityConditionalAccessNamedLocation -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Remove-EntraOAuth2PermissionGrant.Tests.ps1 b/testVNext/Entra/SignIns/Remove-EntraOAuth2PermissionGrant.Tests.ps1 index de2afed6a..8589509a8 100644 --- a/testVNext/Entra/SignIns/Remove-EntraOAuth2PermissionGrant.Tests.ps1 +++ b/testVNext/Entra/SignIns/Remove-EntraOAuth2PermissionGrant.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module .\test\module\Common-Functions.ps1 -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgOAuth2PermissionGrant -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgOAuth2PermissionGrant -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Remove-EntraGroupAppRoleAssignment" { @@ -16,7 +16,7 @@ Describe "Remove-EntraGroupAppRoleAssignment" { $result = Remove-EntraOAuth2PermissionGrant -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when ObjectId is empty" { { Remove-EntraOAuth2PermissionGrant -ObjectId } | Should -Throw "Missing an argument for parameter 'ObjectId'*" @@ -25,7 +25,7 @@ Describe "Remove-EntraGroupAppRoleAssignment" { { Remove-EntraOAuth2PermissionGrant -ObjectId "" } | Should -Throw "Cannot bind argument to parameter 'ObjectId' because it is an empty string." } It "Should contain OAuth2PermissionGrantId in parameters when passed ObjectId to it" { - Mock -CommandName Remove-MgOAuth2PermissionGrant -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgOAuth2PermissionGrant -MockWith {$args} -ModuleName Microsoft.Graph.Entra.SignIns $result = Remove-EntraOAuth2PermissionGrant -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result @@ -38,7 +38,7 @@ Describe "Remove-EntraGroupAppRoleAssignment" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraOAuth2PermissionGrant" - Should -Invoke -CommandName Remove-MgOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Remove-EntraPermissionGrantConditionSet.Tests.ps1 b/testVNext/Entra/SignIns/Remove-EntraPermissionGrantConditionSet.Tests.ps1 index 977cc1828..0294c62d3 100644 --- a/testVNext/Entra/SignIns/Remove-EntraPermissionGrantConditionSet.Tests.ps1 +++ b/testVNext/Entra/SignIns/Remove-EntraPermissionGrantConditionSet.Tests.ps1 @@ -2,14 +2,14 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgPolicyPermissionGrantPolicyInclude -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgPolicyPermissionGrantPolicyInclude -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns - Mock -CommandName Remove-MgPolicyPermissionGrantPolicyExclude -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgPolicyPermissionGrantPolicyExclude -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Remove-EntraPermissionGrantConditionSet"{ @@ -18,14 +18,14 @@ Describe "Remove-EntraPermissionGrantConditionSet"{ $result = Remove-EntraPermissionGrantConditionSet -PolicyId "test1" -ConditionSetType "includes" -Id "ccccdddd-2222-eeee-3333-ffff4444aaaa" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should delete a permission grant condition set 'excludes' from a policy"{ $result = Remove-EntraPermissionGrantConditionSet -PolicyId "test1" -ConditionSetType "excludes" -Id "ccccdddd-2222-eeee-3333-ffff4444aaaa" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgPolicyPermissionGrantPolicyExclude -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgPolicyPermissionGrantPolicyExclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when PolicyId parameter are invalid when ConditionSetType is includes" { @@ -69,7 +69,7 @@ Describe "Remove-EntraPermissionGrantConditionSet"{ } It "Should contain PermissionGrantPolicyId in parameters when passed PolicyId to it" { - Mock -CommandName Remove-MgPolicyPermissionGrantPolicyInclude -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgPolicyPermissionGrantPolicyInclude -MockWith {$args} -ModuleName Microsoft.Graph.Entra.SignIns $result = Remove-EntraPermissionGrantConditionSet -PolicyId "test1" -ConditionSetType "includes" -Id "ccccdddd-2222-eeee-3333-ffff4444aaaa" $params = Get-Parameters -data $result @@ -77,7 +77,7 @@ Describe "Remove-EntraPermissionGrantConditionSet"{ } It "Should contain PermissionGrantConditionSetId in parameters when passed Id to it" { - Mock -CommandName Remove-MgPolicyPermissionGrantPolicyInclude -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgPolicyPermissionGrantPolicyInclude -MockWith {$args} -ModuleName Microsoft.Graph.Entra.SignIns $result = Remove-EntraPermissionGrantConditionSet -PolicyId "test1" -ConditionSetType "includes" -Id "ccccdddd-2222-eeee-3333-ffff4444aaaa" $params = Get-Parameters -data $result @@ -91,7 +91,7 @@ Describe "Remove-EntraPermissionGrantConditionSet"{ $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraPermissionGrantConditionSet" - Should -Invoke -CommandName Remove-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Remove-EntraPermissionGrantPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Remove-EntraPermissionGrantPolicy.Tests.ps1 index 09ea4413e..e1d72017a 100644 --- a/testVNext/Entra/SignIns/Remove-EntraPermissionGrantPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Remove-EntraPermissionGrantPolicy.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module .\test\module\Common-Functions.ps1 -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgPolicyPermissionGrantPolicy -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgPolicyPermissionGrantPolicy -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Remove-EntraPermissionGrantPolicy" { @@ -16,7 +16,7 @@ Describe "Remove-EntraPermissionGrantPolicy" { $result = Remove-EntraPermissionGrantPolicy -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Id is empty" { { Remove-EntraPermissionGrantPolicy -Id } | Should -Throw "Missing an argument for parameter 'Id'*" @@ -25,7 +25,7 @@ Describe "Remove-EntraPermissionGrantPolicy" { { Remove-EntraPermissionGrantPolicy -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id' because it is an empty string*" } It "Should contain PermissionGrantPolicyId in parameters when passed Id to it" { - Mock -CommandName Remove-MgPolicyPermissionGrantPolicy -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgPolicyPermissionGrantPolicy -MockWith {$args} -ModuleName Microsoft.Graph.Entra.SignIns $result = Remove-EntraPermissionGrantPolicy -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" $params = Get-Parameters -data $result @@ -38,7 +38,7 @@ Describe "Remove-EntraPermissionGrantPolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraPermissionGrantPolicy" - Should -Invoke -CommandName Remove-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Remove-EntraPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Remove-EntraPolicy.Tests.ps1 index 65926d67a..6d54d86cb 100644 --- a/testVNext/Entra/SignIns/Remove-EntraPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Remove-EntraPolicy.Tests.ps1 @@ -3,11 +3,11 @@ # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null) { + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $ScriptBlock = { @@ -18,13 +18,13 @@ BeforeAll { return $response } - Mock -CommandName Invoke-GraphRequest -MockWith $ScriptBlock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $ScriptBlock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Test for Remove-EntraPolicy" { It "Should return empty object" { $result = Remove-EntraPolicy -Id bbbbbbbb-1111-1111-1111-cccccccccccc #$result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 2 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 2 } It "Should fail when -Id is empty" { { Remove-EntraPolicy -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id'*" @@ -40,7 +40,7 @@ Describe "Test for Remove-EntraPolicy" { $result = Remove-EntraPolicy -Id bbbbbbbb-1111-1111-1111-cccccccccccc $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraPolicy" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Remove-EntraTrustedCertificateAuthority.Tests.ps1 b/testVNext/Entra/SignIns/Remove-EntraTrustedCertificateAuthority.Tests.ps1 index 47d772520..25a1aff3c 100644 --- a/testVNext/Entra/SignIns/Remove-EntraTrustedCertificateAuthority.Tests.ps1 +++ b/testVNext/Entra/SignIns/Remove-EntraTrustedCertificateAuthority.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null) { + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -17,7 +17,7 @@ BeforeAll { } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns $scriptblock2 = { @@ -37,7 +37,7 @@ BeforeAll { } - Mock -CommandName Get-MgOrganizationCertificateBasedAuthConfiguration -MockWith $scriptblock2 -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgOrganizationCertificateBasedAuthConfiguration -MockWith $scriptblock2 -ModuleName Microsoft.Graph.Entra.SignIns $scriptblock3 = { return @( @@ -48,7 +48,7 @@ BeforeAll { } - Mock -CommandName Get-MgContext -MockWith $scriptblock3 -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgContext -MockWith $scriptblock3 -ModuleName Microsoft.Graph.Entra.SignIns } @@ -59,7 +59,7 @@ Describe "Remove-EntraTrustedCertificateAuthority" { $result = Remove-EntraTrustedCertificateAuthority -CertificateAuthorityInformation $cer[0] $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when CertificateAuthorityInformation is empty" { @@ -77,7 +77,7 @@ Describe "Remove-EntraTrustedCertificateAuthority" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraTrustedCertificateAuthority" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Set-EntraAuthorizationPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Set-EntraAuthorizationPolicy.Tests.ps1 index ae84ebcfe..08a27b756 100644 --- a/testVNext/Entra/SignIns/Set-EntraAuthorizationPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Set-EntraAuthorizationPolicy.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null) { + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Update-MgPolicyAuthorizationPolicy -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgPolicyAuthorizationPolicy -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Set-EntraAuthorizationPolicy" { @@ -20,7 +20,7 @@ Describe "Set-EntraAuthorizationPolicy" { $result = Set-EntraAuthorizationPolicy -AllowedToSignUpEmailBasedSubscriptions $false -AllowedToUseSSPR $false -AllowEmailVerifiedUsersToJoinOrganization $true -BlockMsolPowerShell $true -DefaultUserRolePermissions $DefaultUserRolePermissions -Description "test" -DisplayName "Authorization Policies" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgPolicyAuthorizationPolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgPolicyAuthorizationPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when AllowedToSignUpEmailBasedSubscriptions is invalid" { { Set-EntraAuthorizationPolicy -AllowedToSignUpEmailBasedSubscriptions 'a' } | Should -Throw "Cannot process argument transformation on parameter 'AllowedToSignUpEmailBasedSubscriptions'.*" @@ -69,7 +69,7 @@ Describe "Set-EntraAuthorizationPolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraAuthorizationPolicy" - Should -Invoke -CommandName Update-MgPolicyAuthorizationPolicy -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgPolicyAuthorizationPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Set-EntraConditionalAccessPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Set-EntraConditionalAccessPolicy.Tests.ps1 index 537dbe239..fe0d79966 100644 --- a/testVNext/Entra/SignIns/Set-EntraConditionalAccessPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Set-EntraConditionalAccessPolicy.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Update-MgIdentityConditionalAccessPolicy -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgIdentityConditionalAccessPolicy -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Set-EntraConditionalAccessPolicy" { @@ -19,7 +19,7 @@ Describe "Set-EntraConditionalAccessPolicy" { $result = Set-EntraConditionalAccessPolicy -PolicyId "1aaaaaa1-2bb2-3cc3-4dd4-5eeeeeeeeee5" -DisplayName "test" -State enabled -Conditions $Condition -GrantControls $Controls -SessionControls $SessionControls $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when PolicyId parameter is empty" { @@ -63,7 +63,7 @@ Describe "Set-EntraConditionalAccessPolicy" { } It "Should contain ConditionalAccessPolicyId in parameters when passed PolicyId to it" { - Mock -CommandName Update-MgIdentityConditionalAccessPolicy -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgIdentityConditionalAccessPolicy -MockWith {$args} -ModuleName Microsoft.Graph.Entra.SignIns $result = Set-EntraConditionalAccessPolicy -PolicyId "1aaaaaa1-2bb2-3cc3-4dd4-5eeeeeeeeee5" -DisplayName "test" $params = Get-Parameters -data $result @@ -71,7 +71,7 @@ Describe "Set-EntraConditionalAccessPolicy" { } It "Should contain ClientAppTypes in parameters when passed Conditions to it" { - Mock -CommandName Update-MgIdentityConditionalAccessPolicy -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgIdentityConditionalAccessPolicy -MockWith {$args} -ModuleName Microsoft.Graph.Entra.SignIns $Condition = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessConditionSet $Condition.clientAppTypes = @("mobileAppsAndDesktopClients","browser") @@ -81,11 +81,11 @@ Describe "Set-EntraConditionalAccessPolicy" { $params = Get-Parameters -data $result $params.Conditions.ClientAppTypes | Should -Be @("mobileAppsAndDesktopClients","browser") - Should -Invoke -CommandName Update-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should contain BuiltInControls in parameters when passed GrantControls to it" { - Mock -CommandName Update-MgIdentityConditionalAccessPolicy -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgIdentityConditionalAccessPolicy -MockWith {$args} -ModuleName Microsoft.Graph.Entra.SignIns $Condition = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessConditionSet $Controls = New-Object -TypeName Microsoft.Open.MSGraph.Model.ConditionalAccessGrantControls @@ -96,7 +96,7 @@ Describe "Set-EntraConditionalAccessPolicy" { $params = Get-Parameters -data $result $params.GrantControls.BuiltInControls | Should -Be @("mfa") - Should -Invoke -CommandName Update-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should contain 'User-Agent' header" { @@ -111,7 +111,7 @@ Describe "Set-EntraConditionalAccessPolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraConditionalAccessPolicy" - Should -Invoke -CommandName Update-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgIdentityConditionalAccessPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Set-EntraFeatureRolloutPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Set-EntraFeatureRolloutPolicy.Tests.ps1 index 433eee8d9..333b81503 100644 --- a/testVNext/Entra/SignIns/Set-EntraFeatureRolloutPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Set-EntraFeatureRolloutPolicy.Tests.ps1 @@ -3,12 +3,12 @@ # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null) { + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Set-EntraFeatureRolloutPolicy" { @@ -17,7 +17,7 @@ Describe "Set-EntraFeatureRolloutPolicy" { $result = Set-EntraFeatureRolloutPolicy -Id 7e22e9df-abf0-4ee2-bcf8-fd7b62eff2f5 -DisplayName 'Feature-Rollout-Policytest' -Description 'Feature-Rollout-test' -IsEnabled $false $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Id are invalid" { { Set-EntraFeatureRolloutPolicy -Id "" } | Should -Throw "Cannot bind argument to parameter 'Id'*" @@ -47,7 +47,7 @@ Describe "Set-EntraFeatureRolloutPolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraFeatureRolloutPolicy" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Set-EntraNamedLocationPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Set-EntraNamedLocationPolicy.Tests.ps1 index 923eab9ff..0ad72de98 100644 --- a/testVNext/Entra/SignIns/Set-EntraNamedLocationPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Set-EntraNamedLocationPolicy.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Update-MgIdentityConditionalAccessNamedLocation -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgIdentityConditionalAccessNamedLocation -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Set-EntraNamedLocationPolicy" { @@ -20,7 +20,7 @@ Describe "Set-EntraNamedLocationPolicy" { $result = Set-EntraNamedLocationPolicy -PolicyId "1aaaaaa1-2bb2-3cc3-4dd4-5eeeeeeeeee5" -OdataType "#microsoft.graph.ipNamedLocation" -DisplayName "Mock-App policies" -IpRanges @($ipRanges1,$ipRanges2) -IsTrusted $true -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -CountriesAndRegions @("US","ID","CA") -IncludeUnknownCountriesAndRegions $true $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgIdentityConditionalAccessNamedLocation -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgIdentityConditionalAccessNamedLocation -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when PolicyId is empty" { { Set-EntraNamedLocationPolicy -PolicyId -OdataType "#microsoft.graph.ipNamedLocation" } | Should -Throw "Missing an argument for parameter 'PolicyId'*" @@ -59,7 +59,7 @@ Describe "Set-EntraNamedLocationPolicy" { { Set-EntraNamedLocationPolicy -PolicyId "1aaaaaa1-2bb2-3cc3-4dd4-5eeeeeeeeee5" -IncludeUnknownCountriesAndRegions xyz } | Should -Throw "Cannot process argument transformation on parameter 'IncludeUnknownCountriesAndRegions'*" } It "Should contain NamedLocationId in parameters when passed PolicyId to it" { - Mock -CommandName Update-MgIdentityConditionalAccessNamedLocation -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgIdentityConditionalAccessNamedLocation -MockWith {$args} -ModuleName Microsoft.Graph.Entra.SignIns $result = Set-EntraNamedLocationPolicy -PolicyId "1aaaaaa1-2bb2-3cc3-4dd4-5eeeeeeeeee5" -OdataType "#microsoft.graph.ipNamedLocation" -DisplayName "Mock-App policies" $params = Get-Parameters -data $result @@ -68,7 +68,7 @@ Describe "Set-EntraNamedLocationPolicy" { It "Should contain @odata.type in bodyparameters when passed OdataId to it" { Set-EntraNamedLocationPolicy -PolicyId "1aaaaaa1-2bb2-3cc3-4dd4-5eeeeeeeeee5" -OdataType "#microsoft.graph.ipNamedLocation" -DisplayName "Mock-App policies" - Should -Invoke -CommandName Update-MgIdentityConditionalAccessNamedLocation -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgIdentityConditionalAccessNamedLocation -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { Write-Host $BodyParameter.AdditionalProperties."@odata.type" | ConvertTo-Json $BodyParameter.AdditionalProperties."@odata.type" | Should -Be "#microsoft.graph.ipNamedLocation" $true @@ -81,7 +81,7 @@ Describe "Set-EntraNamedLocationPolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraNamedLocationPolicy" - Should -Invoke -CommandName Update-MgIdentityConditionalAccessNamedLocation -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgIdentityConditionalAccessNamedLocation -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Set-EntraPermissionGrantConditionSet.Tests.ps1 b/testVNext/Entra/SignIns/Set-EntraPermissionGrantConditionSet.Tests.ps1 index ae7c5453e..4ca67e573 100644 --- a/testVNext/Entra/SignIns/Set-EntraPermissionGrantConditionSet.Tests.ps1 +++ b/testVNext/Entra/SignIns/Set-EntraPermissionGrantConditionSet.Tests.ps1 @@ -1,23 +1,23 @@ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Update-MgPolicyPermissionGrantPolicyInclude -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgPolicyPermissionGrantPolicyInclude -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns - Mock -CommandName Update-MgPolicyPermissionGrantPolicyExclude -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgPolicyPermissionGrantPolicyExclude -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Set-EntraPermissionGrantConditionSet"{ It "Should return empty object for condition set 'includes'"{ $result = Set-EntraPermissionGrantConditionSet -PolicyId "policy1" -ConditionSetType "includes" -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -PermissionClassification "Low" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should return empty object for condition set 'excludes'"{ $result = Set-EntraPermissionGrantConditionSet -PolicyId "policy1" -ConditionSetType "excludes" -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -PermissionClassification "Low" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgPolicyPermissionGrantPolicyExclude -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgPolicyPermissionGrantPolicyExclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when parameters are empty" { { Set-EntraPermissionGrantConditionSet -PolicyId "" -ConditionSetType "" -Id ""} | Should -Throw "Cannot bind argument to parameter*" @@ -26,27 +26,27 @@ Describe "Set-EntraPermissionGrantConditionSet"{ { Set-EntraPermissionGrantConditionSet -PolicyId -ConditionSetType -Id } | Should -Throw "Missing an argument for parameter*" } It "Should contain parameters for condition set 'includes'" { - Mock -CommandName Update-MgPolicyPermissionGrantPolicyInclude -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgPolicyPermissionGrantPolicyInclude -MockWith {$args} -ModuleName Microsoft.Graph.Entra.SignIns $result = Set-EntraPermissionGrantConditionSet -PolicyId "policy1" -ConditionSetType "includes" -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -PermissionClassification "Low" $params = Get-Parameters -data $result $params.PermissionGrantPolicyId | Should -Be "policy1" $params.PermissionGrantConditionSetId | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - Should -Invoke -CommandName Update-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgPolicyPermissionGrantPolicyInclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should contain parameters for condition set 'excludes'" { - Mock -CommandName Update-MgPolicyPermissionGrantPolicyExclude -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgPolicyPermissionGrantPolicyExclude -MockWith {$args} -ModuleName Microsoft.Graph.Entra.SignIns $result = Set-EntraPermissionGrantConditionSet -PolicyId "policy1" -ConditionSetType "excludes" -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -PermissionClassification "Low" $params = Get-Parameters -data $result $params.PermissionGrantPolicyId | Should -Be "policy1" $params.PermissionGrantConditionSetId | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - Should -Invoke -CommandName Update-MgPolicyPermissionGrantPolicyExclude -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgPolicyPermissionGrantPolicyExclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraPermissionGrantConditionSet" $result = Set-EntraPermissionGrantConditionSet -PolicyId "policy1" -ConditionSetType "excludes" -Id "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" -PermissionClassification "Low" $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraPermissionGrantConditionSet" - Should -Invoke -CommandName Update-MgPolicyPermissionGrantPolicyExclude -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgPolicyPermissionGrantPolicyExclude -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Set-EntraPermissionGrantPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Set-EntraPermissionGrantPolicy.Tests.ps1 index 3cbdfea40..3b497e1cd 100644 --- a/testVNext/Entra/SignIns/Set-EntraPermissionGrantPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Set-EntraPermissionGrantPolicy.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null) { + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Update-MgPolicyPermissionGrantPolicy -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgPolicyPermissionGrantPolicy -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Set-EntraPermissionGrantPolicy" { @@ -16,7 +16,7 @@ Describe "Set-EntraPermissionGrantPolicy" { $result = Set-EntraPermissionGrantPolicy -Id "permission_grant_policy" -Description "test" -DisplayName "Test" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when Id is empty" { { Set-EntraPermissionGrantPolicy -Id -Description "test" -DisplayName "Test" } | Should -Throw "Missing an argument for parameter 'Id'.*" @@ -37,7 +37,7 @@ Describe "Set-EntraPermissionGrantPolicy" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraPermissionGrantPolicy" - Should -Invoke -CommandName Update-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgPolicyPermissionGrantPolicy -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Set-EntraPolicy.Tests.ps1 b/testVNext/Entra/SignIns/Set-EntraPolicy.Tests.ps1 index df702dd38..ee6aee13b 100644 --- a/testVNext/Entra/SignIns/Set-EntraPolicy.Tests.ps1 +++ b/testVNext/Entra/SignIns/Set-EntraPolicy.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { #Write-Host "Mocking set-EntraPolicy with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -15,7 +15,7 @@ BeforeAll { return $response } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns } Describe "Test for Set-EntraPolicy" { @@ -23,7 +23,7 @@ Describe "Test for Set-EntraPolicy" { It "Should return empty object" { $result = Set-EntraPolicy -Id "bbbbbbbb-1111-2222-3333-cccccccccccc" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when id is empty" { @@ -50,25 +50,11 @@ Describe "Test for Set-EntraPolicy" { Set-EntraPolicy -Id "Engineering_Project" -type "HomeRealmDiscoveryPolicy" - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraPolicy" - - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } } - It "Should contain 'User-Agent' header" { - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraPartnerInformation" - - Set-EntraPartnerInformation -PartnerSupportUrl "http://www.test1.com" -PartnerCommerceUrl "http://www.test1.com" -PartnerHelpUrl "http://www.test1.com" -PartnerSupportEmails "contoso@example.com" -PartnerSupportTelephones "2342" -TenantId b73cc049-a025-4441-ba3a-8826d9a68ecc - - $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraPartnerInformation" - - Should -Invoke -CommandName Invoke-MgGraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { - $Headers.'User-Agent' | Should -Be $userAgentHeaderValue - $true - } - } It "Should execute successfully without throwing an error" { # Disable confirmation prompts $originalDebugPreference = $DebugPreference diff --git a/testVNext/Entra/SignIns/Set-EntraTrustedCertificateAuthority.Tests.ps1 b/testVNext/Entra/SignIns/Set-EntraTrustedCertificateAuthority.Tests.ps1 index b14036a06..0d47c7a86 100644 --- a/testVNext/Entra/SignIns/Set-EntraTrustedCertificateAuthority.Tests.ps1 +++ b/testVNext/Entra/SignIns/Set-EntraTrustedCertificateAuthority.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.SignIns) -eq $null){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $tenantObj = { @@ -17,7 +17,7 @@ BeforeAll { } - Mock -CommandName Get-MgContext -MockWith $tenantObj -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgContext -MockWith $tenantObj -ModuleName Microsoft.Graph.Entra.SignIns $scriptblock = { return @( @@ -37,7 +37,7 @@ BeforeAll { ) } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.SignIns $scriptblock2 = { return @( @@ -55,7 +55,7 @@ BeforeAll { } - Mock -CommandName Get-MgOrganizationCertificateBasedAuthConfiguration -MockWith $scriptblock2 -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgOrganizationCertificateBasedAuthConfiguration -MockWith $scriptblock2 -ModuleName Microsoft.Graph.Entra.SignIns } @@ -75,7 +75,7 @@ Describe "Set-EntraTrustedCertificateAuthority" { $result.certificateAuthorities.AuthorityType| Should -Be "RootAuthority" $result.certificateAuthorities.TrustedIssuerSki| Should -Be "E48DBC5D4AF447E9D9D4A5440D4096C70AF5352A" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } It "Should fail when parameters are empty" { @@ -96,7 +96,7 @@ Describe "Set-EntraTrustedCertificateAuthority" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraTrustedCertificateAuthority" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/SignIns/Valid.Tests.ps1 b/testVNext/Entra/SignIns/Valid.Tests.ps1 index 5013e8327..8feeeeb40 100644 --- a/testVNext/Entra/SignIns/Valid.Tests.ps1 +++ b/testVNext/Entra/SignIns/Valid.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll{ - if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module Microsoft.Graph.Entra + if($null -eq (Get-Module -Name Microsoft.Graph.Entra.SignIns)){ + Import-Module Microsoft.Graph.Entra.SignIns } - Import-Module (Join-Path $psscriptroot ".\EntraCmdletsMap.ps1") -Force + Import-Module (Join-Path $psscriptroot "..\EntraCmdletsMap.ps1") -Force - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.SignIns } Describe "Valid parameter Tests"{ @@ -20,23 +20,23 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | Select-Object -expand Name) - if($params.count -eq 1 -and $params -eq 'Id'){ + if(($params -eq 'Id') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'Id')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { Write-Host "$command" $commandScriptBlock = [scriptblock]::Create("$commandName -Id 056b2531-005e-4f3e-be78-01a71ea30a04") if($filter.IsApi){ - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } else { - Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } } catch { @@ -58,23 +58,23 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | select -expand Name) - if($params.count -eq 1 -and $params -eq 'ObjectId'){ + if(($params -eq 'ObjectId') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'ObjectId')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { Write-Host "$command" $commandScriptBlock = [scriptblock]::Create("$commandName -ObjectId 056b2531-005e-4f3e-be78-01a71ea30a04") if($filter.IsApi){ - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } else { - Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra.SignIns $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra.SignIns -Times 1 } } catch { diff --git a/testVNext/Entra/Users/Entra.Tests.ps1 b/testVNext/Entra/Users/Entra.Tests.ps1 deleted file mode 100644 index e6b0c3179..000000000 --- a/testVNext/Entra/Users/Entra.Tests.ps1 +++ /dev/null @@ -1,31 +0,0 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. -# ------------------------------------------------------------------------------ - -if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module .\bin\Microsoft.Graph.Entra.psd1 -Force -} - -Import-Module Pester - -$psmPath = (Get-Module Microsoft.Graph.Entra).Path -$testReportPath = join-path $psscriptroot "..\..\..\TestReport\Entra" -$mockScriptsPath = join-path $psscriptroot "..\..\..\test\module\Entra\*.Tests.ps1" - -$testOutputFile = "$testReportPath\TestResults.xml" -if (!(test-path -path $testReportPath)) {new-item -path $testReportPath -itemtype directory} - -$mockScripts = Get-ChildItem -Path $mockScriptsPath -Exclude "Entra.Tests.ps1" | ForEach-Object { $_.FullName } - -$config = New-PesterConfiguration -$config.Run.Path = $mockScripts -$config.Run.PassThru = $true -$config.Run.Exit = $true -$config.CodeCoverage.Enabled = $true -$config.CodeCoverage.CoveragePercentTarget = 100 -$config.CodeCoverage.Path = $psmPath -$config.TestResult.Enabled = $true -$config.TestResult.OutputPath = $testOutputFile -$config.Output.Verbosity = "Detailed" - -Invoke-Pester -Configuration $config \ No newline at end of file diff --git a/testVNext/Entra/Users/Get-EntraUser.Tests.ps1 b/testVNext/Entra/Users/Get-EntraUser.Tests.ps1 index 65533a2a7..25930ba10 100644 --- a/testVNext/Entra/Users/Get-EntraUser.Tests.ps1 +++ b/testVNext/Entra/Users/Get-EntraUser.Tests.ps1 @@ -3,10 +3,10 @@ # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { $valueObject = [PSCustomObject]@{ @@ -48,7 +48,7 @@ BeforeAll { ) } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } Describe "Get-EntraUser" { @@ -59,7 +59,7 @@ Describe "Get-EntraUser" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('bbbbbbbb-1111-2222-3333-cccccccccccc') - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should execute successfully with Alias" { @@ -68,7 +68,7 @@ Describe "Get-EntraUser" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be @('bbbbbbbb-1111-2222-3333-cccccccccccc') - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should contain 'User-Agent' header" { @@ -79,7 +79,7 @@ Describe "Get-EntraUser" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUser" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } @@ -96,7 +96,7 @@ Describe "Get-EntraUser" { It "Should return all contact" { $result = Get-EntraUser -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when All has an argument" { @@ -107,7 +107,7 @@ Describe "Get-EntraUser" { $result = Get-EntraUser -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when top is empty" { @@ -123,7 +123,7 @@ Describe "Get-EntraUser" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | should -Be 'Mock-User' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should return specific user by search string" { @@ -131,7 +131,7 @@ Describe "Get-EntraUser" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock-User' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } @@ -148,7 +148,7 @@ Describe "Get-EntraUser" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be 'Mock-User' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when Property is empty" { diff --git a/testVNext/Entra/Users/Get-EntraUserAppRoleAssignment.Tests.ps1 b/testVNext/Entra/Users/Get-EntraUserAppRoleAssignment.Tests.ps1 index b9a1578cf..93c37783e 100644 --- a/testVNext/Entra/Users/Get-EntraUserAppRoleAssignment.Tests.ps1 +++ b/testVNext/Entra/Users/Get-EntraUserAppRoleAssignment.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -26,7 +26,7 @@ BeforeAll { } - Mock -CommandName Get-MgUserAppRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgUserAppRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } Describe "Get-EntraUserAppRoleAssignment" { @@ -45,7 +45,7 @@ Describe "Get-EntraUserAppRoleAssignment" { $result.ResourceDisplayName | Should -Be "M365 License Manager" $result.ResourceId | Should -Be "bbbbbbbb-cccc-dddd-2222-333333333333" - Should -Invoke -CommandName Get-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when ObjectId is empty string value" { @@ -60,7 +60,7 @@ Describe "Get-EntraUserAppRoleAssignment" { It "Should return all contact" { $result = Get-EntraUserAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when All has an argument" { @@ -71,7 +71,7 @@ Describe "Get-EntraUserAppRoleAssignment" { $result = Get-EntraUserAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when top is empty" { @@ -96,7 +96,7 @@ Describe "Get-EntraUserAppRoleAssignment" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserAppRoleAssignment" - Should -Invoke -CommandName Get-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } @@ -108,7 +108,7 @@ Describe "Get-EntraUserAppRoleAssignment" { $result | Should -Not -BeNullOrEmpty $result.PrincipalDisplayName | Should -Be "demo" - Should -Invoke -CommandName Get-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when Property is empty" { diff --git a/testVNext/Entra/Users/Get-EntraUserCreatedObject.Tests.ps1 b/testVNext/Entra/Users/Get-EntraUserCreatedObject.Tests.ps1 index eef7d273a..a057e402f 100644 --- a/testVNext/Entra/Users/Get-EntraUserCreatedObject.Tests.ps1 +++ b/testVNext/Entra/Users/Get-EntraUserCreatedObject.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -49,7 +49,7 @@ BeforeAll { } - Mock -CommandName Get-MgUserCreatedObject -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgUserCreatedObject -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } Describe "Get-EntraUserCreatedObject" { @@ -59,7 +59,7 @@ Describe "Get-EntraUserCreatedObject" { $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should return specific User with alias" { @@ -67,7 +67,7 @@ Describe "Get-EntraUserCreatedObject" { $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when UserId is empty string value" { @@ -81,7 +81,7 @@ Describe "Get-EntraUserCreatedObject" { It "Should return all contact" { $result = Get-EntraUserCreatedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when All has an argument" { @@ -92,7 +92,7 @@ Describe "Get-EntraUserCreatedObject" { $result = Get-EntraUserCreatedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when top is empty" { @@ -117,7 +117,7 @@ Describe "Get-EntraUserCreatedObject" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserCreatedObject" - Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } @@ -128,7 +128,7 @@ Describe "Get-EntraUserCreatedObject" { $result | Should -Not -BeNullOrEmpty $result.appDisplayName | Should -Be "Microsoft Graph Command Line Tools" - Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserCreatedObject -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when Property is empty" { diff --git a/testVNext/Entra/Users/Get-EntraUserDirectReport.Tests.ps1 b/testVNext/Entra/Users/Get-EntraUserDirectReport.Tests.ps1 index 0643919d8..463aaec32 100644 --- a/testVNext/Entra/Users/Get-EntraUserDirectReport.Tests.ps1 +++ b/testVNext/Entra/Users/Get-EntraUserDirectReport.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @{ @@ -29,7 +29,7 @@ BeforeAll { } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } @@ -41,14 +41,14 @@ Describe "Get-EntraUserDirectReport" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should return specific user direct report with alias" { $result = Get-EntraUserDirectReport -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when UserId is empty" { { Get-EntraUserDirectReport -UserId } | Should -Throw "Missing an argument for parameter 'UserId'*" @@ -61,7 +61,7 @@ Describe "Get-EntraUserDirectReport" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when All is invalid" { { Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" @@ -71,7 +71,7 @@ Describe "Get-EntraUserDirectReport" { $result | Should -Not -BeNullOrEmpty $result.Id | should -Be 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when top is empty" { { Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" @@ -84,7 +84,7 @@ Describe "Get-EntraUserDirectReport" { $result | Should -Not -BeNullOrEmpty $result.DisplayName | Should -Be "Mock-User" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when Property is empty" { { Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -115,7 +115,7 @@ Describe "Get-EntraUserDirectReport" { $result = Get-EntraUserDirectReport -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserDirectReport" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/Get-EntraUserExtension.Tests.ps1 b/testVNext/Entra/Users/Get-EntraUserExtension.Tests.ps1 index 1cdbc205e..764b74477 100644 --- a/testVNext/Entra/Users/Get-EntraUserExtension.Tests.ps1 +++ b/testVNext/Entra/Users/Get-EntraUserExtension.Tests.ps1 @@ -1,8 +1,8 @@ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @{ @@ -14,7 +14,7 @@ BeforeAll { } } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } Describe "Get-EntraUserExtension" { Context "Test for Get-EntraUserExtension" { @@ -22,14 +22,14 @@ Describe "Get-EntraUserExtension" { $result = Get-EntraUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should execute successfully with Alias" { $result = Get-EntraUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should contain 'User-Agent' header" { @@ -37,7 +37,7 @@ Describe "Get-EntraUserExtension" { $result = Get-EntraUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } @@ -55,7 +55,7 @@ Describe "Get-EntraUserExtension" { $result = Get-EntraUserExtension -UserId "bbbbbbbb-1111-2222-3333-cccccccccccc" -Property DisplayName $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when Property is empty" { diff --git a/testVNext/Entra/Users/Get-EntraUserLicenseDetail.Tests.ps1 b/testVNext/Entra/Users/Get-EntraUserLicenseDetail.Tests.ps1 index cd3ec9859..e6baca990 100644 --- a/testVNext/Entra/Users/Get-EntraUserLicenseDetail.Tests.ps1 +++ b/testVNext/Entra/Users/Get-EntraUserLicenseDetail.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Get-EntraUserLicenseDetail with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -22,7 +22,7 @@ BeforeAll { } - Mock -CommandName Get-MgUserLicenseDetail -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgUserLicenseDetail -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } Describe "Get-EntraUserLicenseDetail" { @@ -36,7 +36,7 @@ Describe "Get-EntraUserLicenseDetail" { $result.SkuPartNumber | Should -Be "ENTERPRISEPREMIUM" $result.AdditionalProperties | Should -BeOfType [System.Collections.Hashtable] - should -Invoke -CommandName Get-MgUserLicenseDetail -ModuleName Microsoft.Graph.Entra -Times 1 + should -Invoke -CommandName Get-MgUserLicenseDetail -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should return specific User with alias" { $result = Get-EntraUserLicenseDetail -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" @@ -47,7 +47,7 @@ Describe "Get-EntraUserLicenseDetail" { $result.SkuPartNumber | Should -Be "ENTERPRISEPREMIUM" $result.AdditionalProperties | Should -BeOfType [System.Collections.Hashtable] - should -Invoke -CommandName Get-MgUserLicenseDetail -ModuleName Microsoft.Graph.Entra -Times 1 + should -Invoke -CommandName Get-MgUserLicenseDetail -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when UserId is empty string value" { @@ -68,7 +68,7 @@ Describe "Get-EntraUserLicenseDetail" { $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be 'X8Wu1RItQkSNL8zKldQ5DmAn38eBLPdOtXhbU5K1cd8' - Should -Invoke -CommandName Get-MgUserLicenseDetail -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserLicenseDetail -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when Property is empty" { { Get-EntraUserLicenseDetail -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -81,7 +81,7 @@ Describe "Get-EntraUserLicenseDetail" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserLicenseDetail" - Should -Invoke -CommandName Get-MgUserLicenseDetail -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgUserLicenseDetail -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/Get-EntraUserManager.Tests.ps1 b/testVNext/Entra/Users/Get-EntraUserManager.Tests.ps1 index 0b5a3f4ac..641906470 100644 --- a/testVNext/Entra/Users/Get-EntraUserManager.Tests.ps1 +++ b/testVNext/Entra/Users/Get-EntraUserManager.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Get-EntraUserManager with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -32,7 +32,7 @@ BeforeAll { } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } Describe "Get-EntraUserManager" { @@ -52,7 +52,7 @@ Describe "Get-EntraUserManager" { $result.identities[0].issuer | Should -Be "contoso.com" $result.identities[0].issuerAssignedId | Should -Be "test@contoso.com" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should return specific User wit alias" { @@ -70,7 +70,7 @@ Describe "Get-EntraUserManager" { $result.identities[0].issuer | Should -Be "contoso.com" $result.identities[0].issuerAssignedId | Should -Be "test@contoso.com" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when UserId is empty string value" { @@ -95,7 +95,7 @@ Describe "Get-EntraUserManager" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserManager" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } @@ -106,7 +106,7 @@ Describe "Get-EntraUserManager" { $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "00aa00aa-bb11-cc22-dd33-44ee44ee44ee" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when Property is empty" { diff --git a/testVNext/Entra/Users/Get-EntraUserMembership.Tests.ps1 b/testVNext/Entra/Users/Get-EntraUserMembership.Tests.ps1 index bfeb1489d..d0dea5239 100644 --- a/testVNext/Entra/Users/Get-EntraUserMembership.Tests.ps1 +++ b/testVNext/Entra/Users/Get-EntraUserMembership.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null){ + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -21,7 +21,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgUserMemberOf -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgUserMemberOf -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } Describe "Get-EntraUserMembership" { @@ -30,14 +30,14 @@ Describe "Get-EntraUserMembership" { $result = Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should return specific user membership with alias" { $result = Get-EntraUserMembership -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when UserId is empty" { @@ -52,7 +52,7 @@ Describe "Get-EntraUserMembership" { $result = Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when All has an argument" { @@ -63,7 +63,7 @@ Describe "Get-EntraUserMembership" { $result = Get-EntraUserMembership -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 5 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when top is empty" { @@ -90,7 +90,7 @@ Describe "Get-EntraUserMembership" { $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "11bb11bb-cc22-dd33-ee44-55ff55ff55ff" - Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when Property is empty" { @@ -105,7 +105,7 @@ Describe "Get-EntraUserMembership" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserMembership" - Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgUserMemberOf -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/Get-EntraUserOAuth2PermissionGrant.Tests.ps1 b/testVNext/Entra/Users/Get-EntraUserOAuth2PermissionGrant.Tests.ps1 index 38367a325..1d879ef92 100644 --- a/testVNext/Entra/Users/Get-EntraUserOAuth2PermissionGrant.Tests.ps1 +++ b/testVNext/Entra/Users/Get-EntraUserOAuth2PermissionGrant.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null){ + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -21,7 +21,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgUserOAuth2PermissionGrant -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgUserOAuth2PermissionGrant -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } Describe "Get-EntraUserOAuth2PermissionGrant" { @@ -32,7 +32,7 @@ Describe "Get-EntraUserOAuth2PermissionGrant" { $result.PrincipalId | should -Contain 'aaaaaaaa-bbbb-cccc-1111-222222222222' $result.Id | Should -Contain 'Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2' - Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should return specific UserOAuth2PermissionGrant with alias" { @@ -41,7 +41,7 @@ Describe "Get-EntraUserOAuth2PermissionGrant" { $result.PrincipalId | should -Contain 'aaaaaaaa-bbbb-cccc-1111-222222222222' $result.Id | Should -Contain 'Aa1Bb2Cc3.-Dd4Ee5Ff6Gg7Hh8Ii9_~Jj0Kk1Ll2' - Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when UserId is empty" { @@ -56,7 +56,7 @@ Describe "Get-EntraUserOAuth2PermissionGrant" { $result = Get-EntraUserOAuth2PermissionGrant -UserId "aaaaaaaa-bbbb-cccc-1111-222222222222" -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when All has an argument" { @@ -67,7 +67,7 @@ Describe "Get-EntraUserOAuth2PermissionGrant" { $result = Get-EntraUserOAuth2PermissionGrant -UserId "aaaaaaaa-bbbb-cccc-1111-222222222222" -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when top is empty" { @@ -95,7 +95,7 @@ Describe "Get-EntraUserOAuth2PermissionGrant" { $result | Should -Not -BeNullOrEmpty $result.ConsentType | Should -Be "Principal" - Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when Property is empty" { @@ -110,7 +110,7 @@ Describe "Get-EntraUserOAuth2PermissionGrant" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserOAuth2PermissionGrant" - Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgUserOAuth2PermissionGrant -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/Get-EntraUserOwnedDevice.Tests.ps1 b/testVNext/Entra/Users/Get-EntraUserOwnedDevice.Tests.ps1 index 6bd806222..d1e8150bd 100644 --- a/testVNext/Entra/Users/Get-EntraUserOwnedDevice.Tests.ps1 +++ b/testVNext/Entra/Users/Get-EntraUserOwnedDevice.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null){ + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -42,7 +42,7 @@ BeforeAll { } ) } - Mock -CommandName Get-MgUserOwnedDevice -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgUserOwnedDevice -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } Describe "Get-EntraUserOwnedDevice" { @@ -54,7 +54,7 @@ Context "Test for Get-EntraUserOwnedDevice" { $result.AdditionalProperties.deviceId | Should -Be "aaaaaaaa-3333-4444-5555-bbbbbbbbbbbb" $result.AdditionalProperties.displayName | Should -Be "Sawyer Miller" - Should -Invoke -CommandName Get-MgUserOwnedDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserOwnedDevice -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should get devices owned by a user with alias" { @@ -64,7 +64,7 @@ Context "Test for Get-EntraUserOwnedDevice" { $result.AdditionalProperties.deviceId | Should -Be "aaaaaaaa-3333-4444-5555-bbbbbbbbbbbb" $result.AdditionalProperties.displayName | Should -Be "Sawyer Miller" - Should -Invoke -CommandName Get-MgUserOwnedDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserOwnedDevice -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Property parameter should work" { @@ -85,7 +85,7 @@ Context "Test for Get-EntraUserOwnedDevice" { $result | Should -Not -BeNullOrEmpty $result.Id | Should -Contain "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" - Should -Invoke -CommandName Get-MgUserOwnedDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserOwnedDevice -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when All has an argument" { @@ -99,7 +99,7 @@ Context "Test for Get-EntraUserOwnedDevice" { $result.AdditionalProperties.deviceId | Should -Be "aaaaaaaa-3333-4444-5555-bbbbbbbbbbbb" $result.AdditionalProperties.displayName | Should -Be "Sawyer Miller" - Should -Invoke -CommandName Get-MgUserOwnedDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserOwnedDevice -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when Top is empty" { @@ -121,7 +121,7 @@ Context "Test for Get-EntraUserOwnedDevice" { $result = Get-EntraUserOwnedDevice -UserId "aaaaaaaa-1111-2222-3333-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserOwnedDevice" - Should -Invoke -CommandName Get-MgUserOwnedDevice -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgUserOwnedDevice -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/Get-EntraUserOwnedObject.Tests.ps1 b/testVNext/Entra/Users/Get-EntraUserOwnedObject.Tests.ps1 index 9682f3121..a9c806ffe 100644 --- a/testVNext/Entra/Users/Get-EntraUserOwnedObject.Tests.ps1 +++ b/testVNext/Entra/Users/Get-EntraUserOwnedObject.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Get-EntraUserOwnedObject with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -25,7 +25,7 @@ BeforeAll { } } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } Describe "Get-EntraUserOwnedObject" { @@ -42,7 +42,7 @@ Describe "Get-EntraUserOwnedObject" { $result.DisplayName | Should -Be "ToGraph_443DEM" - should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should return specific User with alias" { $result = Get-EntraUserOwnedObject -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" @@ -56,7 +56,7 @@ Describe "Get-EntraUserOwnedObject" { $result.DisplayName | Should -Be "ToGraph_443DEM" - should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when UserId is empty string value" { { Get-EntraUserOwnedObject -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." @@ -70,7 +70,7 @@ Describe "Get-EntraUserOwnedObject" { $result = Get-EntraUserOwnedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top 1 $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when top is empty" { @@ -84,7 +84,7 @@ Describe "Get-EntraUserOwnedObject" { It "Should return all contact" { $result = Get-EntraUserOwnedObject -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All $result | Should -Not -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when All has an argument" { @@ -105,7 +105,7 @@ Describe "Get-EntraUserOwnedObject" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserOwnedObject" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } @@ -116,7 +116,7 @@ Describe "Get-EntraUserOwnedObject" { $result | Should -Not -BeNullOrEmpty $result.displayName | Should -Be "ToGraph_443DEM" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when Property is empty" { diff --git a/testVNext/Entra/Users/Get-EntraUserRegisteredDevice.Tests.ps1 b/testVNext/Entra/Users/Get-EntraUserRegisteredDevice.Tests.ps1 index 26faa233c..21b3855d6 100644 --- a/testVNext/Entra/Users/Get-EntraUserRegisteredDevice.Tests.ps1 +++ b/testVNext/Entra/Users/Get-EntraUserRegisteredDevice.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null){ + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -29,7 +29,7 @@ BeforeAll { ) } - Mock -CommandName Get-MgUserRegisteredDevice -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Get-MgUserRegisteredDevice -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } Describe "Get-EntraUserRegisteredDevice" { @@ -41,7 +41,7 @@ Context "Test for Get-EntraUserRegisteredDevice" { $result.AdditionalProperties.deviceId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" $result.AdditionalProperties.displayName | Should -Be "Mock-App" - Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should return specific user registered device with alias" { $result = Get-EntraUserRegisteredDevice -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" @@ -50,7 +50,7 @@ Context "Test for Get-EntraUserRegisteredDevice" { $result.AdditionalProperties.deviceId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" $result.AdditionalProperties.displayName | Should -Be "Mock-App" - Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when ObjectlId is empty" { { Get-EntraUserRegisteredDevice -UserId } | Should -Throw "Missing an argument for parameter 'UserId'*" @@ -65,7 +65,7 @@ Context "Test for Get-EntraUserRegisteredDevice" { $result.AdditionalProperties.deviceId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" $result.AdditionalProperties.displayName | Should -Be "Mock-App" - Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when All is invalid" { { Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -All xyz } | Should -Throw "A positional parameter cannot be found that accepts argument 'xyz'.*" @@ -77,7 +77,7 @@ Context "Test for Get-EntraUserRegisteredDevice" { $result.AdditionalProperties.deviceId | Should -Be "00001111-aaaa-2222-bbbb-3333cccc4444" $result.AdditionalProperties.displayName | Should -Be "Mock-App" - Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when Top is empty" { { Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Top } | Should -Throw "Missing an argument for parameter 'Top'*" @@ -90,7 +90,7 @@ Context "Test for Get-EntraUserRegisteredDevice" { $result | Should -Not -BeNullOrEmpty $result.AdditionalProperties.displayName | Should -Be "Mock-App" - Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when Property is empty" { { Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -Property } | Should -Throw "Missing an argument for parameter 'Property'*" @@ -105,7 +105,7 @@ Context "Test for Get-EntraUserRegisteredDevice" { $result = Get-EntraUserRegisteredDevice -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Get-EntraUserRegisteredDevice" - Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Get-MgUserRegisteredDevice -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/Invalid.Tests.ps1 b/testVNext/Entra/Users/Invalid.Tests.ps1 index 6d5381a10..86b4e6e2a 100644 --- a/testVNext/Entra/Users/Invalid.Tests.ps1 +++ b/testVNext/Entra/Users/Invalid.Tests.ps1 @@ -1,17 +1,17 @@ -if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module Microsoft.Graph.Entra +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Users)){ + Import-Module Microsoft.Graph.Entra.Users } Describe "Invalid Tests"{ It "Should fail when parameters are invalid"{ - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Users $module.ExportedCommands.Keys | ForEach-Object{ $command = Get-Command $_ { Invoke-Command $command -demo "" } | Should -Throw "A parameter cannot be found that matches parameter name 'demo'." } } It "Should fail with 'TenantId' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Users $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'TenantId'){ @@ -21,7 +21,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Id' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Users $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Id'){ @@ -31,7 +31,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'ObjectId' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Users $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'ObjectId'){ @@ -41,7 +41,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'All' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Users $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'All'){ @@ -56,7 +56,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Top' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Users $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Top'){ @@ -66,7 +66,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'Filter' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Users $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'Filter'){ @@ -76,7 +76,7 @@ Describe "Invalid Tests"{ } } It "Should fail with 'SearchString' parameter" { - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Users $module.ExportedCommands.Keys | ForEach-Object { $command = Get-Command $_ if ($command.ParameterSets.Parameters.Name -contains 'SearchString'){ diff --git a/testVNext/Entra/Users/Module.Tests.ps1 b/testVNext/Entra/Users/Module.Tests.ps1 index cc40ad720..fdfd4009f 100644 --- a/testVNext/Entra/Users/Module.Tests.ps1 +++ b/testVNext/Entra/Users/Module.Tests.ps1 @@ -2,39 +2,39 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ -Describe "Microsoft.Graph.Entra Module" { +Describe "Microsoft.Graph.Entra.Users Module" { Context "On module import" { BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null){ + Import-Module Microsoft.Graph.Entra.Users } } It "Should have exported commands" { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Users $PSModuleInfo | Should -Not -BeNullOrEmpty $PSModuleInfo.ExportedFunctions.Count | Should -Not -Be 0 } It 'Should be compatible with PS core and desktop' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Users $PSModuleInfo.CompatiblePSEditions | Should -BeIn @("Core", "Desktop") } It 'Should point to script module' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra - $PSModuleInfo.RootModule | Should -BeLikeExactly "*Microsoft.Graph.Entra.psm1" + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Users + $PSModuleInfo.RootModule | Should -BeLikeExactly "*Microsoft.Graph.Entra.Users.psm1" } It 'Should lock GUID' { - $PSModuleInfo = Get-Module Microsoft.Graph.Entra + $PSModuleInfo = Get-Module Microsoft.Graph.Entra.Users $PSModuleInfo.Guid | Should -Be "742dccd1-bf4b-46a0-a3f2-14e0bb508233" } It "Module import should not write to error and information streams" { $ps = [powershell]::Create() - $ps.AddScript("Import-Module Microsoft.Graph.Entra -ErrorAction SilentlyContinue").Invoke() + $ps.AddScript("Import-Module Microsoft.Graph.Entra.Users -ErrorAction SilentlyContinue").Invoke() "Checking Information stream" | Out-Host $ps.Streams.Information.Count | Should -Be 0 "Checking Error stream" | Out-Host diff --git a/testVNext/Entra/Users/New-EntraUser.Tests.ps1 b/testVNext/Entra/Users/New-EntraUser.Tests.ps1 index 4962cdc17..73965333b 100644 --- a/testVNext/Entra/Users/New-EntraUser.Tests.ps1 +++ b/testVNext/Entra/Users/New-EntraUser.Tests.ps1 @@ -3,10 +3,10 @@ # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { @@ -50,7 +50,7 @@ BeforeAll { ) } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } Describe "New-EntraUser" { @@ -115,7 +115,7 @@ Describe "New-EntraUser" { $result.ImmutableId | Should -Be "1234567890" $result.Country | Should -Be "USA" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when parameters are empty" { @@ -131,7 +131,7 @@ Describe "New-EntraUser" { $result = New-EntraUser -DisplayName "demo002" -PasswordProfile $PasswordProfile -UserPrincipalName "demo001@M365x99297270.OnMicrosoft.com" -AccountEnabled $true -MailNickName "demo002NickName" -AgeGroup "adult" $result | Should -Not -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraUser" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/New-EntraUserAppRoleAssignment.Tests.ps1 b/testVNext/Entra/Users/New-EntraUserAppRoleAssignment.Tests.ps1 index 7374ca91b..11d35f157 100644 --- a/testVNext/Entra/Users/New-EntraUserAppRoleAssignment.Tests.ps1 +++ b/testVNext/Entra/Users/New-EntraUserAppRoleAssignment.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null){ + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { #Write-Host "Mocking New-EntraUserAppRoleAssignment with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -30,7 +30,7 @@ BeforeAll { ) } - Mock -CommandName New-MgUserAppRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgUserAppRoleAssignment -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } Describe "New-EntraUserAppRoleAssignment" { @@ -66,7 +66,7 @@ Describe "New-EntraUserAppRoleAssignment" { $result.ResourceDisplayName | Should -Be $expectedResult.ResourceDisplayName $result.ResourceId | Should -Be $expectedResult.ResourceId - Should -Invoke -CommandName New-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName New-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when parameters are empty" { @@ -78,7 +78,7 @@ Describe "New-EntraUserAppRoleAssignment" { } It "Should contain UserId in parameters" { - Mock -CommandName New-MgUserAppRoleAssignment -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName New-MgUserAppRoleAssignment -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Users $result = New-EntraUserAppRoleAssignment -ObjectId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb' -PrincipalId 'aaaaaaaa-bbbb-cccc-1111-222222222222' -ResourceId 'bbbbbbbb-cccc-dddd-2222-333333333333' -Id '00aa00aa-bb11-cc22-dd33-44ee44ee44ee' $params = Get-Parameters -data $result @@ -94,7 +94,7 @@ Describe "New-EntraUserAppRoleAssignment" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion New-EntraUserAppRoleAssignment" - Should -Invoke -CommandName New-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName New-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/Remove-EntraUser.Tests.ps1 b/testVNext/Entra/Users/Remove-EntraUser.Tests.ps1 index 4f631de16..2cf62af69 100644 --- a/testVNext/Entra/Users/Remove-EntraUser.Tests.ps1 +++ b/testVNext/Entra/Users/Remove-EntraUser.Tests.ps1 @@ -3,13 +3,13 @@ # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgUser -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgUser -MockWith {} -ModuleName Microsoft.Graph.Entra.Users } Describe "Remove-EntraUser" { @@ -17,12 +17,12 @@ Describe "Remove-EntraUser" { It "Should return empty object" { $result = Remove-EntraUser -UserId "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgUser -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgUser -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should execute successfully with Alias" { $result = Remove-EntraUser -ObjectId "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgUser -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgUser -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when UserId is empty string" { { Remove-EntraUser -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." @@ -31,7 +31,7 @@ Describe "Remove-EntraUser" { { Remove-EntraUser -UserId } | Should -Throw "Missing an argument for parameter*" } It "Should contain Id in parameters when passed UserId to it" { - Mock -CommandName Remove-MgUser -MockWith { $args } -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgUser -MockWith { $args } -ModuleName Microsoft.Graph.Entra.Users $result = Remove-EntraUser -UserId "aaaaaaaa-2222-3333-4444-bbbbbbbbbbbb" $params = Get-Parameters -data $result @@ -44,7 +44,7 @@ Describe "Remove-EntraUser" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraUser" - Should -Invoke -CommandName Remove-MgUser -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgUser -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/Remove-EntraUserAppRoleAssignment.Tests.ps1 b/testVNext/Entra/Users/Remove-EntraUserAppRoleAssignment.Tests.ps1 index fff29e20c..d69e00ee7 100644 --- a/testVNext/Entra/Users/Remove-EntraUserAppRoleAssignment.Tests.ps1 +++ b/testVNext/Entra/Users/Remove-EntraUserAppRoleAssignment.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null){ + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgUserAppRoleAssignment -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgUserAppRoleAssignment -MockWith {} -ModuleName Microsoft.Graph.Entra.Users } Describe "Remove-EntraUserAppRoleAssignment" { @@ -16,7 +16,7 @@ Describe "Remove-EntraUserAppRoleAssignment" { $result = Remove-EntraUserAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "33dd33dd-ee44-ff55-aa66-77bb77bb77bb" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when ObjectId is invalid" { @@ -36,7 +36,7 @@ Describe "Remove-EntraUserAppRoleAssignment" { } It "Should contain UserId in parameters" { - Mock -CommandName Remove-MgUserAppRoleAssignment -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgUserAppRoleAssignment -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Users $result = Remove-EntraUserAppRoleAssignment -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -AppRoleAssignmentId "33dd33dd-ee44-ff55-aa66-77bb77bb77bb" $params = Get-Parameters -data $result @@ -50,7 +50,7 @@ Describe "Remove-EntraUserAppRoleAssignment" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraUserAppRoleAssignment" - Should -Invoke -CommandName Remove-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgUserAppRoleAssignment -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/Remove-EntraUserManager.Tests.ps1 b/testVNext/Entra/Users/Remove-EntraUserManager.Tests.ps1 index 173778b47..390af4bcd 100644 --- a/testVNext/Entra/Users/Remove-EntraUserManager.Tests.ps1 +++ b/testVNext/Entra/Users/Remove-EntraUserManager.Tests.ps1 @@ -2,13 +2,13 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Remove-MgUserManagerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgUserManagerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Users } Describe "Remove-EntraUserManager" { @@ -16,12 +16,12 @@ Describe "Remove-EntraUserManager" { It "Should return empty object" { $result = Remove-EntraUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should return empty object with alias" { $result = Remove-EntraUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Remove-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Remove-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when UserId is empty string" { { Remove-EntraUserManager -UserId "" } | Should -Throw "Cannot bind argument to parameter 'UserId' because it is an empty string." @@ -30,7 +30,7 @@ Describe "Remove-EntraUserManager" { { Remove-EntraUserManager -UserId } | Should -Throw "Missing an argument for parameter*" } It "Should contain UserId in parameters when passed UserId to it" { - Mock -CommandName Remove-MgUserManagerByRef -MockWith { $args } -ModuleName Microsoft.Graph.Entra + Mock -CommandName Remove-MgUserManagerByRef -MockWith { $args } -ModuleName Microsoft.Graph.Entra.Users $result = Remove-EntraUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" $params = Get-Parameters -data $result @@ -45,7 +45,7 @@ Describe "Remove-EntraUserManager" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Remove-EntraUserManager" - Should -Invoke -CommandName Remove-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Remove-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/Set-EntraUser.Tests.ps1 b/testVNext/Entra/Users/Set-EntraUser.Tests.ps1 index 1dca943f4..7c6245d4d 100644 --- a/testVNext/Entra/Users/Set-EntraUser.Tests.ps1 +++ b/testVNext/Entra/Users/Set-EntraUser.Tests.ps1 @@ -3,12 +3,12 @@ # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Update-MgUser -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgUser -MockWith {} -ModuleName Microsoft.Graph.Entra.Users } Describe "Set-EntraUser" { @@ -17,7 +17,7 @@ Describe "Set-EntraUser" { $result = Set-EntraUser -UserId bbbbbbbb-1111-2222-3333-cccccccccccc -DisplayName "demo002" -UserPrincipalName "demo001@M365x99297270.OnMicrosoft.com" -AccountEnabled $true -MailNickName "demo002NickName" -AgeGroup "adult" -PostalCode "10001" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgUser -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgUser -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when UserId is empty" { @@ -29,7 +29,7 @@ Describe "Set-EntraUser" { } It "Should contain userId in parameters when passed UserId to it" { - Mock -CommandName Update-MgUser -MockWith { $args } -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgUser -MockWith { $args } -ModuleName Microsoft.Graph.Entra.Users $result = Set-EntraUser -UserId bbbbbbbb-1111-2222-3333-cccccccccccc -Mobile "1234567890" $params = Get-Parameters -data $result $params.userId | Should -Be "bbbbbbbb-1111-2222-3333-cccccccccccc" @@ -38,7 +38,7 @@ Describe "Set-EntraUser" { } It "Should contain MobilePhone in parameters when passed Mobile to it" { - Mock -CommandName Update-MgUser -MockWith { $args } -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgUser -MockWith { $args } -ModuleName Microsoft.Graph.Entra.Users $result = Set-EntraUser -UserId bbbbbbbb-1111-2222-3333-cccccccccccc -Mobile "1234567890" $params = Get-Parameters -data $result $params.MobilePhone | Should -Be "1234567890" @@ -51,7 +51,7 @@ Describe "Set-EntraUser" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraUser" - Should -Invoke -CommandName Update-MgUser -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgUser -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } @@ -70,7 +70,7 @@ Describe "Set-EntraUser" { } } It "Should contain ExternalUserState, OnPremisesImmutableId, ExternalUserStateChangeDateTime, BusinessPhones" { - Mock -CommandName Update-MgUser -MockWith { $args } -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgUser -MockWith { $args } -ModuleName Microsoft.Graph.Entra.Users # format like "yyyy-MM-dd HH:mm:ss" $userStateChangedOn = [System.DateTime]::Parse("2015-12-08 15:15:19") diff --git a/testVNext/Entra/Users/Set-EntraUserLicense.Tests.ps1 b/testVNext/Entra/Users/Set-EntraUserLicense.Tests.ps1 index 271e82685..7d92630d8 100644 --- a/testVNext/Entra/Users/Set-EntraUserLicense.Tests.ps1 +++ b/testVNext/Entra/Users/Set-EntraUserLicense.Tests.ps1 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Set-EntraUserLicense with parameters: $($args | ConvertTo-Json -Depth 3)" @@ -29,7 +29,7 @@ BeforeAll { } - Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith $scriptblock -ModuleName Microsoft.Graph.Entra.Users } Describe "Set-EntraUserLicense" { @@ -56,7 +56,7 @@ Describe "Set-EntraUserLicense" { $result.businessPhones | Should -Be @("8976546787") $result.surname | Should -Be "KTETSs" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when UserId is empty string value" { @@ -95,7 +95,7 @@ Describe "Set-EntraUserLicense" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraUserLicense" - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/Set-EntraUserManager.Tests.ps1 b/testVNext/Entra/Users/Set-EntraUserManager.Tests.ps1 index f1ad25418..5bd5a7b7a 100644 --- a/testVNext/Entra/Users/Set-EntraUserManager.Tests.ps1 +++ b/testVNext/Entra/Users/Set-EntraUserManager.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Set-MgUserManagerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Set-MgUserManagerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Users } Describe "Set-EntraUserManager" { @@ -16,14 +16,14 @@ Describe "Set-EntraUserManager" { $result = Set-EntraUserManager -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "00001111-aaaa-2222-bbbb-3333cccc4444" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Set-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Set-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should return specific User with alias" { $result = Set-EntraUserManager -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -RefObjectId "00001111-aaaa-2222-bbbb-3333cccc4444" $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Set-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Set-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when UserId is empty string value" { @@ -39,7 +39,7 @@ Describe "Set-EntraUserManager" { } It "Should contain UserId in parameters when passed UserId to it" { - Mock -CommandName Set-MgUserManagerByRef -MockWith { $args } -ModuleName Microsoft.Graph.Entra + Mock -CommandName Set-MgUserManagerByRef -MockWith { $args } -ModuleName Microsoft.Graph.Entra.Users $result = Set-EntraUserManager -UserId "00001111-aaaa-2222-bbbb-3333cccc4444" -RefObjectId "00001111-aaaa-2222-bbbb-3333cccc4444" $params = Get-Parameters -data $result @@ -53,7 +53,7 @@ Describe "Set-EntraUserManager" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraUserManager" - Should -Invoke -CommandName Set-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Set-MgUserManagerByRef -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/Set-EntraUserPassword.Tests.ps1 b/testVNext/Entra/Users/Set-EntraUserPassword.Tests.ps1 index 2ea830653..e3f259d7c 100644 --- a/testVNext/Entra/Users/Set-EntraUserPassword.Tests.ps1 +++ b/testVNext/Entra/Users/Set-EntraUserPassword.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra) -eq $null){ - Import-Module Microsoft.Graph.Entra + if((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null){ + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Update-MgUser -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgUser -MockWith {} -ModuleName Microsoft.Graph.Entra.Users } Describe "Set-EntraUserPassword" { @@ -19,7 +19,7 @@ Describe "Set-EntraUserPassword" { $result = Set-EntraUserPassword -UserId $userUPN -Password $secPassword -ForceChangePasswordNextLogin $true -EnforceChangePasswordPolicy $true $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Update-MgUser -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Update-MgUser -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when UserId is empty" { $userUPN="mock106@M365x99297270.OnMicrosoft.com" @@ -70,7 +70,7 @@ Describe "Set-EntraUserPassword" { { Set-EntraUserPassword -UserId $userUPN -Password $secPassword -EnforceChangePasswordPolicy xyz } | Should -Throw "Cannot process argument transformation on parameter 'EnforceChangePasswordPolicy'*" } It "Should contain ForceChangePasswordNextSignIn in parameters when passed ForceChangePasswordNextLogin to it" { - Mock -CommandName Update-MgUser -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgUser -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Users $userUPN="mock106@M365x99297270.OnMicrosoft.com" $newPassword="New@12345" @@ -80,7 +80,7 @@ Describe "Set-EntraUserPassword" { $params.PasswordProfile.ForceChangePasswordNextSignIn | Should -Be $true } It "Should contain ForceChangePasswordNextSignInWithMfa in parameters when passed EnforceChangePasswordPolicy to it" { - Mock -CommandName Update-MgUser -MockWith {$args} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Update-MgUser -MockWith {$args} -ModuleName Microsoft.Graph.Entra.Users $userUPN="mock106@M365x99297270.OnMicrosoft.com" $newPassword="New@12345" @@ -97,7 +97,7 @@ Describe "Set-EntraUserPassword" { $result = Set-EntraUserPassword -UserId $userUPN -Password $secPassword -ForceChangePasswordNextLogin $true -EnforceChangePasswordPolicy $true $result | Should -BeNullOrEmpty $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraUserPassword" - Should -Invoke -CommandName Update-MgUser -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Update-MgUser -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/Set-EntraUserThumbnailPhoto.Tests.ps1 b/testVNext/Entra/Users/Set-EntraUserThumbnailPhoto.Tests.ps1 index 76dc3cc66..0c69ce7dd 100644 --- a/testVNext/Entra/Users/Set-EntraUserThumbnailPhoto.Tests.ps1 +++ b/testVNext/Entra/Users/Set-EntraUserThumbnailPhoto.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll { - if ((Get-Module -Name Microsoft.Graph.Entra) -eq $null) { - Import-Module Microsoft.Graph.Entra + if ((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null) { + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force - Mock -CommandName Set-MgUserPhotoContent -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Set-MgUserPhotoContent -MockWith {} -ModuleName Microsoft.Graph.Entra.Users } Describe "Set-EntraUserThumbnailPhoto" { @@ -16,14 +16,14 @@ Describe "Set-EntraUserThumbnailPhoto" { $result = Set-EntraUserThumbnailPhoto -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -FilePath 'D:\UserThumbnailPhoto.jpg' $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Set-MgUserPhotoContent -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Set-MgUserPhotoContent -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should return specific User with alias" { $result = Set-EntraUserThumbnailPhoto -ObjectId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -FilePath 'D:\UserThumbnailPhoto.jpg' $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Set-MgUserPhotoContent -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Set-MgUserPhotoContent -ModuleName Microsoft.Graph.Entra.Users -Times 1 } It "Should fail when UserId is empty string value" { @@ -39,7 +39,7 @@ Describe "Set-EntraUserThumbnailPhoto" { } It "Should contain UserId in parameters when passed ObjectId to it" { - Mock -CommandName Set-MgUserPhotoContent -MockWith { $args } -ModuleName Microsoft.Graph.Entra + Mock -CommandName Set-MgUserPhotoContent -MockWith { $args } -ModuleName Microsoft.Graph.Entra.Users $result = Set-EntraUserThumbnailPhoto -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -FilePath 'D:\UserThumbnailPhoto.jpg' $params = Get-Parameters -data $result @@ -47,7 +47,7 @@ Describe "Set-EntraUserThumbnailPhoto" { } It "Should contain InFile in parameters" { - Mock -CommandName Set-MgUserPhotoContent -MockWith { $args } -ModuleName Microsoft.Graph.Entra + Mock -CommandName Set-MgUserPhotoContent -MockWith { $args } -ModuleName Microsoft.Graph.Entra.Users $result = Set-EntraUserThumbnailPhoto -UserId "aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb" -FilePath 'D:\UserThumbnailPhoto.jpg' $params = Get-Parameters -data $result @@ -61,7 +61,7 @@ Describe "Set-EntraUserThumbnailPhoto" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Set-EntraUserThumbnailPhoto" - Should -Invoke -CommandName Set-MgUserPhotoContent -ModuleName Microsoft.Graph.Entra -Times 1 -ParameterFilter { + Should -Invoke -CommandName Set-MgUserPhotoContent -ModuleName Microsoft.Graph.Entra.Users -Times 1 -ParameterFilter { $Headers.'User-Agent' | Should -Be $userAgentHeaderValue $true } diff --git a/testVNext/Entra/Users/Update-EntraSignedInUserPassword.Tests.ps1 b/testVNext/Entra/Users/Update-EntraSignedInUserPassword.Tests.ps1 index 963337354..f1d049527 100644 --- a/testVNext/Entra/Users/Update-EntraSignedInUserPassword.Tests.ps1 +++ b/testVNext/Entra/Users/Update-EntraSignedInUserPassword.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll{ if((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Users diff --git a/testVNext/Entra/Users/Update-EntraUserFromFederated.Tests.ps1 b/testVNext/Entra/Users/Update-EntraUserFromFederated.Tests.ps1 index 8984a6909..20e8a811b 100644 --- a/testVNext/Entra/Users/Update-EntraUserFromFederated.Tests.ps1 +++ b/testVNext/Entra/Users/Update-EntraUserFromFederated.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblockForAuthenticationMethod = { return @( [PSCustomObject]@{ diff --git a/testVNext/Entra/Users/Valid.Tests.ps1 b/testVNext/Entra/Users/Valid.Tests.ps1 index 5013e8327..f396e5762 100644 --- a/testVNext/Entra/Users/Valid.Tests.ps1 +++ b/testVNext/Entra/Users/Valid.Tests.ps1 @@ -2,12 +2,12 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ BeforeAll{ - if($null -eq (Get-Module -Name Microsoft.Graph.Entra)){ - Import-Module Microsoft.Graph.Entra + if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Users)){ + Import-Module Microsoft.Graph.Entra.Users } - Import-Module (Join-Path $psscriptroot ".\EntraCmdletsMap.ps1") -Force + Import-Module (Join-Path $psscriptroot "..\EntraCmdletsMap.ps1") -Force - $module = Get-Module -Name Microsoft.Graph.Entra + $module = Get-Module -Name Microsoft.Graph.Entra.Users } Describe "Valid parameter Tests"{ @@ -20,23 +20,23 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | Select-Object -expand Name) - if($params.count -eq 1 -and $params -eq 'Id'){ + if(($params -eq 'Id') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'Id')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { Write-Host "$command" $commandScriptBlock = [scriptblock]::Create("$commandName -Id 056b2531-005e-4f3e-be78-01a71ea30a04") if($filter.IsApi){ - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Users $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } else { - Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra.Users $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra.Users -Times 1 } } catch { @@ -58,23 +58,23 @@ Describe "Valid parameter Tests"{ $command = Get-Command $_ if($command.Name.StartsWith('Remove')){ $params = ($command.ParameterSets.Parameters | Where-Object {$_.IsMandatory -eq $true} | select -expand Name) - if($params.count -eq 1 -and $params -eq 'ObjectId'){ + if(($params -eq 'ObjectId') -or ($params -is [array] -and $params.count -eq 1 -and $params -eq 'ObjectId')){ $filter = $cmdlets | Where-Object { $_.SourceName -eq $command } if($null -ne $filter){ try { Write-Host "$command" $commandScriptBlock = [scriptblock]::Create("$commandName -ObjectId 056b2531-005e-4f3e-be78-01a71ea30a04") if($filter.IsApi){ - Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Users $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName Invoke-GraphRequest -ModuleName Microsoft.Graph.Entra.Users -Times 1 } else { - Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra + Mock -CommandName $filter.TargetName -MockWith {} -ModuleName Microsoft.Graph.Entra.Users $result = Invoke-Command -ScriptBlock $commandScriptBlock $result | Should -BeNullOrEmpty - Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra -Times 1 + Should -Invoke -CommandName $filter.TargetName -ModuleName Microsoft.Graph.Entra.Users -Times 1 } } catch { diff --git a/testVNext/EntraBeta/Applications/Add-EntraBetaApplicationPolicy.Tests.ps1 b/testVNext/EntraBeta/Applications/Add-EntraBetaApplicationPolicy.Tests.ps1 index c9442bfa7..3eeea0f48 100644 --- a/testVNext/EntraBeta/Applications/Add-EntraBetaApplicationPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Add-EntraBetaApplicationPolicy.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Applications diff --git a/testVNext/EntraBeta/Applications/Get-EntraBetaApplication.Tests.ps1 b/testVNext/EntraBeta/Applications/Get-EntraBetaApplication.Tests.ps1 index f77955fbe..d1b50f31f 100644 --- a/testVNext/EntraBeta/Applications/Get-EntraBetaApplication.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Get-EntraBetaApplication.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Get-MgBetaApplication with parameters: $($args | ConvertTo-Json -Depth 3)" diff --git a/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationLogo.Tests.ps1 b/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationLogo.Tests.ps1 index 4f148933b..3e0518063 100644 --- a/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationLogo.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationLogo.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { @{ diff --git a/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationPasswordCredential.Tests.ps1 b/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationPasswordCredential.Tests.ps1 index 70e148c70..6948b2f0d 100644 --- a/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationPasswordCredential.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationPasswordCredential.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null) { Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationPolicy.Tests.ps1 b/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationPolicy.Tests.ps1 index e29e67e24..32640a785 100644 --- a/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationPolicy.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { diff --git a/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationTemplate.Tests.ps1 b/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationTemplate.Tests.ps1 index 9b43506dc..1ebf8411a 100644 --- a/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationTemplate.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Get-EntraBetaApplicationTemplate.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Applications/Get-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 b/testVNext/EntraBeta/Applications/Get-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 index c02cd441b..1a7340a58 100644 --- a/testVNext/EntraBeta/Applications/Get-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Get-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Applications/Get-EntraBetaServicePrincipal.Tests.ps1 b/testVNext/EntraBeta/Applications/Get-EntraBetaServicePrincipal.Tests.ps1 index bdc6c2030..d4dc7d7f1 100644 --- a/testVNext/EntraBeta/Applications/Get-EntraBetaServicePrincipal.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Get-EntraBetaServicePrincipal.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Applications/Get-EntraBetaServicePrincipalOwnedObject.Tests.ps1 b/testVNext/EntraBeta/Applications/Get-EntraBetaServicePrincipalOwnedObject.Tests.ps1 index c4ab31f5a..d3c8905ad 100644 --- a/testVNext/EntraBeta/Applications/Get-EntraBetaServicePrincipalOwnedObject.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Get-EntraBetaServicePrincipalOwnedObject.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @{ diff --git a/testVNext/EntraBeta/Applications/New-EntraBetaApplication.Tests.ps1 b/testVNext/EntraBeta/Applications/New-EntraBetaApplication.Tests.ps1 index b4af29b26..d36a1c16f 100644 --- a/testVNext/EntraBeta/Applications/New-EntraBetaApplication.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/New-EntraBetaApplication.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking New-MgBetaApplication with parameters: $($args | ConvertTo-Json -Depth 3)" diff --git a/testVNext/EntraBeta/Applications/New-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 b/testVNext/EntraBeta/Applications/New-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 index bbc6eeae6..47fdb0e38 100644 --- a/testVNext/EntraBeta/Applications/New-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/New-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Applications/Remove-EntraBetaApplication.Tests.ps1 b/testVNext/EntraBeta/Applications/Remove-EntraBetaApplication.Tests.ps1 index 0d35d74be..13a1faf2e 100644 --- a/testVNext/EntraBeta/Applications/Remove-EntraBetaApplication.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Remove-EntraBetaApplication.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaApplication -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Applications } diff --git a/testVNext/EntraBeta/Applications/Remove-EntraBetaApplicationPolicy.Tests.ps1 b/testVNext/EntraBeta/Applications/Remove-EntraBetaApplicationPolicy.Tests.ps1 index 8781f249e..d83d815cc 100644 --- a/testVNext/EntraBeta/Applications/Remove-EntraBetaApplicationPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Remove-EntraBetaApplicationPolicy.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Applications } diff --git a/testVNext/EntraBeta/Applications/Remove-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 b/testVNext/EntraBeta/Applications/Remove-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 index a92248783..519fd5fb5 100644 --- a/testVNext/EntraBeta/Applications/Remove-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Remove-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaServicePrincipalPasswordSingleSignOnCredential -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Applications } diff --git a/testVNext/EntraBeta/Applications/Set-EntraBetaApplication.Tests.ps1 b/testVNext/EntraBeta/Applications/Set-EntraBetaApplication.Tests.ps1 index 35dd6b6cf..869025515 100644 --- a/testVNext/EntraBeta/Applications/Set-EntraBetaApplication.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Set-EntraBetaApplication.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Update-MgBetaApplication -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Applications } diff --git a/testVNext/EntraBeta/Applications/Set-EntraBetaApplicationLogo.Tests.ps1 b/testVNext/EntraBeta/Applications/Set-EntraBetaApplicationLogo.Tests.ps1 index bad04d3bf..88cef370e 100644 --- a/testVNext/EntraBeta/Applications/Set-EntraBetaApplicationLogo.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Set-EntraBetaApplicationLogo.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Applications } diff --git a/testVNext/EntraBeta/Applications/Set-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 b/testVNext/EntraBeta/Applications/Set-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 index fa408cca1..011a30e32 100644 --- a/testVNext/EntraBeta/Applications/Set-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Set-EntraBetaPasswordSingleSignOnCredential.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Update-MgBetaServicePrincipalPasswordSingleSignOnCredential -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Applications } diff --git a/testVNext/EntraBeta/Applications/Set-EntraBetaServicePrincipal.Tests.ps1 b/testVNext/EntraBeta/Applications/Set-EntraBetaServicePrincipal.Tests.ps1 index 523f289ea..f9e18078e 100644 --- a/testVNext/EntraBeta/Applications/Set-EntraBetaServicePrincipal.Tests.ps1 +++ b/testVNext/EntraBeta/Applications/Set-EntraBetaServicePrincipal.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Applications) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Applications } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Applications } diff --git a/testVNext/EntraBeta/Authentication/Reset-EntraBetaStrongAuthenticationMethodByUpn.Tests.ps1 b/testVNext/EntraBeta/Authentication/Reset-EntraBetaStrongAuthenticationMethodByUpn.Tests.ps1 index 2f3860c88..a31127e3f 100644 --- a/testVNext/EntraBeta/Authentication/Reset-EntraBetaStrongAuthenticationMethodByUpn.Tests.ps1 +++ b/testVNext/EntraBeta/Authentication/Reset-EntraBetaStrongAuthenticationMethodByUpn.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Authentication) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Authentication } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( [PSCustomObject]@{ diff --git a/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaAdministrativeUnitMember.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaAdministrativeUnitMember.Tests.ps1 index a184441f4..eb22b02d7 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaAdministrativeUnitMember.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaAdministrativeUnitMember.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName New-MgBetaAdministrativeUnitMemberByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement diff --git a/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 index c60190c54..d0603e66b 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaDeviceRegisteredOwner.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaDeviceRegisteredOwner.Tests.ps1 index e8acda9bc..9c0de190c 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaDeviceRegisteredOwner.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaDeviceRegisteredOwner.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName New-MgBetaDeviceRegisteredOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement } diff --git a/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaDeviceRegisteredUser.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaDeviceRegisteredUser.Tests.ps1 index ec45b2449..284c6aae9 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaDeviceRegisteredUser.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaDeviceRegisteredUser.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName New-MgBetaDeviceRegisteredUserByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement } diff --git a/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaScopedRoleMembership.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaScopedRoleMembership.Tests.ps1 index 81ebc7f32..d54b41bc4 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaScopedRoleMembership.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Add-EntraBetaScopedRoleMembership.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( @@ -31,8 +31,8 @@ BeforeAll { Describe "Add-EntraBetaScopedRoleMembership" { Context "Test for Add-EntraBetaScopedRoleMembership" { It "Should add a user to the specified role within the specified administrative unit" { - $RoleMember = New-Object -TypeName Microsoft.Open.AzureAD.Model.RoleMemberInfo - $RoleMember.ObjectId = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" + $RoleMember = New-Object -TypeName Microsoft.Open.MSGraph.Model.MsRoleMemberInfo + $RoleMember.Id = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" $result = Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -RoleMemberInfo $RoleMember $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "zTVcE8KFQ0W4bI9tvt6kz-5AOA62QHJLgnvAbh9Z0r7uQTWi6U_yTLYoEC66749-U" @@ -42,8 +42,8 @@ Describe "Add-EntraBetaScopedRoleMembership" { Should -Invoke -CommandName New-MgBetaDirectoryAdministrativeUnitScopedRoleMember -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement -Times 1 } It "Should add a user to the specified role within the specified administrative unit with alias" { - $RoleMember = New-Object -TypeName Microsoft.Open.AzureAD.Model.RoleMemberInfo - $RoleMember.ObjectId = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" + $RoleMember = New-Object -TypeName Microsoft.Open.MSGraph.Model.MsRoleMemberInfo + $RoleMember.Id = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" $result = Add-EntraBetaScopedRoleMembership -ObjectId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -RoleMemberInfo $RoleMember $result | Should -Not -BeNullOrEmpty $result.Id | Should -Be "zTVcE8KFQ0W4bI9tvt6kz-5AOA62QHJLgnvAbh9Z0r7uQTWi6U_yTLYoEC66749-U" @@ -71,8 +71,8 @@ Describe "Add-EntraBetaScopedRoleMembership" { { Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleMemberInfo "" } | Should -Throw "Cannot process argument transformation on parameter 'RoleMemberInfo'*" } It "Result should contain Alias properties"{ - $RoleMember = New-Object -TypeName Microsoft.Open.AzureAD.Model.RoleMemberInfo - $RoleMember.ObjectId = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" + $RoleMember = New-Object -TypeName Microsoft.Open.MSGraph.Model.MsRoleMemberInfo + $RoleMember.Id = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" $result = Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -RoleMemberInfo $RoleMember $result.ObjectId | should -Be "zTVcE8KFQ0W4bI9tvt6kz-5AOA62QHJLgnvAbh9Z0r7uQTWi6U_yTLYoEC66749-U" $result.RoleObjectId | should -Be "cccccccc-85c2-4543-b86c-cccccccccccc" @@ -91,8 +91,8 @@ Describe "Add-EntraBetaScopedRoleMembership" { $params.AdministrativeUnitId1 | Should -Be "0e3840ee-40b6-4b72-827b-c06e1f59d2be" } It "Should contain RoleId in parameters when passed RoleObjectId to it" { - $RoleMember = New-Object -TypeName Microsoft.Open.AzureAD.Model.RoleMemberInfo - $RoleMember.ObjectId = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" + $RoleMember = New-Object -TypeName Microsoft.Open.MSGraph.Model.MsRoleMemberInfo + $RoleMember.Id = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" $result = Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -RoleMemberInfo $RoleMember $params = Get-Parameters -data $result.Parameters @@ -101,8 +101,8 @@ Describe "Add-EntraBetaScopedRoleMembership" { It "Should contain 'User-Agent' header" { $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraBetaScopedRoleMembership" $userAgentHeaderValue = "PowerShell/$psVersion EntraPowershell/$entraVersion Add-EntraBetaScopedRoleMembership" - $RoleMember = New-Object -TypeName Microsoft.Open.AzureAD.Model.RoleMemberInfo - $RoleMember.ObjectId = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" + $RoleMember = New-Object -TypeName Microsoft.Open.MSGraph.Model.MsRoleMemberInfo + $RoleMember.Id = "a23541ee-4fe9-4cf2-b628-102ebaef8f7e" Add-EntraBetaScopedRoleMembership -AdministrativeUnitId "0e3840ee-40b6-4b72-827b-c06e1f59d2be" -RoleObjectId "135c35cd-85c2-4543-b86c-8f6dbedea4cf" -RoleMemberInfo $RoleMember diff --git a/testVNext/EntraBeta/DirectoryManagement/Confirm-EntraBetaDomain.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Confirm-EntraBetaDomain.Tests.ps1 index 832778834..02caea174 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Confirm-EntraBetaDomain.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Confirm-EntraBetaDomain.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAccountSku.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAccountSku.Tests.ps1 index 6fb729088..b83bb5676 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAccountSku.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAccountSku.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAdministrativeUnit.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAdministrativeUnit.Tests.ps1 index 6be278a78..a3afdbcaa 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAdministrativeUnit.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAdministrativeUnit.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAdministrativeUnitMember.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAdministrativeUnitMember.Tests.ps1 index 3a5fb08f7..0af73b9bb 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAdministrativeUnitMember.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAdministrativeUnitMember.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAttributeSet.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAttributeSet.Tests.ps1 index 5e6c632b1..a50f96b2e 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAttributeSet.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaAttributeSet.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaCustomSecurityAttributeDefinition.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaCustomSecurityAttributeDefinition.Tests.ps1 index 0f52650f6..5d2521244 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaCustomSecurityAttributeDefinition.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaCustomSecurityAttributeDefinition.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 index 8e2e8077d..5ba897a74 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDevice.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDevice.Tests.ps1 index 1bf5c7468..b54a32494 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDevice.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDevice.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDeviceRegisteredOwner.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDeviceRegisteredOwner.Tests.ps1 index ba0a3e623..a679a6cc4 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDeviceRegisteredOwner.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDeviceRegisteredOwner.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null) { Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @{ diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDeviceRegisteredUser.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDeviceRegisteredUser.Tests.ps1 index 773c09c42..f5aeda00f 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDeviceRegisteredUser.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDeviceRegisteredUser.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null) { Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirSyncConfiguration.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirSyncConfiguration.Tests.ps1 index 26084ca3d..83080e7d6 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirSyncConfiguration.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirSyncConfiguration.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @{ configuration = [PSCustomObject]@{ diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirSyncFeature.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirSyncFeature.Tests.ps1 index 0739a1c03..a9a1ad930 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirSyncFeature.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirSyncFeature.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirectoryObjectOnPremisesProvisioningError.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirectoryObjectOnPremisesProvisioningError.Tests.ps1 index edbe610dc..f8b2a5ff4 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirectoryObjectOnPremisesProvisioningError.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirectoryObjectOnPremisesProvisioningError.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement } diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirectorySetting.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirectorySetting.Tests.ps1 index a3ee8379f..4b5ba79b9 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirectorySetting.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirectorySetting.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirectorySettingTemplate.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirectorySettingTemplate.Tests.ps1 index b4e792feb..0ec2c2067 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirectorySettingTemplate.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDirectorySettingTemplate.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDomainFederationSettings.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDomainFederationSettings.Tests.ps1 index 4a34ef2a3..4afa3025f 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDomainFederationSettings.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaDomainFederationSettings.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaFederationProperty.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaFederationProperty.Tests.ps1 index d7f044537..31e48c281 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaFederationProperty.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaFederationProperty.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaPasswordPolicy.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaPasswordPolicy.Tests.ps1 index 8fa04c63e..7379f832c 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaPasswordPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaPasswordPolicy.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaScopedRoleMembership.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaScopedRoleMembership.Tests.ps1 index bb8cb15ec..3a89ac45b 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaScopedRoleMembership.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Get-EntraBetaScopedRoleMembership.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaAdministrativeUnit.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaAdministrativeUnit.Tests.ps1 index 850611b97..a74da8f0d 100644 --- a/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaAdministrativeUnit.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaAdministrativeUnit.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaAdministrativeUnitMember.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaAdministrativeUnitMember.Tests.ps1 index 0e589085c..830edd06d 100644 --- a/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaAdministrativeUnitMember.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaAdministrativeUnitMember.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaAttributeSet.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaAttributeSet.Tests.ps1 index e0d30c3f6..3e7e9db76 100644 --- a/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaAttributeSet.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaAttributeSet.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaCustomSecurityAttributeDefinition.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaCustomSecurityAttributeDefinition.Tests.ps1 index a753027de..a4145e911 100644 --- a/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaCustomSecurityAttributeDefinition.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaCustomSecurityAttributeDefinition.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaDirectorySetting.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaDirectorySetting.Tests.ps1 index 11922d047..96aa0016a 100644 --- a/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaDirectorySetting.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/New-EntraBetaDirectorySetting.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaAdministrativeUnit.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaAdministrativeUnit.Tests.ps1 index 0eeddc1c2..849dd34b8 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaAdministrativeUnit.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaAdministrativeUnit.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaAdministrativeUnit -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement diff --git a/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaAdministrativeUnitMember.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaAdministrativeUnitMember.Tests.ps1 index c33adb472..001a22f64 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaAdministrativeUnitMember.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaAdministrativeUnitMember.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaDirectoryAdministrativeUnitMemberByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement diff --git a/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDevice.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDevice.Tests.ps1 index 5f35d47e4..5eff0971a 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDevice.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDevice.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaDevice -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement } diff --git a/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDeviceRegisteredOwner.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDeviceRegisteredOwner.Tests.ps1 index 0c8b3f007..4552ae175 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDeviceRegisteredOwner.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDeviceRegisteredOwner.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module .\test\module\Common-Functions.ps1 -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaDeviceRegisteredOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement } diff --git a/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDeviceRegisteredUser.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDeviceRegisteredUser.Tests.ps1 index 8ca3b5897..e9d21155a 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDeviceRegisteredUser.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDeviceRegisteredUser.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module .\test\module\Common-Functions.ps1 -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaDeviceRegisteredUserByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement } diff --git a/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDirectorySetting.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDirectorySetting.Tests.ps1 index 304226c30..44cbee9ba 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDirectorySetting.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaDirectorySetting.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaDirectorySetting -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement } diff --git a/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaScopedRoleMembership.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaScopedRoleMembership.Tests.ps1 index f8f118eb4..9d0b5721f 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaScopedRoleMembership.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Remove-EntraBetaScopedRoleMembership.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaDirectoryAdministrativeUnitScopedRoleMember -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement diff --git a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaAdministrativeUnit.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaAdministrativeUnit.Tests.ps1 index f95918b11..c085c1376 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaAdministrativeUnit.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaAdministrativeUnit.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Update-MgBetaAdministrativeUnit -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement diff --git a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaAttributeSet.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaAttributeSet.Tests.ps1 index d303ad1e9..4f7a96dc2 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaAttributeSet.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaAttributeSet.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Update-MgBetaDirectoryAttributeSet -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement } diff --git a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaCustomSecurityAttributeDefinition.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaCustomSecurityAttributeDefinition.Tests.ps1 index 43481545d..b0de1ebe1 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaCustomSecurityAttributeDefinition.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaCustomSecurityAttributeDefinition.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Update-MgBetaDirectoryCustomSecurityAttributeDefinition -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement } diff --git a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 index 444c82597..37202db2a 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaCustomSecurityAttributeDefinitionAllowedValue.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Update-MgBetaDirectoryCustomSecurityAttributeDefinitionAllowedValue -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement } diff --git a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDevice.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDevice.Tests.ps1 index 3cb14283f..17b7b8b97 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDevice.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDevice.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Update-MgBetaDevice -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement } diff --git a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirSyncConfiguration.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirSyncConfiguration.Tests.ps1 index 2f1237674..68ab5a687 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirSyncConfiguration.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirSyncConfiguration.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( [PSCustomObject]@{ diff --git a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirSyncEnabled.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirSyncEnabled.Tests.ps1 index 016c06068..ce8e8fb16 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirSyncEnabled.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirSyncEnabled.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( [PSCustomObject]@{ diff --git a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirSyncFeature.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirSyncFeature.Tests.ps1 index 953213b34..48bf466fe 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirSyncFeature.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirSyncFeature.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( [PSCustomObject]@{ diff --git a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirectorySetting.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirectorySetting.Tests.ps1 index ba3835f60..1cf50c7b3 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirectorySetting.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDirectorySetting.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDomainFederationSettings.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDomainFederationSettings.Tests.ps1 index 4dbe1f036..256e7834e 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDomainFederationSettings.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaDomainFederationSettings.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( [PSCustomObject]@{ diff --git a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaPartnerInformation.Tests.ps1 b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaPartnerInformation.Tests.ps1 index 8b2c6005c..ab6d3f52d 100644 --- a/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaPartnerInformation.Tests.ps1 +++ b/testVNext/EntraBeta/DirectoryManagement/Set-EntraBetaPartnerInformation.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-MgGraphRequest -ModuleName Microsoft.Graph.Entra.Beta.DirectoryManagement -MockWith { return @{ diff --git a/testVNext/EntraBeta/EntraBeta.Tests.ps1 b/testVNext/EntraBeta/EntraBeta.Tests.ps1 index 1f1342c75..ec17be3e8 100644 --- a/testVNext/EntraBeta/EntraBeta.Tests.ps1 +++ b/testVNext/EntraBeta/EntraBeta.Tests.ps1 @@ -2,15 +2,37 @@ # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. # ------------------------------------------------------------------------------ -if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Beta)){ - Import-Module Microsoft.Graph.Entra.Beta +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Beta.Authentication)){ + Import-Module Microsoft.Graph.Entra.Beta.Authentication -Force +} +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Beta.Applications)){ + Import-Module Microsoft.Graph.Entra.Beta.Applications -Force +} +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement)){ + Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement -Force +} +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Beta.Governance)){ + Import-Module Microsoft.Graph.Entra.Beta.Governance -Force +} +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Beta.Users)){ + Import-Module Microsoft.Graph.Entra.Beta.Users -Force +} +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Beta.Groups)){ + Import-Module Microsoft.Graph.Entra.Beta.Groups -Force +} +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Beta.Reports)){ + Import-Module Microsoft.Graph.Entra.Beta.Reports -Force +} +if($null -eq (Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns)){ + Import-Module Microsoft.Graph.Entra.Beta.SignIns -Force } Import-Module Pester -$psmPath = (Get-Module Microsoft.Graph.Entra.Beta).Path -$testReportPath = join-path $psscriptroot "..\..\..\TestReport\EntraBeta" -$mockScriptsPath = join-path $psscriptroot "..\..\..\test\module\EntraBeta\*.Tests.ps1" +#$psmPath = (Get-Module Microsoft.Graph.Entra.Beta).Path +$ps1FilesPath = join-path $psscriptroot "..\..\moduleVNext\EntraBeta\Microsoft.Graph.Entra" +$testReportPath = join-path $psscriptroot "..\..\TestReport\EntraBeta" +$mockScriptsPath = join-path $psscriptroot "..\..\testVNext\EntraBeta\*\*.Tests.ps1" $testOutputFile = "$testReportPath\TestResults.xml" if (!(test-path -path $testReportPath)) {new-item -path $testReportPath -itemtype directory} @@ -23,7 +45,8 @@ $config.Run.PassThru = $true $config.Run.Exit = $true $config.CodeCoverage.Enabled = $false $config.CodeCoverage.CoveragePercentTarget = 100 -$config.CodeCoverage.Path = $psmPath +# $config.CodeCoverage.Path = $psmPath +$config.CodeCoverage.Path = $ps1FilesPath $config.TestResult.Enabled = $true $config.TestResult.OutputPath = $testOutputFile $config.Output.Verbosity = "Detailed" diff --git a/testVNext/EntraBeta/General.Tests.ps1 b/testVNext/EntraBeta/General.Tests.ps1 index 2b618a955..c9e1aaba5 100644 --- a/testVNext/EntraBeta/General.Tests.ps1 +++ b/testVNext/EntraBeta/General.Tests.ps1 @@ -1,40 +1,40 @@ -# ------------------------------------------------------------------------------ -# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. -# ------------------------------------------------------------------------------ +# # ------------------------------------------------------------------------------ +# # Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# # ------------------------------------------------------------------------------ -BeforeAll { - if((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null){ - Import-Module Microsoft.Graph.Entra.Beta - } -} +# BeforeAll { +# if((Get-Module -Name Microsoft.Graph.Entra.Beta) -eq $null){ +# Import-Module Microsoft.Graph.Entra.Beta +# } +# } -Describe 'PowerShell Version Check' { - It 'Version 5.1 or Greater' { - $semanticVersion = $PSVersionTable.PSVersion - $version = $semanticVersion.Major + ($semanticVersion.Minor * 0.1) - $version | Should -BeGreaterOrEqual 5.1 - } -} +# Describe 'PowerShell Version Check' { +# It 'Version 5.1 or Greater' { +# $semanticVersion = $PSVersionTable.PSVersion +# $version = $semanticVersion.Major + ($semanticVersion.Minor * 0.1) +# $version | Should -BeGreaterOrEqual 5.1 +# } +# } -Describe 'Module checks' { - It 'Module imported' { - $module = Get-Module -Name Microsoft.Graph.Entra.Beta - $module | Should -Not -Be $null - } +# Describe 'Module checks' { +# It 'Module imported' { +# $module = Get-Module -Name Microsoft.Graph.Entra.Beta +# $module | Should -Not -Be $null +# } - It 'Have more that zero exported functions' { - $module = Get-Module -Name Microsoft.Graph.Entra.Beta - $module.ExportedCommands.Keys.Count | Should -BeGreaterThan 0 - } +# It 'Have more that zero exported functions' { +# $module = Get-Module -Name Microsoft.Graph.Entra.Beta +# $module.ExportedCommands.Keys.Count | Should -BeGreaterThan 0 +# } - # It 'Known number translated commands' { - # $module = Get-Module -Name Microsoft.Graph.Entra.Beta - # $module.ExportedCommands.Keys.Count | Should -Be 293 - # } +# It 'Known number translated commands' { +# $module = Get-Module -Name Microsoft.Graph.Entra.Beta +# $module.ExportedCommands.Keys.Count | Should -Be 293 +# } - It 'Running a simple command Enable-EntraAzureADAlias'{ - Enable-EntraAzureADAlias - $Alias = Get-Alias -Name Get-AzureADUser - $Alias | Should -Not -Be $null - } -} +# It 'Running a simple command Enable-EntraAzureADAlias'{ +# Enable-EntraAzureADAlias +# $Alias = Get-Alias -Name Get-AzureADUser +# $Alias | Should -Not -Be $null +# } +# } diff --git a/testVNext/EntraBeta/Governance/Get-EntraBetaPrivilegedResource.Tests.ps1 b/testVNext/EntraBeta/Governance/Get-EntraBetaPrivilegedResource.Tests.ps1 index 289b60554..b9b8c3883 100644 --- a/testVNext/EntraBeta/Governance/Get-EntraBetaPrivilegedResource.Tests.ps1 +++ b/testVNext/EntraBeta/Governance/Get-EntraBetaPrivilegedResource.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Governance) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Governance } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Governance/Get-EntraBetaPrivilegedRoleDefinition.Tests.ps1 b/testVNext/EntraBeta/Governance/Get-EntraBetaPrivilegedRoleDefinition.Tests.ps1 index c2dfc6a6e..f7e1d0f4b 100644 --- a/testVNext/EntraBeta/Governance/Get-EntraBetaPrivilegedRoleDefinition.Tests.ps1 +++ b/testVNext/EntraBeta/Governance/Get-EntraBetaPrivilegedRoleDefinition.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Governance) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Governance } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Governance/Get-EntraBetaPrivilegedRoleSetting.Tests.ps1 b/testVNext/EntraBeta/Governance/Get-EntraBetaPrivilegedRoleSetting.Tests.ps1 index 5d7710a13..0c33316ea 100644 --- a/testVNext/EntraBeta/Governance/Get-EntraBetaPrivilegedRoleSetting.Tests.ps1 +++ b/testVNext/EntraBeta/Governance/Get-EntraBetaPrivilegedRoleSetting.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Governance) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Governance } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Governance/Set-EntraBetaPrivilegedRoleSetting.Tests.ps1 b/testVNext/EntraBeta/Governance/Set-EntraBetaPrivilegedRoleSetting.Tests.ps1 index 0b42d96d6..0371c31e3 100644 --- a/testVNext/EntraBeta/Governance/Set-EntraBetaPrivilegedRoleSetting.Tests.ps1 +++ b/testVNext/EntraBeta/Governance/Set-EntraBetaPrivilegedRoleSetting.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Governance) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Governance } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Update-MgBetaPrivilegedAccessRoleSetting -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Governance diff --git a/testVNext/EntraBeta/Groups/Add-EntraBetaGroupMember.Tests.ps1 b/testVNext/EntraBeta/Groups/Add-EntraBetaGroupMember.Tests.ps1 index cee8e4a61..1226ef17e 100644 --- a/testVNext/EntraBeta/Groups/Add-EntraBetaGroupMember.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Add-EntraBetaGroupMember.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName New-MgBetaGroupMember -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Groups } diff --git a/testVNext/EntraBeta/Groups/Add-EntraBetaGroupOwner.Tests.ps1 b/testVNext/EntraBeta/Groups/Add-EntraBetaGroupOwner.Tests.ps1 index f552ab9fc..54d3053ba 100644 --- a/testVNext/EntraBeta/Groups/Add-EntraBetaGroupOwner.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Add-EntraBetaGroupOwner.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName New-MgBetaGroupOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Groups } diff --git a/testVNext/EntraBeta/Groups/Get-EntraBetaDeletedGroup.Tests.ps1 b/testVNext/EntraBeta/Groups/Get-EntraBetaDeletedGroup.Tests.ps1 index 4ce2e9d6b..0511fb4ca 100644 --- a/testVNext/EntraBeta/Groups/Get-EntraBetaDeletedGroup.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Get-EntraBetaDeletedGroup.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Groups/Get-EntraBetaGroup.Tests.ps1 b/testVNext/EntraBeta/Groups/Get-EntraBetaGroup.Tests.ps1 index 83b4fafb7..abb970874 100644 --- a/testVNext/EntraBeta/Groups/Get-EntraBetaGroup.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Get-EntraBetaGroup.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Groups/Get-EntraBetaGroupAppRoleAssignment.Tests.ps1 b/testVNext/EntraBeta/Groups/Get-EntraBetaGroupAppRoleAssignment.Tests.ps1 index 5907b2d7e..9d9c92ca2 100644 --- a/testVNext/EntraBeta/Groups/Get-EntraBetaGroupAppRoleAssignment.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Get-EntraBetaGroupAppRoleAssignment.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Groups/Get-EntraBetaGroupLifecyclePolicy.Tests.ps1 b/testVNext/EntraBeta/Groups/Get-EntraBetaGroupLifecyclePolicy.Tests.ps1 index a3211581c..0bde4799a 100644 --- a/testVNext/EntraBeta/Groups/Get-EntraBetaGroupLifecyclePolicy.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Get-EntraBetaGroupLifecyclePolicy.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Groups/Get-EntraBetaGroupMember.Tests.ps1 b/testVNext/EntraBeta/Groups/Get-EntraBetaGroupMember.Tests.ps1 index 93d536a23..e02ba3a56 100644 --- a/testVNext/EntraBeta/Groups/Get-EntraBetaGroupMember.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Get-EntraBetaGroupMember.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null) { Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Groups/Get-EntraBetaGroupOwner.Tests.ps1 b/testVNext/EntraBeta/Groups/Get-EntraBetaGroupOwner.Tests.ps1 index a716802d8..7b5150299 100644 --- a/testVNext/EntraBeta/Groups/Get-EntraBetaGroupOwner.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Get-EntraBetaGroupOwner.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $mockResponse = { return @{ diff --git a/testVNext/EntraBeta/Groups/Get-EntraBetaObjectSetting.Tests.ps1 b/testVNext/EntraBeta/Groups/Get-EntraBetaObjectSetting.Tests.ps1 index 432a11841..7cd44e8a2 100644 --- a/testVNext/EntraBeta/Groups/Get-EntraBetaObjectSetting.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Get-EntraBetaObjectSetting.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null) { Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { # Write-Host "Mocking Get-EntraBetaObjectSetting with parameters: $($args | ConvertTo-Json -Depth 3)" diff --git a/testVNext/EntraBeta/Groups/New-EntraBetaGroup.Tests.ps1 b/testVNext/EntraBeta/Groups/New-EntraBetaGroup.Tests.ps1 index 4dea78f46..c8f445e23 100644 --- a/testVNext/EntraBeta/Groups/New-EntraBetaGroup.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/New-EntraBetaGroup.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Groups/New-EntraBetaGroupAppRoleAssignment.Tests.ps1 b/testVNext/EntraBeta/Groups/New-EntraBetaGroupAppRoleAssignment.Tests.ps1 index 1eb1fabee..82d74bcde 100644 --- a/testVNext/EntraBeta/Groups/New-EntraBetaGroupAppRoleAssignment.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/New-EntraBetaGroupAppRoleAssignment.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Groups/New-EntraBetaObjectSetting.Tests.ps1 b/testVNext/EntraBeta/Groups/New-EntraBetaObjectSetting.Tests.ps1 index 9cc72a6a1..816d1c877 100644 --- a/testVNext/EntraBeta/Groups/New-EntraBetaObjectSetting.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/New-EntraBetaObjectSetting.Tests.ps1 @@ -8,7 +8,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Groups/Remove-EntraBetaGroup.Tests.ps1 b/testVNext/EntraBeta/Groups/Remove-EntraBetaGroup.Tests.ps1 index bb0335127..a73800fcf 100644 --- a/testVNext/EntraBeta/Groups/Remove-EntraBetaGroup.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Remove-EntraBetaGroup.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaGroup -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Groups } diff --git a/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupAppRoleAssignment.Tests.ps1 b/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupAppRoleAssignment.Tests.ps1 index dc40d8a70..eab382f6d 100644 --- a/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupAppRoleAssignment.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupAppRoleAssignment.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module .\test\module\Common-Functions.ps1 -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaGroupAppRoleAssignment -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Groups } diff --git a/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupLifecyclePolicy.Tests.ps1 b/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupLifecyclePolicy.Tests.ps1 index e27ae5a7c..c9b0dcf3d 100644 --- a/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupLifecyclePolicy.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupLifecyclePolicy.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaGroupLifecyclePolicy -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Groups } diff --git a/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupMember.Tests.ps1 b/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupMember.Tests.ps1 index dfed22676..71791befa 100644 --- a/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupMember.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupMember.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaGroupMemberByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Groups } diff --git a/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupOwner.Tests.ps1 b/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupOwner.Tests.ps1 index ab54315e4..2f0a568b2 100644 --- a/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupOwner.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Remove-EntraBetaGroupOwner.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaGroupOwnerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Groups } diff --git a/testVNext/EntraBeta/Groups/Remove-EntraBetaObjectSetting.Tests.ps1 b/testVNext/EntraBeta/Groups/Remove-EntraBetaObjectSetting.Tests.ps1 index 0e8ce0d84..16e197c2a 100644 --- a/testVNext/EntraBeta/Groups/Remove-EntraBetaObjectSetting.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Remove-EntraBetaObjectSetting.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Groups } diff --git a/testVNext/EntraBeta/Groups/Set-EntraBetaGroup.Tests.ps1 b/testVNext/EntraBeta/Groups/Set-EntraBetaGroup.Tests.ps1 index 3749a856c..bb994f2f0 100644 --- a/testVNext/EntraBeta/Groups/Set-EntraBetaGroup.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Set-EntraBetaGroup.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Update-MgBetaGroup -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Groups } diff --git a/testVNext/EntraBeta/Groups/Set-EntraBetaGroupLifecyclePolicy.Tests.ps1 b/testVNext/EntraBeta/Groups/Set-EntraBetaGroupLifecyclePolicy.Tests.ps1 index 6db5fdd2b..547138a56 100644 --- a/testVNext/EntraBeta/Groups/Set-EntraBetaGroupLifecyclePolicy.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Set-EntraBetaGroupLifecyclePolicy.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null) { Import-Module Microsoft.Graph.Entra.Beta.Groups } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Groups/Set-EntraBetaObjectSetting.Tests.ps1 b/testVNext/EntraBeta/Groups/Set-EntraBetaObjectSetting.Tests.ps1 index 12be19983..0a3420c61 100644 --- a/testVNext/EntraBeta/Groups/Set-EntraBetaObjectSetting.Tests.ps1 +++ b/testVNext/EntraBeta/Groups/Set-EntraBetaObjectSetting.Tests.ps1 @@ -5,11 +5,11 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Groups) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Groups } - if((Get-Module -Name Microsoft.Graph.Entra.Beta.DirectoryManagement) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.DirectoryManagement } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force + $TemplateScriptblock = { return @( [PSCustomObject]@{ diff --git a/testVNext/EntraBeta/Reports/Get-EntraBetaApplicationSignInDetailedSummary.Tests.ps1 b/testVNext/EntraBeta/Reports/Get-EntraBetaApplicationSignInDetailedSummary.Tests.ps1 index 62aa826f2..51512fa6a 100644 --- a/testVNext/EntraBeta/Reports/Get-EntraBetaApplicationSignInDetailedSummary.Tests.ps1 +++ b/testVNext/EntraBeta/Reports/Get-EntraBetaApplicationSignInDetailedSummary.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Reports) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Reports } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Reports/Get-EntraBetaApplicationSignInSummary.Tests.ps1 b/testVNext/EntraBeta/Reports/Get-EntraBetaApplicationSignInSummary.Tests.ps1 index 878b71705..841d8ab18 100644 --- a/testVNext/EntraBeta/Reports/Get-EntraBetaApplicationSignInSummary.Tests.ps1 +++ b/testVNext/EntraBeta/Reports/Get-EntraBetaApplicationSignInSummary.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Reports) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Reports } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { diff --git a/testVNext/EntraBeta/Reports/Get-EntraBetaAuditDirectoryLog.Tests.ps1 b/testVNext/EntraBeta/Reports/Get-EntraBetaAuditDirectoryLog.Tests.ps1 index 2cef546e4..32e410dc5 100644 --- a/testVNext/EntraBeta/Reports/Get-EntraBetaAuditDirectoryLog.Tests.ps1 +++ b/testVNext/EntraBeta/Reports/Get-EntraBetaAuditDirectoryLog.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Reports) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Reports } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Reports/Get-EntraBetaAuditSignInLog.Tests.ps1 b/testVNext/EntraBeta/Reports/Get-EntraBetaAuditSignInLog.Tests.ps1 index a1d2ae06c..f8fde9c6a 100644 --- a/testVNext/EntraBeta/Reports/Get-EntraBetaAuditSignInLog.Tests.ps1 +++ b/testVNext/EntraBeta/Reports/Get-EntraBetaAuditSignInLog.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Reports) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Reports } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/SignIns/Add-EntraBetaFeatureRolloutPolicyDirectoryObject.Tests.ps1 b/testVNext/EntraBeta/SignIns/Add-EntraBetaFeatureRolloutPolicyDirectoryObject.Tests.ps1 index 14e4b1b70..069c37d2d 100644 --- a/testVNext/EntraBeta/SignIns/Add-EntraBetaFeatureRolloutPolicyDirectoryObject.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/Add-EntraBetaFeatureRolloutPolicyDirectoryObject.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName New-MgBetaDirectoryFeatureRolloutPolicyApplyToByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.SignIns } diff --git a/testVNext/EntraBeta/SignIns/Add-EntraBetaServicePrincipalPolicy.Tests.ps1 b/testVNext/EntraBeta/SignIns/Add-EntraBetaServicePrincipalPolicy.Tests.ps1 index 1a3faca53..f36eb6778 100644 --- a/testVNext/EntraBeta/SignIns/Add-EntraBetaServicePrincipalPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/Add-EntraBetaServicePrincipalPolicy.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.SignIns diff --git a/testVNext/EntraBeta/SignIns/Get-EntraBetaFeatureRolloutPolicy.Tests.ps1 b/testVNext/EntraBeta/SignIns/Get-EntraBetaFeatureRolloutPolicy.Tests.ps1 index 4b9b02c25..1f2bc0396 100644 --- a/testVNext/EntraBeta/SignIns/Get-EntraBetaFeatureRolloutPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/Get-EntraBetaFeatureRolloutPolicy.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/SignIns/Get-EntraBetaPermissionGrantPolicy.Tests.ps1 b/testVNext/EntraBeta/SignIns/Get-EntraBetaPermissionGrantPolicy.Tests.ps1 index a0e46b322..7200b0957 100644 --- a/testVNext/EntraBeta/SignIns/Get-EntraBetaPermissionGrantPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/Get-EntraBetaPermissionGrantPolicy.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null) { Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/SignIns/Get-EntraBetaPolicy.Tests.ps1 b/testVNext/EntraBeta/SignIns/Get-EntraBetaPolicy.Tests.ps1 index fd573cc28..7be65c068 100644 --- a/testVNext/EntraBeta/SignIns/Get-EntraBetaPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/Get-EntraBetaPolicy.Tests.ps1 @@ -7,7 +7,7 @@ BeforeAll { Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $ScriptBlock = { diff --git a/testVNext/EntraBeta/SignIns/Get-EntraBetaPolicyAppliedObject.Tests.ps1 b/testVNext/EntraBeta/SignIns/Get-EntraBetaPolicyAppliedObject.Tests.ps1 index 01341ac7c..173b576e6 100644 --- a/testVNext/EntraBeta/SignIns/Get-EntraBetaPolicyAppliedObject.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/Get-EntraBetaPolicyAppliedObject.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { diff --git a/testVNext/EntraBeta/SignIns/Get-EntraBetaServicePrincipalPolicy.Tests.ps1 b/testVNext/EntraBeta/SignIns/Get-EntraBetaServicePrincipalPolicy.Tests.ps1 index b1aca8184..31b0df9d7 100644 --- a/testVNext/EntraBeta/SignIns/Get-EntraBetaServicePrincipalPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/Get-EntraBetaServicePrincipalPolicy.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { diff --git a/testVNext/EntraBeta/SignIns/New-EntraBetaFeatureRolloutPolicy.Tests.ps1 b/testVNext/EntraBeta/SignIns/New-EntraBetaFeatureRolloutPolicy.Tests.ps1 index 47613d603..523c632b4 100644 --- a/testVNext/EntraBeta/SignIns/New-EntraBetaFeatureRolloutPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/New-EntraBetaFeatureRolloutPolicy.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/SignIns/New-EntraBetaOauth2PermissionGrant.Tests.ps1 b/testVNext/EntraBeta/SignIns/New-EntraBetaOauth2PermissionGrant.Tests.ps1 index 2dd353b59..9fef2ee19 100644 --- a/testVNext/EntraBeta/SignIns/New-EntraBetaOauth2PermissionGrant.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/New-EntraBetaOauth2PermissionGrant.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null) { Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/SignIns/Remove-EntraBetaFeatureRolloutPolicy.Tests.ps1 b/testVNext/EntraBeta/SignIns/Remove-EntraBetaFeatureRolloutPolicy.Tests.ps1 index 120850963..e6589caaa 100644 --- a/testVNext/EntraBeta/SignIns/Remove-EntraBetaFeatureRolloutPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/Remove-EntraBetaFeatureRolloutPolicy.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaPolicyFeatureRolloutPolicy -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.SignIns } diff --git a/testVNext/EntraBeta/SignIns/Remove-EntraBetaFeatureRolloutPolicyDirectoryObject.Tests.ps1 b/testVNext/EntraBeta/SignIns/Remove-EntraBetaFeatureRolloutPolicyDirectoryObject.Tests.ps1 index c49778f5a..3a8ceb779 100644 --- a/testVNext/EntraBeta/SignIns/Remove-EntraBetaFeatureRolloutPolicyDirectoryObject.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/Remove-EntraBetaFeatureRolloutPolicyDirectoryObject.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaPolicyFeatureRolloutPolicyApplyToByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.SignIns } diff --git a/testVNext/EntraBeta/SignIns/Remove-EntraBetaPolicy.Tests.ps1 b/testVNext/EntraBeta/SignIns/Remove-EntraBetaPolicy.Tests.ps1 index e874bb9f1..0964ff8f2 100644 --- a/testVNext/EntraBeta/SignIns/Remove-EntraBetaPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/Remove-EntraBetaPolicy.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null) { Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $ScriptBlock = { $response = @{ '@odata.context' = 'https://graph.microsoft.com/v1.0/$metadata#policies/homeRealmDiscoveryPolicies/$entity' diff --git a/testVNext/EntraBeta/SignIns/Remove-EntraBetaServicePrincipalPolicy.Tests.ps1 b/testVNext/EntraBeta/SignIns/Remove-EntraBetaServicePrincipalPolicy.Tests.ps1 index dde44ce75..909c7d713 100644 --- a/testVNext/EntraBeta/SignIns/Remove-EntraBetaServicePrincipalPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/Remove-EntraBetaServicePrincipalPolicy.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.SignIns diff --git a/testVNext/EntraBeta/SignIns/Remove-EntraBetaTrustFrameworkPolicy.Tests.ps1 b/testVNext/EntraBeta/SignIns/Remove-EntraBetaTrustFrameworkPolicy.Tests.ps1 index 1f71e536e..c4befe334 100644 --- a/testVNext/EntraBeta/SignIns/Remove-EntraBetaTrustFrameworkPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/Remove-EntraBetaTrustFrameworkPolicy.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaTrustFrameworkPolicy -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.SignIns } diff --git a/testVNext/EntraBeta/SignIns/Set-EntraBetaFeatureRolloutPolicy.Tests.ps1 b/testVNext/EntraBeta/SignIns/Set-EntraBetaFeatureRolloutPolicy.Tests.ps1 index 0410768c4..0e05cf9de 100644 --- a/testVNext/EntraBeta/SignIns/Set-EntraBetaFeatureRolloutPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/Set-EntraBetaFeatureRolloutPolicy.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Update-MgBetaPolicyFeatureRolloutPolicy -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.SignIns } diff --git a/testVNext/EntraBeta/SignIns/Set-EntraBetaPolicy.Tests.ps1 b/testVNext/EntraBeta/SignIns/Set-EntraBetaPolicy.Tests.ps1 index 93b1d3af2..3af495e06 100644 --- a/testVNext/EntraBeta/SignIns/Set-EntraBetaPolicy.Tests.ps1 +++ b/testVNext/EntraBeta/SignIns/Set-EntraBetaPolicy.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Beta.SignIns) -eq $null) { Import-Module Microsoft.Graph.Entra.Beta.SignIns } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { #Write-Host "Mocking set-EntraPolicy with parameters: $($args | ConvertTo-Json -Depth 3)" diff --git a/testVNext/EntraBeta/Users/Get-EntraBetaUser.Tests.ps1 b/testVNext/EntraBeta/Users/Get-EntraBetaUser.Tests.ps1 index 2b249b727..40e5e605c 100644 --- a/testVNext/EntraBeta/Users/Get-EntraBetaUser.Tests.ps1 +++ b/testVNext/EntraBeta/Users/Get-EntraBetaUser.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null) { Import-Module Microsoft.Graph.Entra.Beta.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { $valueObject = [PSCustomObject]@{ diff --git a/testVNext/EntraBeta/Users/Get-EntraBetaUserExtension.Tests.ps1 b/testVNext/EntraBeta/Users/Get-EntraBetaUserExtension.Tests.ps1 index 73d53f42b..e329fc36d 100644 --- a/testVNext/EntraBeta/Users/Get-EntraBetaUserExtension.Tests.ps1 +++ b/testVNext/EntraBeta/Users/Get-EntraBetaUserExtension.Tests.ps1 @@ -2,7 +2,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null) { Import-Module Microsoft.Graph.Entra.Beta.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @{ diff --git a/testVNext/EntraBeta/Users/Get-EntraBetaUserLicenseDetail.Tests.ps1 b/testVNext/EntraBeta/Users/Get-EntraBetaUserLicenseDetail.Tests.ps1 index 49f8c7157..10ed0626f 100644 --- a/testVNext/EntraBeta/Users/Get-EntraBetaUserLicenseDetail.Tests.ps1 +++ b/testVNext/EntraBeta/Users/Get-EntraBetaUserLicenseDetail.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Users/Get-EntraBetaUserManager.Tests.ps1 b/testVNext/EntraBeta/Users/Get-EntraBetaUserManager.Tests.ps1 index 1665170d7..44d1be83d 100644 --- a/testVNext/EntraBeta/Users/Get-EntraBetaUserManager.Tests.ps1 +++ b/testVNext/EntraBeta/Users/Get-EntraBetaUserManager.Tests.ps1 @@ -2,7 +2,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Users/Get-EntraBetaUserMembership.Tests.ps1 b/testVNext/EntraBeta/Users/Get-EntraBetaUserMembership.Tests.ps1 index e0f5a7838..23e392d5c 100644 --- a/testVNext/EntraBeta/Users/Get-EntraBetaUserMembership.Tests.ps1 +++ b/testVNext/EntraBeta/Users/Get-EntraBetaUserMembership.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Users/Get-EntraBetaUserOwnedDevice.Tests.ps1 b/testVNext/EntraBeta/Users/Get-EntraBetaUserOwnedDevice.Tests.ps1 index 05acc2b8c..bd9fed0c3 100644 --- a/testVNext/EntraBeta/Users/Get-EntraBetaUserOwnedDevice.Tests.ps1 +++ b/testVNext/EntraBeta/Users/Get-EntraBetaUserOwnedDevice.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Users/Get-EntraBetaUserRegisteredDevice.Tests.ps1 b/testVNext/EntraBeta/Users/Get-EntraBetaUserRegisteredDevice.Tests.ps1 index 51e2fea76..43fe01e92 100644 --- a/testVNext/EntraBeta/Users/Get-EntraBetaUserRegisteredDevice.Tests.ps1 +++ b/testVNext/EntraBeta/Users/Get-EntraBetaUserRegisteredDevice.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { return @( diff --git a/testVNext/EntraBeta/Users/New-EntraBetaUser.Tests.ps1 b/testVNext/EntraBeta/Users/New-EntraBetaUser.Tests.ps1 index 6800d56b0..65f58bd90 100644 --- a/testVNext/EntraBeta/Users/New-EntraBetaUser.Tests.ps1 +++ b/testVNext/EntraBeta/Users/New-EntraBetaUser.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if ((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null) { Import-Module Microsoft.Graph.Entra.Beta.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblock = { diff --git a/testVNext/EntraBeta/Users/Remove-EntraBetaUser.Tests.ps1 b/testVNext/EntraBeta/Users/Remove-EntraBetaUser.Tests.ps1 index f6883ed06..5628cffad 100644 --- a/testVNext/EntraBeta/Users/Remove-EntraBetaUser.Tests.ps1 +++ b/testVNext/EntraBeta/Users/Remove-EntraBetaUser.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaUser -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Users } diff --git a/testVNext/EntraBeta/Users/Remove-EntraBetaUserManager.Tests.ps1 b/testVNext/EntraBeta/Users/Remove-EntraBetaUserManager.Tests.ps1 index 41b58bd16..0b29232f5 100644 --- a/testVNext/EntraBeta/Users/Remove-EntraBetaUserManager.Tests.ps1 +++ b/testVNext/EntraBeta/Users/Remove-EntraBetaUserManager.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Remove-MgBetaUserManagerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Users } diff --git a/testVNext/EntraBeta/Users/Set-EntraBetaUser.Tests.ps1 b/testVNext/EntraBeta/Users/Set-EntraBetaUser.Tests.ps1 index 3a6a259e7..f0cef92b5 100644 --- a/testVNext/EntraBeta/Users/Set-EntraBetaUser.Tests.ps1 +++ b/testVNext/EntraBeta/Users/Set-EntraBetaUser.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Update-MgBetaUser -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Users } diff --git a/testVNext/EntraBeta/Users/Set-EntraBetaUserManager.Tests.ps1 b/testVNext/EntraBeta/Users/Set-EntraBetaUserManager.Tests.ps1 index 589e2a03a..4307e68cf 100644 --- a/testVNext/EntraBeta/Users/Set-EntraBetaUserManager.Tests.ps1 +++ b/testVNext/EntraBeta/Users/Set-EntraBetaUserManager.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Set-MgBetaUserManagerByRef -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Users } diff --git a/testVNext/EntraBeta/Users/Update-EntraBetaSignedInUserPassword.Tests.ps1 b/testVNext/EntraBeta/Users/Update-EntraBetaSignedInUserPassword.Tests.ps1 index 066693ce8..ba378a988 100644 --- a/testVNext/EntraBeta/Users/Update-EntraBetaSignedInUserPassword.Tests.ps1 +++ b/testVNext/EntraBeta/Users/Update-EntraBetaSignedInUserPassword.Tests.ps1 @@ -6,7 +6,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force Mock -CommandName Invoke-GraphRequest -MockWith {} -ModuleName Microsoft.Graph.Entra.Beta.Users } diff --git a/testVNext/EntraBeta/Users/Update-EntraBetaUserFromFederated.Tests.ps1 b/testVNext/EntraBeta/Users/Update-EntraBetaUserFromFederated.Tests.ps1 index 0a1532607..6ececce1d 100644 --- a/testVNext/EntraBeta/Users/Update-EntraBetaUserFromFederated.Tests.ps1 +++ b/testVNext/EntraBeta/Users/Update-EntraBetaUserFromFederated.Tests.ps1 @@ -5,7 +5,7 @@ BeforeAll { if((Get-Module -Name Microsoft.Graph.Entra.Beta.Users) -eq $null){ Import-Module Microsoft.Graph.Entra.Beta.Users } - Import-Module (Join-Path $PSScriptRoot "..\..\build\Common-Functions.ps1") -Force + Import-Module (Join-Path $PSScriptRoot "..\..\Common-Functions.ps1") -Force $scriptblockForAuthenticationMethod = { return @( [PSCustomObject]@{