Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXOCASMailboxSettings: restore failed after user is deleted #3215

Closed
leitzler opened this issue Apr 25, 2023 · 5 comments
Closed

EXOCASMailboxSettings: restore failed after user is deleted #3215

leitzler opened this issue Apr 25, 2023 · 5 comments

Comments

@leitzler
Copy link

Details of the scenario you tried and the problem that is occurring

I exported a snapshot of a development sandbox tenant (https://developer.microsoft.com/en-us/microsoft-365/dev-program) populated with the default sample data.

Then I removed a few users and ran a restore of the full captured snapshot. The resource EXOCAMailboxSettings failed for all of the removed users.

Verbose logs showing the problem

VERBOSE: [701AE4068A8E]: LCM:  [ Start  Resource ]  [[EXOCASMailboxSettings][email protected]]
VERBOSE: [701AE4068A8E]: LCM:  [ Start  Test     ]  [[EXOCASMailboxSettings][email protected]]
VERBOSE: [701AE4068A8E]:                            [[EXOCASMailboxSettings][email protected]] Testing configuration of Exchange Online CAS Mailbox Settings for
[email protected]
VERBOSE: [701AE4068A8E]:                            [[EXOCASMailboxSettings][email protected]] Getting configuration of Exchange Online CAS Mailbox Settings for
[email protected]
VERBOSE: [701AE4068A8E]:                            [[EXOCASMailboxSettings][email protected]] Current Values: [email protected]
VERBOSE: [701AE4068A8E]:                            [[EXOCASMailboxSettings][email protected]] Target Values: ActiveSyncAllowedDeviceIDs=()
ActiveSyncBlockedDeviceIDs=()
ActiveSyncDebugLogging=False
ActiveSyncEnabled=True
ActiveSyncMailboxPolicy=Default
ActiveSyncSuppressReadReceipt=False
ApplicationId=***
CertificateThumbprint=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
EwsEnabled=True
[email protected]
ImapEnabled=True
ImapForceICalForCalendarRetrievalOption=False
ImapMessagesRetrievalMimeFormat=BestBodyFormat
ImapSuppressReadReceipt=False
ImapUseProtocolDefaults=True
MacOutlookEnabled=True
MAPIEnabled=True
OutlookMobileEnabled=True
OWAEnabled=True
OWAforDevicesEnabled=True
OwaMailboxPolicy=OwaMailboxPolicy-Default
PopEnabled=True
PopForceICalForCalendarRetrievalOption=True
PopMessagesRetrievalMimeFormat=BestBodyFormat
PopSuppressReadReceipt=False
PopUseProtocolDefaults=True
PublicFolderClientAccess=False
ShowGalAsDefaultView=True
TenantId=***
UniversalOutlookEnabled=True
Verbose=True
VERBOSE: [701AE4068A8E]:                            [[EXOCASMailboxSettings][email protected]] Test-TargetResource returned False
VERBOSE: [701AE4068A8E]: LCM:  [ End    Test     ]  [[EXOCASMailboxSettings][email protected]]  in 0.9820 seconds.
VERBOSE: [701AE4068A8E]: LCM:  [ Start  Set      ]  [[EXOCASMailboxSettings][email protected]]
VERBOSE: [701AE4068A8E]:                            [[EXOCASMailboxSettings][email protected]] Setting configuration of Exchange Online CAS Mailbox settings for
[email protected]
VERBOSE: [701AE4068A8E]:                            [[EXOCASMailboxSettings][email protected]] Getting configuration of Exchange Online CAS Mailbox Settings for
[email protected]
VERBOSE: [701AE4068A8E]:                            [[EXOCASMailboxSettings][email protected]] Setting CAS Mailbox settings for [email protected] with values:
ActiveSyncAllowedDeviceIDs=()
ActiveSyncBlockedDeviceIDs=()
ActiveSyncDebugLogging=False
ActiveSyncEnabled=True
ActiveSyncMailboxPolicy=Default
ActiveSyncSuppressReadReceipt=False
EwsEnabled=True
[email protected]
ImapEnabled=True
ImapForceICalForCalendarRetrievalOption=False
ImapMessagesRetrievalMimeFormat=BestBodyFormat
ImapSuppressReadReceipt=False
ImapUseProtocolDefaults=True
MacOutlookEnabled=True
MAPIEnabled=True
OutlookMobileEnabled=True
OWAEnabled=True
OWAforDevicesEnabled=True
OwaMailboxPolicy=OwaMailboxPolicy-Default
PopEnabled=True
PopForceICalForCalendarRetrievalOption=True
PopMessagesRetrievalMimeFormat=BestBodyFormat
PopSuppressReadReceipt=False
PopUseProtocolDefaults=True
PublicFolderClientAccess=False
ShowGalAsDefaultView=True
UniversalOutlookEnabled=True
Verbose=True
VERBOSE: [701AE4068A8E]:                            [[EXOCASMailboxSettings][email protected]] Returning precomputed version info: 3.1.0
VERBOSE: [701AE4068A8E]:                            [[EXOCASMailboxSettings][email protected]] POST
https://outlook.office365.com/adminapi/beta/77777777-7777-7777-7777-777777777777/InvokeCommand with -1-byte payload
VERBOSE: [701AE4068A8E]:                            [[EXOCASMailboxSettings][email protected]] Query 1 failed.
VERBOSE: [701AE4068A8E]:                            [[EXOCASMailboxSettings][email protected]] Getting message from error object
Ex6F9304|Microsoft.Exchange.Configuration.Tasks.ManagementObjectNotFoundException|The operation couldn't be performed because object '[email protected]' couldn't be found on
'SA0PR00A00DC000.NAMPR00A000.PROD.OUTLOOK.COM'.
    + CategoryInfo          : NotSpecified: (:) [], CimException
    + FullyQualifiedErrorId : [Server=DS0PR00MB0000,RequestId=f94d02b9-bb83-ad36-d62c-9b03795855d7,TimeStamp=Fri, 21 Apr 2023 10:10:38 GMT],Write-ErrorMessage
    + PSComputerName        : localhost

VERBOSE: [701AE4068A8E]: LCM:  [ End    Set      ]  [[EXOCASMailboxSettings][email protected]]  in 1.1510 seconds.
The PowerShell DSC resource '[EXOCASMailboxSettings][email protected]' with SourceInfo 'C:\full\M365TenantConfig_Fixed.ps1::9836::9::EXOCASMailboxSettings' threw one or more
non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
    + PSComputerName        : localhost

M365TenantConfig at line 9836:

        EXOCASMailboxSettings "[email protected]"
        {
            ActiveSyncAllowedDeviceIDs              = @();
            ActiveSyncBlockedDeviceIDs              = @();
            ActiveSyncDebugLogging                  = $False;
            ActiveSyncEnabled                       = $True;
            ActiveSyncMailboxPolicy                 = "Default";
            ActiveSyncSuppressReadReceipt           = $False;
            ApplicationId                           = $ConfigurationData.NonNodeData.ApplicationId;
            CertificateThumbprint                   = $ConfigurationData.NonNodeData.CertificateThumbprint;
            EwsEnabled                              = $True;
            Identity                                = "AdeleV@$OrganizationName";
            ImapEnabled                             = $True;
            ImapForceICalForCalendarRetrievalOption = $False;
            ImapMessagesRetrievalMimeFormat         = "BestBodyFormat";
            ImapSuppressReadReceipt                 = $False;
            ImapUseProtocolDefaults                 = $True;
            MacOutlookEnabled                       = $True;
            MAPIEnabled                             = $True;
            OutlookMobileEnabled                    = $True;
            OWAEnabled                              = $True;
            OWAforDevicesEnabled                    = $True;
            OwaMailboxPolicy                        = "OwaMailboxPolicy-Default";
            PopEnabled                              = $True;
            PopForceICalForCalendarRetrievalOption  = $True;
            PopMessagesRetrievalMimeFormat          = "BestBodyFormat";
            PopSuppressReadReceipt                  = $False;
            PopUseProtocolDefaults                  = $True;
            PublicFolderClientAccess                = $False;
            ShowGalAsDefaultView                    = $True;
            TenantId                                = $ConfigurationData.NonNodeData.TenantId;
            UniversalOutlookEnabled                 = $True;
        }

Suggested solution to the issue

Ensure order so the user is restored before, if possible.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

Using Windows Server Core container, mcr.microsoft.com/windows/servercore:1809-amd64.

Install-PackageProvider -Name NuGet -Force
Install-Module Microsoft365DSC -Force
Update-M365DSCDependencies

The operating system the target node is running

OsName               : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US
OsMuiLanguages       : {en-US}
$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.17763.3770
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.3770
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version of the DSC module that was used ('dev' if using current dev branch)

1.23.412.1 Microsoft365DSC                     PSGallery            This DSC module is used to configure and monitor Microsoft tenants, including SharePoint Online, Exchange, Teams, etc.
@andikrueger
Copy link
Collaborator

M365DSC has the challenge to not be able to create the needed mailbox for this mailbox setting within the same resource. The current outcome is expected and the desired behavior. As long as the mailbox is not there, no setting can be applied to it.

Do you also have the users in the same configuration? If yes, then you can add the DependsOn Parameter within the configuration to point to the Mailbox.

MailboxSetting ABC
{
DependsOn = MailBox ABC
}

@NikCharlebois
Copy link
Collaborator

As @andikrueger mentions above, the EXOCASMailboxSettings resource has an "assumed dependency" on the user existing in the tenant. To ensure it does, you will need to include an AADUser item in your config and make sure it gets executed first, either by having it before the EXOCASMailboxSettings resource in the config or by using the DependsOn parameter as mentioned above. Thanks

@leitzler
Copy link
Author

I see, hadn't seen that feature. Would it be possible/make sense if the extraction itself populated dependencies?

@andikrueger
Copy link
Collaborator

Please check out #597 about this feature

@leitzler
Copy link
Author

Ah! One step ahead already 😅 Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants