diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADAdministrativeUnit/MSFT_AADAdministrativeUnit.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADAdministrativeUnit/MSFT_AADAdministrativeUnit.psm1 index 6287779158..73a348b8fb 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADAdministrativeUnit/MSFT_AADAdministrativeUnit.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADAdministrativeUnit/MSFT_AADAdministrativeUnit.psm1 @@ -118,7 +118,7 @@ function Get-TargetResource } else { - $getValue = Get-MgBetaDirectoryAdministrativeUnit -AdministrativeUnitId $Id -ErrorAction SilentlyContinue + $getValue = Get-MgDirectoryAdministrativeUnit -AdministrativeUnitId $Id -ErrorAction SilentlyContinue } } @@ -133,7 +133,7 @@ function Get-TargetResource } else { - $getValue = Get-MgBetaDirectoryAdministrativeUnit -Filter "DisplayName eq '$DisplayName'" -ErrorAction Stop + $getValue = Get-MgDirectoryAdministrativeUnit -Filter "DisplayName eq '$DisplayName'" -ErrorAction Stop } } } @@ -180,7 +180,7 @@ function Get-TargetResource if ($results.MembershipType -ne 'Dynamic') { Write-Verbose -Message "AU {$DisplayName} get Members" - [array]$auMembers = Get-MgBetaDirectoryAdministrativeUnitMember -AdministrativeUnitId $getValue.Id -All + [array]$auMembers = Get-MgDirectoryAdministrativeUnitMember -AdministrativeUnitId $getValue.Id -All if ($auMembers.Count -gt 0) { Write-Verbose -Message "AU {$DisplayName} process $($auMembers.Count) members" @@ -215,7 +215,7 @@ function Get-TargetResource Write-Verbose -Message "AU {$DisplayName} get Scoped Role Members" $ErrorActionPreference = 'Stop' - [array]$auScopedRoleMembers = Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember -AdministrativeUnitId $getValue.Id -All + [array]$auScopedRoleMembers = Get-MgDirectoryAdministrativeUnitScopedRoleMember -AdministrativeUnitId $getValue.Id -All if ($auScopedRoleMembers.Count -gt 0) { Write-Verbose -Message "AU {$DisplayName} process $($auScopedRoleMembers.Count) scoped role members" @@ -556,25 +556,25 @@ function Set-TargetResource #region resource generator code Write-Verbose -Message "Creating new Administrative Unit with: $(Convert-M365DscHashtableToString -Hashtable $CreateParameters)" - $policy = New-MgBetaDirectoryAdministrativeUnit @CreateParameters + $policy = New-MgDirectoryAdministrativeUnit @CreateParameters if ($MembershipType -ne 'Dynamic') { foreach ($member in $memberSpecification) { Write-Verbose -Message "Adding new dynamic member {$($member.Id)}" - $url = (Get-MSCloudLoginConnectionProfile -Workload MicrosoftGraph).ResourceUrl + "beta/$($member.Type)/$($member.Id)" + $url = (Get-MSCloudLoginConnectionProfile -Workload MicrosoftGraph).ResourceUrl + "v1.0/$($member.Type)/$($member.Id)" $memberBodyParam = @{ '@odata.id' = $url } - New-MgBetaDirectoryAdministrativeUnitMemberByRef -AdministrativeUnitId $policy.Id -BodyParameter $memberBodyParam + New-MgDirectoryAdministrativeUnitMemberByRef -AdministrativeUnitId $policy.Id -BodyParameter $memberBodyParam } } foreach ($scopedRoleMember in $scopedRoleMemberSpecification) { - New-MgBetaDirectoryAdministrativeUnitScopedRoleMember -AdministrativeUnitId $policy.Id -BodyParameter $scopedRoleMember + New-MgDirectoryAdministrativeUnitScopedRoleMember -AdministrativeUnitId $policy.Id -BodyParameter $scopedRoleMember } @@ -604,7 +604,7 @@ function Set-TargetResource $UpdateParameters.Remove('ScopedRoleMembers') | Out-Null #region resource generator code - Update-MgBetaDirectoryAdministrativeUnit @UpdateParameters ` + Update-MgDirectoryAdministrativeUnit @UpdateParameters ` -AdministrativeUnitId $currentInstance.Id #endregion @@ -657,16 +657,16 @@ function Set-TargetResource { Write-Verbose -Message "AdministrativeUnit {$DisplayName} Adding member {$($diff.Identity)}, type {$($diff.Type)}" - $url = (Get-MSCloudLoginConnectionProfile -Workload MicrosoftGraph).ResourceUrl + "beta/$memberType/$($memberObject.Id)" + $url = (Get-MSCloudLoginConnectionProfile -Workload MicrosoftGraph).ResourceUrl + "v1.0/$memberType/$($memberObject.Id)" $memberBodyParam = @{ '@odata.id' = $url } - New-MgBetaDirectoryAdministrativeUnitMemberByRef -AdministrativeUnitId ($currentInstance.Id) -BodyParameter $memberBodyParam | Out-Null + New-MgDirectoryAdministrativeUnitMemberByRef -AdministrativeUnitId ($currentInstance.Id) -BodyParameter $memberBodyParam | Out-Null } else { Write-Verbose -Message "Administrative Unit {$DisplayName} Removing member {$($diff.Identity)}, type {$($diff.Type)}" - Remove-MgBetaDirectoryAdministrativeUnitMemberDirectoryObjectByRef -AdministrativeUnitId ($currentInstance.Id) -DirectoryObjectId ($memberObject.Id) | Out-Null + Remove-MgDirectoryAdministrativeUnitMemberDirectoryObjectByRef -AdministrativeUnitId ($currentInstance.Id) -DirectoryObjectId ($memberObject.Id) | Out-Null } } } @@ -770,15 +770,15 @@ function Set-TargetResource } } # addition of scoped rolemember may throw if role is not supported as a scoped role - New-MgBetaDirectoryAdministrativeUnitScopedRoleMember -AdministrativeUnitId ($currentInstance.Id) -BodyParameter $scopedRoleMemberParam -ErrorAction Stop | Out-Null + New-MgDirectoryAdministrativeUnitScopedRoleMember -AdministrativeUnitId ($currentInstance.Id) -BodyParameter $scopedRoleMemberParam -ErrorAction Stop | Out-Null } else { if (-not [string]::IsNullOrEmpty($diff.Rolename)) { Write-Verbose -Message "Removing scoped role {$($diff.RoleName)} member {$($diff.Identity)}, type {$($diff.Type)} from Administrative Unit {$DisplayName}" - $scopedRoleMemberObject = Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember -AdministrativeUnitId ($currentInstance.Id) -All | Where-Object -FilterScript { $_.RoleId -eq $roleObject.Id -and $_.RoleMemberInfo.Id -eq $memberObject.Id } - Remove-MgBetaDirectoryAdministrativeUnitScopedRoleMember -AdministrativeUnitId ($currentInstance.Id) -ScopedRoleMembershipId $scopedRoleMemberObject.Id -ErrorAction Stop | Out-Null + $scopedRoleMemberObject = Get-MgDirectoryAdministrativeUnitScopedRoleMember -AdministrativeUnitId ($currentInstance.Id) -All | Where-Object -FilterScript { $_.RoleId -eq $roleObject.Id -and $_.RoleMemberInfo.Id -eq $memberObject.Id } + Remove-MgDirectoryAdministrativeUnitScopedRoleMember -AdministrativeUnitId ($currentInstance.Id) -ScopedRoleMembershipId $scopedRoleMemberObject.Id -ErrorAction Stop | Out-Null } } } @@ -787,11 +787,7 @@ function Set-TargetResource elseif ($Ensure -eq 'Absent' -and $currentInstance.Ensure -eq 'Present') { Write-Verbose -Message "Removing AU {$DisplayName}" - # Workaround since Remove-MgBetaDirectoryAdministrativeUnit is not working with 2.11.1 - # https://github.com/microsoftgraph/msgraph-sdk-powershell/issues/2529 - $url = (Get-MSCloudLoginConnectionProfile -Workload MicrosoftGraph).ResourceUrl + "beta/administrativeUnits/$($currentInstance.Id)" - Invoke-MgGraphRequest -Method DELETE -Uri $url | Out-Null - #Remove-MgBetaDirectoryAdministrativeUnit -AdministrativeUnitId $currentInstance.Id + Remove-MgDirectoryAdministrativeUnit -AdministrativeUnitId $currentInstance.Id } } @@ -1060,7 +1056,7 @@ function Export-TargetResource $ExportParameters.Add('headers', @{'ConsistencyLevel' = 'Eventual' }) } - [array] $Script:exportedInstances = Get-MgBetaDirectoryAdministrativeUnit @ExportParameters + [array] $Script:exportedInstances = Get-MgDirectoryAdministrativeUnit @ExportParameters #endregion $i = 1 diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRoleAssignment/MSFT_EXOManagementRoleAssignment.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRoleAssignment/MSFT_EXOManagementRoleAssignment.psm1 index 8563e58c42..c098faff6a 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRoleAssignment/MSFT_EXOManagementRoleAssignment.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_EXOManagementRoleAssignment/MSFT_EXOManagementRoleAssignment.psm1 @@ -335,10 +335,10 @@ function Set-TargetResource $NewManagementRoleParams.Remove('CustomRecipientWriteScope') | Out-Null $ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' ` -InboundParameters $PSBoundParameters - $adminUnit = Get-MgBetaDirectoryAdministrativeUnit -AdministrativeUnitId $RecipientAdministrativeUnitScope -ErrorAction SilentlyContinue + $adminUnit = Get-MgDirectoryAdministrativeUnit -AdministrativeUnitId $RecipientAdministrativeUnitScope -ErrorAction SilentlyContinue if ($null -eq $adminUnit) { - $adminUnit = Get-MgBetaDirectoryAdministrativeUnit -All | Where-Object -FilterScript { $_.DisplayName -eq $RecipientAdministrativeUnitScope } + $adminUnit = Get-MgDirectoryAdministrativeUnit -All | Where-Object -FilterScript { $_.DisplayName -eq $RecipientAdministrativeUnitScope } } $NewManagementRoleParams.RecipientAdministrativeUnitScope = $adminUnit.Id } diff --git a/Modules/Microsoft365DSC/Dependencies/GraphCmdletPermissions.csv b/Modules/Microsoft365DSC/Dependencies/GraphCmdletPermissions.csv index 265f8d5523..dad9d816d4 100644 --- a/Modules/Microsoft365DSC/Dependencies/GraphCmdletPermissions.csv +++ b/Modules/Microsoft365DSC/Dependencies/GraphCmdletPermissions.csv @@ -4,9 +4,9 @@ Get-MgBetaAgreement,Agreement.Read.All,NotSupported Get-MgApplication,Application.Read.All,Application.Read.All Get-MgApplicationOwner,Application.Read.All,Application.Read.All Get-MgDevice,Device.Read.All,Device.Read.All -Get-MgBetaDirectoryAdministrativeUnitExtension,AdministrativeUnit.Read.All,AdministrativeUnit.Read.All -Get-MgBetaDirectoryAdministrativeUnitMember,AdministrativeUnit.Read.All,AdministrativeUnit.Read.All -Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember,AdministrativeUnit.Read.All,AdministrativeUnit.Read.All +Get-MgDirectoryAdministrativeUnitExtension,AdministrativeUnit.Read.All,AdministrativeUnit.Read.All +Get-MgDirectoryAdministrativeUnitMember,AdministrativeUnit.Read.All,AdministrativeUnit.Read.All +Get-MgDirectoryAdministrativeUnitScopedRoleMember,AdministrativeUnit.Read.All,AdministrativeUnit.Read.All Get-MgBetaDirectoryRole,RoleManagement.Read.Directory,RoleManagement.Read.Directory Get-MgBetaDirectoryRoleTemplate,RoleManagement.Read.Directory,RoleManagement.Read.Directory Get-MgDirectorySetting,Directory.Read.All,Directory.Read.All @@ -44,9 +44,9 @@ Get-MgUserLicenseDetail,User.Read.All,User.Read.All New-MgAdministrativeUnit,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All New-MgApplication,Application.ReadWrite.All,Application.ReadWrite.All New-MgApplicationOwnerByRef,Application.ReadWrite.All,Application.ReadWrite.All -New-MgBetaDirectoryAdministrativeUnitExtension,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All -New-MgBetaDirectoryAdministrativeUnitMemberByRef,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All -New-MgBetaDirectoryAdministrativeUnitScopedRoleMember,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All +New-MgDirectoryAdministrativeUnitExtension,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All +New-MgDirectoryAdministrativeUnitMemberByRef,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All +New-MgDirectoryAdministrativeUnitScopedRoleMember,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All New-MgBetaDirectoryRoleMemberByRef,RoleManagement.ReadWrite.Directory,RoleManagement.ReadWrite.Directory New-MgDirectorySetting,Directory.ReadWrite.All,Directory.ReadWrite.All New-MgEntitlementManagementAccessPackage,EntitlementManagement.ReadWrite.All,EntitlementManagement.ReadWrite.All @@ -73,10 +73,10 @@ New-MgTeamChannelTab,TeamsTab.Create,TeamsTab.Create New-MgUser,User.ReadWrite.All,User.ReadWrite.All Remove-MgApplication,Application.ReadWrite.All,Application.ReadWrite.All Remove-MgApplicationOwnerByRef,Application.ReadWrite.All,Application.ReadWrite.All -Remove-MgBetaDirectoryAdministrativeUnit,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All -Remove-MgBetaDirectoryAdministrativeUnitExtension,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All -Remove-MgBetaDirectoryAdministrativeUnitMemberByRef,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All -Remove-MgBetaDirectoryAdministrativeUnitScopedRoleMember,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All +Remove-MgDirectoryAdministrativeUnit,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All +Remove-MgDirectoryAdministrativeUnitExtension,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All +Remove-MgDirectoryAdministrativeUnitMemberByRef,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All +Remove-MgDirectoryAdministrativeUnitScopedRoleMember,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All Remove-MgBetaDirectoryRoleMemberByRef,RoleManagement.ReadWrite.Directory,RoleManagement.ReadWrite.Directory Remove-MgDirectorySetting,Directory.ReadWrite.All,Directory.ReadWrite.All Remove-MgEntitlementManagementAccessPackage,EntitlementManagement.ReadWrite.All,EntitlementManagement.ReadWrite.All @@ -101,7 +101,7 @@ Set-MgGroupLicense,Group.ReadWrite.All,Group.ReadWrite.All Set-MgUserLicense,User.ReadWrite.All,User.ReadWrite.All Update-MgAdministrativeUnit,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All Update-MgApplication,Application.ReadWrite.All,Application.ReadWrite.All -Update-MgBetaDirectoryAdministrativeUnitExtension,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All +Update-MgDirectoryAdministrativeUnitExtension,AdministrativeUnit.ReadWrite.All,AdministrativeUnit.ReadWrite.All Update-MgDirectorySetting,Directory.ReadWrite.All,Directory.ReadWrite.All Update-MgBetaEntitlementManagementAccessPackage,EntitlementManagement.ReadWrite.All,EntitlementManagement.ReadWrite.All Update-MgBetaEntitlementManagementAccessPackageCatalog,EntitlementManagement.ReadWrite.All,EntitlementManagement.ReadWrite.All diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADAdministrativeUnit.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADAdministrativeUnit.Tests.ps1 index 0c35485867..c77510938f 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADAdministrativeUnit.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADAdministrativeUnit.Tests.ps1 @@ -43,28 +43,28 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Invoke-MgGraphRequest -MockWith { } - Mock -CommandName Update-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Update-MgDirectoryAdministrativeUnit -MockWith { } - Mock -CommandName Remove-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Remove-MgDirectoryAdministrativeUnit -MockWith { } - Mock -CommandName New-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName New-MgDirectoryAdministrativeUnit -MockWith { } - Mock -CommandName New-MgBetaDirectoryAdministrativeUnitMemberByRef -MockWith { + Mock -CommandName New-MgDirectoryAdministrativeUnitMemberByRef -MockWith { } - Mock -CommandName New-MgBetaDirectoryAdministrativeUnitScopedRoleMember -MockWith { + Mock -CommandName New-MgDirectoryAdministrativeUnitScopedRoleMember -MockWith { } - Mock -CommandName Remove-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Remove-MgDirectoryAdministrativeUnit -MockWith { } - Mock -CommandName Remove-MgBetaDirectoryAdministrativeUnitMemberDirectoryObjectByRef -MockWith { + Mock -CommandName Remove-MgDirectoryAdministrativeUnitMemberDirectoryObjectByRef -MockWith { } - Mock -CommandName Remove-MgBetaDirectoryAdministrativeUnitScopedRoleMember -MockWith { + Mock -CommandName Remove-MgDirectoryAdministrativeUnitScopedRoleMember -MockWith { } Mock -CommandName New-M365DSCConnection -MockWith { return 'Credentials' @@ -100,13 +100,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnit -MockWith { return $null } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnitMember -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnitMember -MockWith { return $null } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnitScopedRoleMember -MockWith { return $null } } @@ -118,7 +118,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } It 'Should Create the AU from the Set method' { Set-TargetResource @testParams - Should -Invoke -CommandName New-MgBetaDirectoryAdministrativeUnit -Exactly 1 + Should -Invoke -CommandName New-MgDirectoryAdministrativeUnit -Exactly 1 } } @@ -138,17 +138,17 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Credential = $Credential } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnit -MockWith { return @{ Description = 'FakeStringValue2' DisplayName = 'FakeStringValue2' Id = 'FakeStringValue2' } } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnitMember -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnitMember -MockWith { return $null } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnitScopedRoleMember -MockWith { return $null } } @@ -175,17 +175,17 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Credential = $Credential } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnit -MockWith { return @{ Description = 'FakeStringValue2' DisplayName = 'FakeStringValue2' Id = 'FakeStringValue2' } } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnitMember -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnitMember -MockWith { return $null } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnitScopedRoleMember -MockWith { return $null } } @@ -233,7 +233,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { # Note: It is in fact possible to update the AU MembershipRule with any invalid value, but in the AAD-portal, updates are not possible unless the rule is valid. - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnit -MockWith { return @{ Description = 'DSCAU' DisplayName = 'DSCAU' @@ -254,13 +254,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnitMember -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnitMember -MockWith { return @(@{ Id = '1234567890' }) } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnitScopedRoleMember -MockWith { return @(@{ RoleId = '12345-67890' RoleMemberInfo = @{ @@ -299,7 +299,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { # Note: It is in fact possible to update the AU MembershipRule with any invalid value, but in the AAD-portal, updates are not possible unless the rule is valid. - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnit -MockWith { return @{ Description = 'DSCAU Old Description' DisplayName = 'DSCAU' @@ -308,13 +308,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnitMember -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnitMember -MockWith { return @(@{ Id = '1234567890' }) } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnitScopedRoleMember -MockWith { return @(@{ RoleId = '12345-67890' RoleMemberInfo = @{ @@ -360,8 +360,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { It 'Should call the Set method without removing existing Members or ScopedRoleMembers' { Set-TargetResource @testParams - Should -Not -Invoke -CommandName Remove-MgBetaDirectoryAdministrativeUnitMemberDirectoryObjectByRef - Should -Not -Invoke -CommandName Remove-MgBetaDirectoryAdministrativeUnitScopedRoleMember + Should -Not -Invoke -CommandName Remove-MgDirectoryAdministrativeUnitMemberDirectoryObjectByRef + Should -Not -Invoke -CommandName Remove-MgDirectoryAdministrativeUnitScopedRoleMember } } @@ -383,7 +383,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Credential = $Credential } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnit -MockWith { return [pscustomobject]@{ Description = 'DSCAU2' DisplayName = 'DSCAU2' @@ -411,7 +411,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { It 'Should call the Set method' { Set-TargetResource @testParams - Should -Invoke -CommandName New-MgBetaDirectoryAdministrativeUnitMemberByRef -Exactly 1 + Should -Invoke -CommandName New-MgDirectoryAdministrativeUnitMemberByRef -Exactly 1 } } @@ -433,7 +433,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Credential = $Credential } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnit -MockWith { return [pscustomobject]@{ Description = 'DSCAU2' DisplayName = 'DSCAU2' @@ -460,7 +460,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { It 'Should call the Set method' { Set-TargetResource @testParams - Should -Invoke -CommandName New-MgBetaDirectoryAdministrativeUnitMemberByRef -Exactly 1 + Should -Invoke -CommandName New-MgDirectoryAdministrativeUnitMemberByRef -Exactly 1 } } @@ -482,7 +482,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Credential = $Credential } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnit -MockWith { return [pscustomobject]@{ Description = 'DSCAU2' DisplayName = 'DSCAU2' @@ -509,7 +509,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { It 'Should call the Set method' { Set-TargetResource @testParams - Should -Invoke -CommandName New-MgBetaDirectoryAdministrativeUnitMemberByRef -Exactly 1 + Should -Invoke -CommandName New-MgDirectoryAdministrativeUnitMemberByRef -Exactly 1 } } @@ -535,7 +535,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Credential = $Credential } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnit -MockWith { return [pscustomobject]@{ Description = 'DSCAU' DisplayName = 'DSCAU' @@ -568,7 +568,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } It 'Should call the Set method' { Set-TargetResource @testParams - Should -Invoke -CommandName New-MgBetaDirectoryAdministrativeUnitScopedRoleMember -Exactly 1 + Should -Invoke -CommandName New-MgDirectoryAdministrativeUnitScopedRoleMember -Exactly 1 } } @@ -592,7 +592,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Credential = $Credential } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnit -MockWith { return [pscustomobject]@{ Description = 'DSCAU' DisplayName = 'DSCAU' @@ -625,7 +625,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } It 'Should call the Set method' { Set-TargetResource @testParams - Should -Invoke -CommandName New-MgBetaDirectoryAdministrativeUnitScopedRoleMember -Exactly 1 + Should -Invoke -CommandName New-MgDirectoryAdministrativeUnitScopedRoleMember -Exactly 1 } } @@ -648,7 +648,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Credential = $Credential } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnit -MockWith { return [pscustomobject]@{ Description = 'DSCAU Old Description' DisplayName = 'DSCAU' @@ -703,7 +703,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Credential = $Credential } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnit -MockWith { return [pscustomobject]@{ Description = 'DSCAU' DisplayName = 'DSCAU' @@ -743,7 +743,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } It 'Should call the Set method' { Set-TargetResource @testParams - Should -Invoke -CommandName New-MgBetaDirectoryAdministrativeUnitScopedRoleMember -Exactly 1 + Should -Invoke -CommandName New-MgDirectoryAdministrativeUnitScopedRoleMember -Exactly 1 } } @@ -755,7 +755,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Credential = $Credential } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnit -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnit -MockWith { return @{ Description = 'ExportDSCAU' DisplayName = 'ExportDSCAU' @@ -764,7 +764,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnitMember -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnitMember -MockWith { return [pscustomobject]@{ Id = '1234567890' } @@ -778,7 +778,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } } - Mock -CommandName Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember -MockWith { + Mock -CommandName Get-MgDirectoryAdministrativeUnitScopedRoleMember -MockWith { return @([pscustomobject]@{ RoleId = '12345-67890' RoleMemberInfo = @{ diff --git a/Tests/Unit/Stubs/Microsoft365.psm1 b/Tests/Unit/Stubs/Microsoft365.psm1 index 4f8feade39..ccd34adc5b 100644 --- a/Tests/Unit/Stubs/Microsoft365.psm1 +++ b/Tests/Unit/Stubs/Microsoft365.psm1 @@ -28862,7 +28862,7 @@ function Get-MgBetaDirectory $Break ) } -function Get-MgBetaDirectoryAdministrativeUnit +function Get-MgDirectoryAdministrativeUnit { [CmdletBinding()] param( @@ -28939,7 +28939,7 @@ function Get-MgBetaDirectoryAdministrativeUnit $HttpPipelineAppend ) } -function Get-MgBetaDirectoryAdministrativeUnitMember +function Get-MgDirectoryAdministrativeUnitMember { [CmdletBinding()] param( @@ -29016,7 +29016,7 @@ function Get-MgBetaDirectoryAdministrativeUnitMember $HttpPipelineAppend ) } -function Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember +function Get-MgDirectoryAdministrativeUnitedRoleMember { [CmdletBinding()] param( @@ -29814,7 +29814,7 @@ function New-MgBetaDevice $Kind ) } -function New-MgBetaDirectoryAdministrativeUnit +function New-MgDirectoryAdministrativeUnit { [CmdletBinding()] param( @@ -29891,7 +29891,7 @@ function New-MgBetaDirectoryAdministrativeUnit $HttpPipelineAppend ) } -function New-MgBetaDirectoryAdministrativeUnitMember +function New-MgDirectoryAdministrativeUniter { [CmdletBinding()] param( @@ -29948,7 +29948,7 @@ function New-MgBetaDirectoryAdministrativeUnitMember $Break ) } -function New-MgBetaDirectoryAdministrativeUnitMemberByRef +function New-MgDirectoryAdministrativeUnitMemberByRef { [CmdletBinding()] param( @@ -30005,7 +30005,7 @@ function New-MgBetaDirectoryAdministrativeUnitMemberByRef $Break ) } -function New-MgBetaDirectoryAdministrativeUnitScopedRoleMember +function New-MgDirectoryAdministrativeUnitScopedRoleMember { [CmdletBinding()] param( @@ -30302,7 +30302,7 @@ function Remove-MgBetaDevice $HttpPipelineAppend ) } -function Remove-MgBetaDirectoryAdministrativeUnit +function Remove-MgDirectoryAdministrativeUnit { [CmdletBinding()] param( @@ -30351,7 +30351,7 @@ function Remove-MgBetaDirectoryAdministrativeUnit $Break ) } -function Remove-MgBetaDirectoryAdministrativeUnitMemberDirectoryObjectByRef +function Remove-MgDirectoryAdministrativeUnitMemberDirectoryObjectByRef { [CmdletBinding()] param( @@ -30408,7 +30408,7 @@ function Remove-MgBetaDirectoryAdministrativeUnitMemberDirectoryObjectByRef $Break ) } -function Remove-MgBetaDirectoryAdministrativeUnitScopedRoleMember +function Remove-MgDirectoryAdministrativeUnitedRoleMember { [CmdletBinding()] param( @@ -30991,7 +30991,7 @@ function Update-MgBetaDirectory $HttpPipelineAppend ) } -function Update-MgBetaDirectoryAdministrativeUnit +function Update-MgDirectoryAdministrativeUnit { [CmdletBinding()] param( @@ -61640,7 +61640,7 @@ function Get-MgBetaDirectory $Break ) } -function Get-MgBetaDirectoryAdministrativeUnit +function Get-MgDirectoryAdministrativeUnit { [CmdletBinding()] param( @@ -61717,7 +61717,7 @@ function Get-MgBetaDirectoryAdministrativeUnit $HttpPipelineAppend ) } -function Get-MgBetaDirectoryAdministrativeUnitMember +function Get-MgDirectoryAdministrativeUnit { [CmdletBinding()] param( @@ -61794,7 +61794,7 @@ function Get-MgBetaDirectoryAdministrativeUnitMember $HttpPipelineAppend ) } -function Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember +function Get-MgDirectoryAdministrativeUnitScopedRoleMember { [CmdletBinding()] param( @@ -62791,7 +62791,7 @@ function New-MgBetaDevice $Kind ) } -function New-MgBetaDirectoryAdministrativeUnit +function New-MgDirectoryAdministrativeUnit { [CmdletBinding()] param( @@ -62868,7 +62868,7 @@ function New-MgBetaDirectoryAdministrativeUnit $HttpPipelineAppend ) } -function New-MgBetaDirectoryAdministrativeUnitMember +function New-MgDirectoryAdministrativeUniter { [CmdletBinding()] param( @@ -62925,7 +62925,7 @@ function New-MgBetaDirectoryAdministrativeUnitMember $Break ) } -function New-MgBetaDirectoryAdministrativeUnitMemberByRef +function New-MgDirectoryAdministrativeUnitMemberByRef { [CmdletBinding()] param( @@ -62982,7 +62982,7 @@ function New-MgBetaDirectoryAdministrativeUnitMemberByRef $Break ) } -function New-MgBetaDirectoryAdministrativeUnitScopedRoleMember +function New-MgDirectoryAdministrativeUnitScopedRoleMember { [CmdletBinding()] param( @@ -63332,7 +63332,7 @@ function Remove-MgBetaDevice $HttpPipelineAppend ) } -function Remove-MgBetaDirectoryAdministrativeUnit +function Remove-MgDirectoryAdministrativeUnit { [CmdletBinding()] param( @@ -63381,7 +63381,7 @@ function Remove-MgBetaDirectoryAdministrativeUnit $Break ) } -function Remove-MgBetaDirectoryAdministrativeUnitMemberDirectoryObjectByRef +function Remove-MgDirectoryAdministrativeUniterDirectoryObjectByRef { [CmdletBinding()] param( @@ -63458,7 +63458,7 @@ function Get-MgBetaDirectoryDeletedItemAsGroup ) } -function Remove-MgBetaDirectoryAdministrativeUnitScopedRoleMember +function Remove-MgDirectoryAdministrativeUnitScopedRoleMember { [CmdletBinding()] param( @@ -64090,7 +64090,7 @@ function Update-MgBetaDirectory $HttpPipelineAppend ) } -function Update-MgBetaDirectoryAdministrativeUnit +function Update-MgDirectoryAdministrativeUnit { [CmdletBinding()] param(