From 52ee8b5d5b40357455607019fe20893e68a743cc Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Fri, 22 Sep 2023 12:49:00 -0400 Subject: [PATCH 1/2] AADApplication Soft Delete Support --- CHANGELOG.md | 3 +- .../MSFT_AADApplication.psm1 | 49 +++++++++++++++++-- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bee760f578..b9b1e574fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,13 @@ # UNRELEASED +* AADApplication + * Added support for restoring soft deleted instances. * O365OrgSettings * Changes to how ToDo discrepencies are being fixed in the SET method. * DEPENDENCIES * Updated Microsoft.Graph to version 2.6.1. - # 1.23.920.2 * DEPENDENCIES diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADApplication/MSFT_AADApplication.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADApplication/MSFT_AADApplication.psm1 index 1b1bb7df6f..22ee0b25c3 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADApplication/MSFT_AADApplication.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADApplication/MSFT_AADApplication.psm1 @@ -421,7 +421,44 @@ function Set-TargetResource $currentParameters.Remove('LogoutURL') | Out-Null $currentParameters.Remove('Homepage') | Out-Null + $skipToUpdate = $false + $AppIdValue = $null if ($Ensure -eq 'Present' -and $currentAADApp.Ensure -eq 'Absent') + { + # Before attempting to create a new instance, let's first check to see if there is already an existing instance that is soft deleted + if (-not [System.String]::IsNullOrEmpty($AppId)) + { + Write-Verbose "Trying to retrieve existing deleted Applications from soft delete by Id {$AppId}." + [Array]$deletedApp = Get-MgBetaDirectoryDeletedApplication -DirectoryObjectId $AppId -ErrorAction SilentlyContinue + } + + if ($null -eq $deletedApp) + { + Write-Verbose "Trying to retrieve existing deleted Applications from soft delete by DisplayName {$DisplayName}." + [Array]$deletedApp = Get-MgBetaDirectoryDeletedApplication -Filter "DisplayName eq '$DisplayName'" -ErrorAction SilentlyContinue + } + + if ($null -ne $deletedApp -and $deletedApp.Length -eq 1) + { + $deletedSinceInDays = [System.DateTime]::Now.Subtract($deletedApp[0].DeletedDateTime).Days + if ($deletedSinceInDays -le 30) + { + Write-Verbose -Message "Found existing deleted instance of {$DisplayName}. Restoring it instead of creating a new one. This could take a few minutes to complete." + Restore-MgBetaDirectoryDeletedItem -DirectoryObjectId $deletedApp.Id + $skipToUpdate = $true + $AppIdValue = $deletedApp.Id + } + else + { + Write-Verbose -Message "Found existing deleted instance of {$DisplayName}. However, the deleted date was over days ago and it cannot be restored. Will recreate a new instance instead." + } + } + elseif ($deletedApp.Length -gt 1) + { + Write-Verbose -Message "Multiple instances of a deleted application with name {$DisplayName} wehre found. Creating a new instance since we can't determine what instance to restore." + } + } + if ($Ensure -eq 'Present' -and $currentAADApp.Ensure -eq 'Absent' -and -not $skipToUpdate) { Write-Verbose -Message "Creating New AzureAD Application {$DisplayName} with values:`r`n$($currentParameters | Out-String)" $currentParameters.Remove('ObjectId') | Out-Null @@ -441,14 +478,18 @@ function Set-TargetResource } # App should exist and will be configured to desired state - if ($Ensure -eq 'Present' -and $currentAADApp.Ensure -eq 'Present') + elseif (($Ensure -eq 'Present' -and $currentAADApp.Ensure -eq 'Present') -or $skipToUpdate) { $currentParameters.Remove('ObjectId') | Out-Null - $currentParameters.Add('ApplicationId', $currentAADApp.ObjectId) + if (-not $skipToUpdate) + { + $AppIdValue = $currentAADApp.ObjectId + } + $currentParameters.Add('ApplicationId', $AppIdValue) Write-Verbose -Message "Updating existing AzureAD Application {$DisplayName} with values:`r`n$($currentParameters | Out-String)" Update-MgApplication @currentParameters - $currentAADApp.Add('ID', $currentAADApp.ObjectId) + $currentAADApp.Add('ID', $AppIdValue) $needToUpdatePermissions = $true } # App exists but should not @@ -815,7 +856,7 @@ function Export-TargetResource $ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' ` -InboundParameters $PSBoundParameters - + $dscContent = [System.Text.StringBuilder]::new() $i = 1 Write-Host "`r`n" -NoNewline From 812ea210b0fa2343a59ae2ad354afd6a493e8b42 Mon Sep 17 00:00:00 2001 From: Nik Charlebois Date: Fri, 22 Sep 2023 15:01:37 -0400 Subject: [PATCH 2/2] Fixes --- .../MSFT_AADApplication.psm1 | 4 +- .../Microsoft365DSC.AADApplication.Tests.ps1 | 3 + Tests/Unit/Stubs/Microsoft365.psm1 | 679 ++++++++++++++---- 3 files changed, 550 insertions(+), 136 deletions(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_AADApplication/MSFT_AADApplication.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_AADApplication/MSFT_AADApplication.psm1 index 22ee0b25c3..f91d1f061f 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_AADApplication/MSFT_AADApplication.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_AADApplication/MSFT_AADApplication.psm1 @@ -429,13 +429,13 @@ function Set-TargetResource if (-not [System.String]::IsNullOrEmpty($AppId)) { Write-Verbose "Trying to retrieve existing deleted Applications from soft delete by Id {$AppId}." - [Array]$deletedApp = Get-MgBetaDirectoryDeletedApplication -DirectoryObjectId $AppId -ErrorAction SilentlyContinue + [Array]$deletedApp = Get-MgBetaDirectoryDeletedItemAsApplication -DirectoryObjectId $AppId -ErrorAction SilentlyContinue } if ($null -eq $deletedApp) { Write-Verbose "Trying to retrieve existing deleted Applications from soft delete by DisplayName {$DisplayName}." - [Array]$deletedApp = Get-MgBetaDirectoryDeletedApplication -Filter "DisplayName eq '$DisplayName'" -ErrorAction SilentlyContinue + [Array]$deletedApp = Get-MgBetaDirectoryDeletedItemAsApplication -Filter "DisplayName eq '$DisplayName'" -ErrorAction SilentlyContinue } if ($null -ne $deletedApp -and $deletedApp.Length -eq 1) diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADApplication.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADApplication.Tests.ps1 index aaefe7f454..07b9c9254c 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADApplication.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.AADApplication.Tests.ps1 @@ -38,6 +38,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgApplication -MockWith { } + Mock -CommandName MgBetaDirectoryDeletedItemAsApplication -MockWith { + } + Mock -CommandName New-MgApplication -MockWith { return @{ ID = '12345-12345-12345-12345-12345' diff --git a/Tests/Unit/Stubs/Microsoft365.psm1 b/Tests/Unit/Stubs/Microsoft365.psm1 index 8d2c788a14..5ae21ddbc4 100644 --- a/Tests/Unit/Stubs/Microsoft365.psm1 +++ b/Tests/Unit/Stubs/Microsoft365.psm1 @@ -23546,10 +23546,6 @@ function New-MgBetaDevice [PSObject] $Extensions, - [Parameter()] - [System.DateTime] - $OnPremisesLastSyncDateTime, - [Parameter()] [PSObject] $AlternativeSecurityIds, @@ -23562,6 +23558,10 @@ function New-MgBetaDevice [PSObject] $Commands, + [Parameter()] + [System.String] + $OnPremisesSecurityIdentifier, + [Parameter()] [System.String] $OperatingSystemVersion, @@ -23571,8 +23571,8 @@ function New-MgBetaDevice $Id, [Parameter()] - [PSObject] - $HttpPipelineAppend, + [System.DateTime] + $OnPremisesLastSyncDateTime, [Parameter()] [System.String] @@ -23594,6 +23594,10 @@ function New-MgBetaDevice [System.String] $ProfileType, + [Parameter()] + [PSObject] + $ExtensionAttributes, + [Parameter()] [System.Management.Automation.SwitchParameter] $OnPremisesSyncEnabled, @@ -23662,6 +23666,10 @@ function New-MgBetaDevice [System.Management.Automation.PSCredential] $ProxyCredential, + [Parameter()] + [PSObject] + $HttpPipelineAppend, + [Parameter()] [System.String] $OperatingSystem, @@ -23674,10 +23682,6 @@ function New-MgBetaDevice [System.String] $DeviceOwnership, - [Parameter()] - [PSObject] - $ExtensionAttributes, - [Parameter()] [System.DateTime] $ApproximateLastSignInDateTime, @@ -23759,14 +23763,6 @@ function New-MgBetaDirectoryAdministrativeUnit [System.Management.Automation.SwitchParameter] $IsMemberManagementRestricted, - [Parameter()] - [System.Management.Automation.PSCredential] - $ProxyCredential, - - [Parameter()] - [System.String] - $Visibility, - [Parameter()] [PSObject] $ScopedRoleMembers, @@ -23795,6 +23791,14 @@ function New-MgBetaDirectoryAdministrativeUnit [PSObject] $Extensions, + [Parameter()] + [System.Management.Automation.PSCredential] + $ProxyCredential, + + [Parameter()] + [System.String] + $Visibility, + [Parameter()] [System.DateTime] $DeletedDateTime, @@ -23808,6 +23812,63 @@ function New-MgBetaDirectoryAdministrativeUnit $HttpPipelineAppend ) } +function New-MgBetaDirectoryAdministrativeUnitMember +{ + [CmdletBinding()] + param( + [Parameter()] + [System.DateTime] + $DeletedDateTime, + + [Parameter()] + [System.String] + $Id, + + [Parameter()] + [PSObject] + $HttpPipelinePrepend, + + [Parameter()] + [PSObject] + $BodyParameter, + + [Parameter()] + [System.Uri] + $Proxy, + + [Parameter()] + [System.Management.Automation.PSCredential] + $ProxyCredential, + + [Parameter()] + [System.String] + $AdministrativeUnitId, + + [Parameter()] + [PSObject] + $InputObject, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $Confirm, + + [Parameter()] + [PSObject] + $HttpPipelineAppend, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $ProxyUseDefaultCredentials, + + [Parameter()] + [System.Collections.Hashtable] + $AdditionalProperties, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $Break + ) +} function New-MgBetaDirectoryAdministrativeUnitMemberByRef { [CmdletBinding()] @@ -24476,6 +24537,47 @@ function Remove-MgBetaDirectorySetting $HttpPipelineAppend ) } +function Restore-MgBetaDirectoryDeletedItem +{ + [CmdletBinding()] + param( + [Parameter()] + [PSObject] + $HttpPipelinePrepend, + + [Parameter()] + [System.Uri] + $Proxy, + + [Parameter()] + [System.Management.Automation.PSCredential] + $ProxyCredential, + + [Parameter()] + [PSObject] + $InputObject, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $Confirm, + + [Parameter()] + [PSObject] + $HttpPipelineAppend, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $ProxyUseDefaultCredentials, + + [Parameter()] + [System.String] + $DirectoryObjectId, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $Break + ) +} function Update-MgBetaDevice { [CmdletBinding()] @@ -24532,6 +24634,10 @@ function Update-MgBetaDevice [PSObject] $Commands, + [Parameter()] + [System.String] + $OnPremisesSecurityIdentifier, + [Parameter()] [System.String] $OperatingSystemVersion, @@ -24753,6 +24859,10 @@ function Update-MgBetaDirectory [PSObject] $AttributeSets, + [Parameter()] + [PSObject] + $Subscriptions, + [Parameter()] [System.Uri] $Proxy, @@ -24834,10 +24944,6 @@ function Update-MgBetaDirectoryAdministrativeUnit [System.Management.Automation.SwitchParameter] $IsMemberManagementRestricted, - [Parameter()] - [System.String] - $Visibility, - [Parameter()] [PSObject] $ScopedRoleMembers, @@ -24870,6 +24976,10 @@ function Update-MgBetaDirectoryAdministrativeUnit [System.Management.Automation.PSCredential] $ProxyCredential, + [Parameter()] + [System.String] + $Visibility, + [Parameter()] [System.DateTime] $DeletedDateTime, @@ -24903,10 +25013,6 @@ function Update-MgBetaDirectorySetting [System.String] $DisplayName, - [Parameter()] - [PSObject] - $InputObject, - [Parameter()] [System.Collections.Hashtable] $AdditionalProperties, @@ -24923,6 +25029,10 @@ function Update-MgBetaDirectorySetting [System.String] $TemplateId, + [Parameter()] + [PSObject] + $InputObject, + [Parameter()] [System.Uri] $Proxy, @@ -24996,6 +25106,10 @@ function Update-MgBetaOrganization [PSObject] $PartnerInformation, + [Parameter()] + [System.Management.Automation.SwitchParameter] + $ProxyUseDefaultCredentials, + [Parameter()] [System.Collections.Hashtable] $AdditionalProperties, @@ -25060,6 +25174,10 @@ function Update-MgBetaOrganization [System.Management.Automation.SwitchParameter] $Confirm, + [Parameter()] + [PSObject] + $CertificateBasedAuthConfiguration, + [Parameter()] [System.String[]] $TechnicalNotificationMails, @@ -25080,6 +25198,10 @@ function Update-MgBetaOrganization [System.DateTime] $OnPremisesLastSyncDateTime, + [Parameter()] + [System.DateTime] + $DeletedDateTime, + [Parameter()] [PSObject] $ProvisionedPlans, @@ -25089,17 +25211,13 @@ function Update-MgBetaOrganization $DirectorySizeQuota, [Parameter()] - [PSObject] - $CertificateBasedAuthConfiguration, + [System.DateTime] + $OnPremisesLastPasswordSyncDateTime, [Parameter()] [PSObject] $Branding, - [Parameter()] - [System.DateTime] - $DeletedDateTime, - [Parameter()] [System.String] $CountryLetterCode, @@ -25120,10 +25238,6 @@ function Update-MgBetaOrganization [System.String] $OrganizationId, - [Parameter()] - [System.Management.Automation.SwitchParameter] - $ProxyUseDefaultCredentials, - [Parameter()] [System.String[]] $SecurityComplianceNotificationPhones, @@ -25145,10 +25259,6 @@ function Update-MgBetaOrganizationSetting [PSObject] $ItemInsights, - [Parameter()] - [PSObject] - $ProfileCardProperties, - [Parameter()] [PSObject] $MicrosoftApplicationDataAccess, @@ -25181,10 +25291,6 @@ function Update-MgBetaOrganizationSetting [System.String] $Id, - [Parameter()] - [PSObject] - $Pronouns, - [Parameter()] [System.Management.Automation.SwitchParameter] $Confirm, @@ -25215,8 +25321,8 @@ function Update-MgBetaOrganizationSettingItemInsight [CmdletBinding()] param( [Parameter()] - [System.String] - $DisabledForGroup, + [System.Management.Automation.SwitchParameter] + $Confirm, [Parameter()] [System.String] @@ -25246,10 +25352,6 @@ function Update-MgBetaOrganizationSettingItemInsight [System.String] $OrganizationId, - [Parameter()] - [System.Management.Automation.SwitchParameter] - $Confirm, - [Parameter()] [PSObject] $HttpPipelineAppend, @@ -25262,6 +25364,10 @@ function Update-MgBetaOrganizationSettingItemInsight [System.Management.Automation.SwitchParameter] $IsEnabledInOrganization, + [Parameter()] + [System.String] + $DisabledForGroup, + [Parameter()] [System.Collections.Hashtable] $AdditionalProperties, @@ -25276,8 +25382,8 @@ function Update-MgBetaOrganizationSettingPersonInsight [CmdletBinding()] param( [Parameter()] - [System.String] - $DisabledForGroup, + [System.Management.Automation.SwitchParameter] + $Confirm, [Parameter()] [System.String] @@ -25307,10 +25413,6 @@ function Update-MgBetaOrganizationSettingPersonInsight [System.String] $OrganizationId, - [Parameter()] - [System.Management.Automation.SwitchParameter] - $Confirm, - [Parameter()] [PSObject] $HttpPipelineAppend, @@ -25323,6 +25425,10 @@ function Update-MgBetaOrganizationSettingPersonInsight [System.Management.Automation.SwitchParameter] $IsEnabledInOrganization, + [Parameter()] + [System.String] + $DisabledForGroup, + [Parameter()] [System.Collections.Hashtable] $AdditionalProperties, @@ -25332,6 +25438,83 @@ function Update-MgBetaOrganizationSettingPersonInsight $Break ) } +function Get-MgBetaDirectoryDeletedApplication +{ + [CmdletBinding()] + param( + [Parameter()] + [System.String[]] + $Property, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $ProxyUseDefaultCredentials, + + [Parameter()] + [System.Int32] + $PageSize, + + [Parameter()] + [PSObject] + $HttpPipelinePrepend, + + [Parameter()] + [System.Int32] + $Skip, + + [Parameter()] + [PSObject] + $InputObject, + + [Parameter()] + [System.Int32] + $Top, + + [Parameter()] + [System.String] + $CountVariable, + + [Parameter()] + [System.Uri] + $Proxy, + + [Parameter()] + [System.String[]] + $Sort, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $All, + + [Parameter()] + [System.String] + $Filter, + + [Parameter()] + [System.Management.Automation.PSCredential] + $ProxyCredential, + + [Parameter()] + [System.String] + $Search, + + [Parameter()] + [System.String] + $DirectoryObjectId, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $Break, + + [Parameter()] + [System.String[]] + $ExpandProperty, + + [Parameter()] + [PSObject] + $HttpPipelineAppend + ) +} #endregion #region Microsoft.Graph.Beta.Identity.Governance function Get-MgBetaAgreement @@ -48520,45 +48703,163 @@ function Get-MgBetaDirectoryAdministrativeUnitMember $Filter, [Parameter()] - [System.Management.Automation.PSCredential] - $ProxyCredential, + [System.Management.Automation.PSCredential] + $ProxyCredential, + + [Parameter()] + [System.String] + $Search, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $Break, + + [Parameter()] + [System.String[]] + $ExpandProperty, + + [Parameter()] + [PSObject] + $HttpPipelineAppend + ) +} +function Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember +{ + [CmdletBinding()] + param( + [Parameter()] + [System.String] + $AdministrativeUnitId, + + [Parameter()] + [System.String[]] + $Property, + + [Parameter()] + [PSObject] + $InputObject, + + [Parameter()] + [System.String] + $ScopedRoleMembershipId, + + [Parameter()] + [System.Int32] + $PageSize, + + [Parameter()] + [PSObject] + $HttpPipelinePrepend, + + [Parameter()] + [System.Int32] + $Skip, + + [Parameter()] + [System.Int32] + $Top, + + [Parameter()] + [System.String] + $CountVariable, + + [Parameter()] + [System.Uri] + $Proxy, + + [Parameter()] + [System.String[]] + $Sort, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $All, + + [Parameter()] + [System.String] + $Filter, + + [Parameter()] + [System.Management.Automation.PSCredential] + $ProxyCredential, + + [Parameter()] + [System.String] + $Search, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $Break, + + [Parameter()] + [System.String[]] + $ExpandProperty, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $ProxyUseDefaultCredentials, + + [Parameter()] + [PSObject] + $HttpPipelineAppend + ) +} +function Get-MgBetaDirectoryDeletedItem +{ + [CmdletBinding()] + param( + [Parameter()] + [PSObject] + $HttpPipelinePrepend, + + [Parameter()] + [System.Uri] + $Proxy, + + [Parameter()] + [System.Management.Automation.PSCredential] + $ProxyCredential, + + [Parameter()] + [PSObject] + $InputObject, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $ProxyUseDefaultCredentials, [Parameter()] [System.String] - $Search, + $DirectoryObjectId, [Parameter()] - [System.Management.Automation.SwitchParameter] - $Break, + [System.String[]] + $ExpandProperty, [Parameter()] [System.String[]] - $ExpandProperty, + $Property, [Parameter()] [PSObject] - $HttpPipelineAppend + $HttpPipelineAppend, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $Break ) } -function Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember +function Get-MgBetaDirectoryDeletedItemAsApplication { [CmdletBinding()] param( - [Parameter()] - [System.String] - $AdministrativeUnitId, - [Parameter()] [System.String[]] $Property, [Parameter()] - [PSObject] - $InputObject, - - [Parameter()] - [System.String] - $ScopedRoleMembershipId, + [System.Management.Automation.SwitchParameter] + $ProxyUseDefaultCredentials, [Parameter()] [System.Int32] @@ -48572,6 +48873,10 @@ function Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember [System.Int32] $Skip, + [Parameter()] + [PSObject] + $InputObject, + [Parameter()] [System.Int32] $Top, @@ -48604,6 +48909,10 @@ function Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember [System.String] $Search, + [Parameter()] + [System.String] + $DirectoryObjectId, + [Parameter()] [System.Management.Automation.SwitchParameter] $Break, @@ -48612,10 +48921,6 @@ function Get-MgBetaDirectoryAdministrativeUnitScopedRoleMember [System.String[]] $ExpandProperty, - [Parameter()] - [System.Management.Automation.SwitchParameter] - $ProxyUseDefaultCredentials, - [Parameter()] [PSObject] $HttpPipelineAppend @@ -49149,10 +49454,6 @@ function New-MgBetaDevice [PSObject] $Extensions, - [Parameter()] - [System.DateTime] - $OnPremisesLastSyncDateTime, - [Parameter()] [PSObject] $AlternativeSecurityIds, @@ -49165,6 +49466,10 @@ function New-MgBetaDevice [PSObject] $Commands, + [Parameter()] + [System.String] + $OnPremisesSecurityIdentifier, + [Parameter()] [System.String] $OperatingSystemVersion, @@ -49174,8 +49479,8 @@ function New-MgBetaDevice $Id, [Parameter()] - [PSObject] - $HttpPipelineAppend, + [System.DateTime] + $OnPremisesLastSyncDateTime, [Parameter()] [System.String] @@ -49197,6 +49502,10 @@ function New-MgBetaDevice [System.String] $ProfileType, + [Parameter()] + [PSObject] + $ExtensionAttributes, + [Parameter()] [System.Management.Automation.SwitchParameter] $OnPremisesSyncEnabled, @@ -49265,6 +49574,10 @@ function New-MgBetaDevice [System.Management.Automation.PSCredential] $ProxyCredential, + [Parameter()] + [PSObject] + $HttpPipelineAppend, + [Parameter()] [System.String] $OperatingSystem, @@ -49277,10 +49590,6 @@ function New-MgBetaDevice [System.String] $DeviceOwnership, - [Parameter()] - [PSObject] - $ExtensionAttributes, - [Parameter()] [System.DateTime] $ApproximateLastSignInDateTime, @@ -49362,14 +49671,6 @@ function New-MgBetaDirectoryAdministrativeUnit [System.Management.Automation.SwitchParameter] $IsMemberManagementRestricted, - [Parameter()] - [System.Management.Automation.PSCredential] - $ProxyCredential, - - [Parameter()] - [System.String] - $Visibility, - [Parameter()] [PSObject] $ScopedRoleMembers, @@ -49398,6 +49699,14 @@ function New-MgBetaDirectoryAdministrativeUnit [PSObject] $Extensions, + [Parameter()] + [System.Management.Automation.PSCredential] + $ProxyCredential, + + [Parameter()] + [System.String] + $Visibility, + [Parameter()] [System.DateTime] $DeletedDateTime, @@ -49411,6 +49720,63 @@ function New-MgBetaDirectoryAdministrativeUnit $HttpPipelineAppend ) } +function New-MgBetaDirectoryAdministrativeUnitMember +{ + [CmdletBinding()] + param( + [Parameter()] + [System.DateTime] + $DeletedDateTime, + + [Parameter()] + [System.String] + $Id, + + [Parameter()] + [PSObject] + $HttpPipelinePrepend, + + [Parameter()] + [PSObject] + $BodyParameter, + + [Parameter()] + [System.Uri] + $Proxy, + + [Parameter()] + [System.Management.Automation.PSCredential] + $ProxyCredential, + + [Parameter()] + [System.String] + $AdministrativeUnitId, + + [Parameter()] + [PSObject] + $InputObject, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $Confirm, + + [Parameter()] + [PSObject] + $HttpPipelineAppend, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $ProxyUseDefaultCredentials, + + [Parameter()] + [System.Collections.Hashtable] + $AdditionalProperties, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $Break + ) +} function New-MgBetaDirectoryAdministrativeUnitMemberByRef { [CmdletBinding()] @@ -50079,6 +50445,47 @@ function Remove-MgBetaDirectorySetting $HttpPipelineAppend ) } +function Restore-MgBetaDirectoryDeletedItem +{ + [CmdletBinding()] + param( + [Parameter()] + [PSObject] + $HttpPipelinePrepend, + + [Parameter()] + [System.Uri] + $Proxy, + + [Parameter()] + [System.Management.Automation.PSCredential] + $ProxyCredential, + + [Parameter()] + [PSObject] + $InputObject, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $Confirm, + + [Parameter()] + [PSObject] + $HttpPipelineAppend, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $ProxyUseDefaultCredentials, + + [Parameter()] + [System.String] + $DirectoryObjectId, + + [Parameter()] + [System.Management.Automation.SwitchParameter] + $Break + ) +} function Update-MgBetaDevice { [CmdletBinding()] @@ -50135,6 +50542,10 @@ function Update-MgBetaDevice [PSObject] $Commands, + [Parameter()] + [System.String] + $OnPremisesSecurityIdentifier, + [Parameter()] [System.String] $OperatingSystemVersion, @@ -50356,6 +50767,10 @@ function Update-MgBetaDirectory [PSObject] $AttributeSets, + [Parameter()] + [PSObject] + $Subscriptions, + [Parameter()] [System.Uri] $Proxy, @@ -50437,10 +50852,6 @@ function Update-MgBetaDirectoryAdministrativeUnit [System.Management.Automation.SwitchParameter] $IsMemberManagementRestricted, - [Parameter()] - [System.String] - $Visibility, - [Parameter()] [PSObject] $ScopedRoleMembers, @@ -50473,6 +50884,10 @@ function Update-MgBetaDirectoryAdministrativeUnit [System.Management.Automation.PSCredential] $ProxyCredential, + [Parameter()] + [System.String] + $Visibility, + [Parameter()] [System.DateTime] $DeletedDateTime, @@ -50506,10 +50921,6 @@ function Update-MgBetaDirectorySetting [System.String] $DisplayName, - [Parameter()] - [PSObject] - $InputObject, - [Parameter()] [System.Collections.Hashtable] $AdditionalProperties, @@ -50526,6 +50937,10 @@ function Update-MgBetaDirectorySetting [System.String] $TemplateId, + [Parameter()] + [PSObject] + $InputObject, + [Parameter()] [System.Uri] $Proxy, @@ -50599,6 +51014,10 @@ function Update-MgBetaOrganization [PSObject] $PartnerInformation, + [Parameter()] + [System.Management.Automation.SwitchParameter] + $ProxyUseDefaultCredentials, + [Parameter()] [System.Collections.Hashtable] $AdditionalProperties, @@ -50663,6 +51082,10 @@ function Update-MgBetaOrganization [System.Management.Automation.SwitchParameter] $Confirm, + [Parameter()] + [PSObject] + $CertificateBasedAuthConfiguration, + [Parameter()] [System.String[]] $TechnicalNotificationMails, @@ -50683,6 +51106,10 @@ function Update-MgBetaOrganization [System.DateTime] $OnPremisesLastSyncDateTime, + [Parameter()] + [System.DateTime] + $DeletedDateTime, + [Parameter()] [PSObject] $ProvisionedPlans, @@ -50692,17 +51119,13 @@ function Update-MgBetaOrganization $DirectorySizeQuota, [Parameter()] - [PSObject] - $CertificateBasedAuthConfiguration, + [System.DateTime] + $OnPremisesLastPasswordSyncDateTime, [Parameter()] [PSObject] $Branding, - [Parameter()] - [System.DateTime] - $DeletedDateTime, - [Parameter()] [System.String] $CountryLetterCode, @@ -50723,10 +51146,6 @@ function Update-MgBetaOrganization [System.String] $OrganizationId, - [Parameter()] - [System.Management.Automation.SwitchParameter] - $ProxyUseDefaultCredentials, - [Parameter()] [System.String[]] $SecurityComplianceNotificationPhones, @@ -50748,10 +51167,6 @@ function Update-MgBetaOrganizationSetting [PSObject] $ItemInsights, - [Parameter()] - [PSObject] - $ProfileCardProperties, - [Parameter()] [PSObject] $MicrosoftApplicationDataAccess, @@ -50784,10 +51199,6 @@ function Update-MgBetaOrganizationSetting [System.String] $Id, - [Parameter()] - [PSObject] - $Pronouns, - [Parameter()] [System.Management.Automation.SwitchParameter] $Confirm, @@ -50818,8 +51229,8 @@ function Update-MgBetaOrganizationSettingItemInsight [CmdletBinding()] param( [Parameter()] - [System.String] - $DisabledForGroup, + [System.Management.Automation.SwitchParameter] + $Confirm, [Parameter()] [System.String] @@ -50849,10 +51260,6 @@ function Update-MgBetaOrganizationSettingItemInsight [System.String] $OrganizationId, - [Parameter()] - [System.Management.Automation.SwitchParameter] - $Confirm, - [Parameter()] [PSObject] $HttpPipelineAppend, @@ -50865,6 +51272,10 @@ function Update-MgBetaOrganizationSettingItemInsight [System.Management.Automation.SwitchParameter] $IsEnabledInOrganization, + [Parameter()] + [System.String] + $DisabledForGroup, + [Parameter()] [System.Collections.Hashtable] $AdditionalProperties, @@ -50879,8 +51290,8 @@ function Update-MgBetaOrganizationSettingPersonInsight [CmdletBinding()] param( [Parameter()] - [System.String] - $DisabledForGroup, + [System.Management.Automation.SwitchParameter] + $Confirm, [Parameter()] [System.String] @@ -50910,10 +51321,6 @@ function Update-MgBetaOrganizationSettingPersonInsight [System.String] $OrganizationId, - [Parameter()] - [System.Management.Automation.SwitchParameter] - $Confirm, - [Parameter()] [PSObject] $HttpPipelineAppend, @@ -50926,6 +51333,10 @@ function Update-MgBetaOrganizationSettingPersonInsight [System.Management.Automation.SwitchParameter] $IsEnabledInOrganization, + [Parameter()] + [System.String] + $DisabledForGroup, + [Parameter()] [System.Collections.Hashtable] $AdditionalProperties,