From c4cfcde1014251854ef0e7716ad3ba891020735a Mon Sep 17 00:00:00 2001 From: Komal Bachchani Date: Tue, 9 Jan 2024 11:50:10 +0530 Subject: [PATCH 1/2] Remove-AzureADContact beta --- .../Set-EntraDirSyncEnabled.ps1 | 46 +++++++++++++++++++ .../Get-AzureADMSScopedRoleMembership.ps1 | 11 ++++- .../customizations/Remove-AzureADContact.ps1 | 17 +++++++ 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 module/AzureAD/AdditionalFunctions/Set-EntraDirSyncEnabled.ps1 create mode 100644 module/AzureADPreview/customizations/Remove-AzureADContact.ps1 diff --git a/module/AzureAD/AdditionalFunctions/Set-EntraDirSyncEnabled.ps1 b/module/AzureAD/AdditionalFunctions/Set-EntraDirSyncEnabled.ps1 new file mode 100644 index 0000000000..8d15a807dd --- /dev/null +++ b/module/AzureAD/AdditionalFunctions/Set-EntraDirSyncEnabled.ps1 @@ -0,0 +1,46 @@ +function Set-EntraDirSyncEnabled { + [CmdletBinding(DefaultParameterSetName = 'All')] + param ( + [Parameter(ParameterSetName = "All", ValueFromPipelineByPropertyName = $true, Mandatory = $true)][System.Boolean] $EnableDirsync, + [Parameter(ParameterSetName = "All", ValueFromPipelineByPropertyName = $true)][System.Guid] $TenantId, + [switch] $Force + ) + + PROCESS { + $params = @{} + if ($PSBoundParameters.ContainsKey("Verbose")) { + $params["Verbose"] = $Null + } + if ($EnableDirsync -or (-not($EnableDirsync))) { + $params["OnPremisesSyncEnabled"] =$PSBoundParameters["EnableDirsync"] + } + if ($null -ne $PSBoundParameters["TenantId"]) { + $params["OrganizationId"] = $PSBoundParameters["TenantId"] + } + if ([string]::IsNullOrWhiteSpace($TenantId)) { + $OnPremisesDirectorySynchronizationId = (Get-MgDirectoryOnPremiseSynchronization).Id + $params["OrganizationId"] = $OnPremisesDirectorySynchronizationId + } + if ($PSBoundParameters.ContainsKey("Debug")) { + $params["Debug"] = $Null + } + Write-Debug("============================ TRANSFORMATIONS ============================") + $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug + Write-Debug("=========================================================================`n") + + if ($Force) { + $decision = 0 + } + else { + $title = 'Confirm' + $question = 'Do you want to continue?' + $Suspend = New-Object System.Management.Automation.Host.ChoiceDescription "&Suspend", "S" + $Yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Y" + $No = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "S" + $choices = [System.Management.Automation.Host.ChoiceDescription[]]($Yes, $No, $Suspend) + $decision = $Host.UI.PromptForChoice($title, $question, $choices, 1) + } + $response = Update-MgOrganization @params + $response + } +} \ No newline at end of file diff --git a/module/AzureAD/customizations/Get-AzureADMSScopedRoleMembership.ps1 b/module/AzureAD/customizations/Get-AzureADMSScopedRoleMembership.ps1 index 6f4f110c27..57d29f7646 100644 --- a/module/AzureAD/customizations/Get-AzureADMSScopedRoleMembership.ps1 +++ b/module/AzureAD/customizations/Get-AzureADMSScopedRoleMembership.ps1 @@ -3,7 +3,14 @@ # ------------------------------------------------------------------------------ @{ SourceName = "Get-AzureADMSScopedRoleMembership" - TargetName = "Get-MgUserScopedRoleMemberOf" - Parameters = $null + TargetName = "Get-MgDirectoryAdministrativeUnitScopedRoleMember" + Parameters = @( + @{ + SourceName = "Id" + TargetName = "AdministrativeUnitId" + ConversionType = "Name" + SpecialMapping = $null + } + ) Outputs = $null } \ No newline at end of file diff --git a/module/AzureADPreview/customizations/Remove-AzureADContact.ps1 b/module/AzureADPreview/customizations/Remove-AzureADContact.ps1 new file mode 100644 index 0000000000..43e07443c9 --- /dev/null +++ b/module/AzureADPreview/customizations/Remove-AzureADContact.ps1 @@ -0,0 +1,17 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. +# ------------------------------------------------------------------------------ +@{ + SourceName = "Remove-AzureADContact" + TargetName = "Remove-MgBetaContact" + Parameters = @( + @{ + SourceName = "ObjectId" + TargetName = "OrgContactId" + ConversionType = "Name" + SpecialMapping = $null + } + ) + Outputs = $null + CustomScript =$null +} \ No newline at end of file From 915c10e7fc25bc7972d6e0824ffa2d53dab47c93 Mon Sep 17 00:00:00 2001 From: Komal Bachchani Date: Tue, 9 Jan 2024 11:52:37 +0530 Subject: [PATCH 2/2] removing Set-EntraDirSyncEnabled --- .../Set-EntraDirSyncEnabled.ps1 | 46 ------------------- 1 file changed, 46 deletions(-) delete mode 100644 module/AzureAD/AdditionalFunctions/Set-EntraDirSyncEnabled.ps1 diff --git a/module/AzureAD/AdditionalFunctions/Set-EntraDirSyncEnabled.ps1 b/module/AzureAD/AdditionalFunctions/Set-EntraDirSyncEnabled.ps1 deleted file mode 100644 index 8d15a807dd..0000000000 --- a/module/AzureAD/AdditionalFunctions/Set-EntraDirSyncEnabled.ps1 +++ /dev/null @@ -1,46 +0,0 @@ -function Set-EntraDirSyncEnabled { - [CmdletBinding(DefaultParameterSetName = 'All')] - param ( - [Parameter(ParameterSetName = "All", ValueFromPipelineByPropertyName = $true, Mandatory = $true)][System.Boolean] $EnableDirsync, - [Parameter(ParameterSetName = "All", ValueFromPipelineByPropertyName = $true)][System.Guid] $TenantId, - [switch] $Force - ) - - PROCESS { - $params = @{} - if ($PSBoundParameters.ContainsKey("Verbose")) { - $params["Verbose"] = $Null - } - if ($EnableDirsync -or (-not($EnableDirsync))) { - $params["OnPremisesSyncEnabled"] =$PSBoundParameters["EnableDirsync"] - } - if ($null -ne $PSBoundParameters["TenantId"]) { - $params["OrganizationId"] = $PSBoundParameters["TenantId"] - } - if ([string]::IsNullOrWhiteSpace($TenantId)) { - $OnPremisesDirectorySynchronizationId = (Get-MgDirectoryOnPremiseSynchronization).Id - $params["OrganizationId"] = $OnPremisesDirectorySynchronizationId - } - if ($PSBoundParameters.ContainsKey("Debug")) { - $params["Debug"] = $Null - } - Write-Debug("============================ TRANSFORMATIONS ============================") - $params.Keys | ForEach-Object { "$_ : $($params[$_])" } | Write-Debug - Write-Debug("=========================================================================`n") - - if ($Force) { - $decision = 0 - } - else { - $title = 'Confirm' - $question = 'Do you want to continue?' - $Suspend = New-Object System.Management.Automation.Host.ChoiceDescription "&Suspend", "S" - $Yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Y" - $No = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "S" - $choices = [System.Management.Automation.Host.ChoiceDescription[]]($Yes, $No, $Suspend) - $decision = $Host.UI.PromptForChoice($title, $question, $choices, 1) - } - $response = Update-MgOrganization @params - $response - } -} \ No newline at end of file