microsoft / Microsoft365DSC

Manages, configures, extracts and monitors Microsoft 365 tenant configurations
https://aka.ms/M365DSC
MIT License
1.58k stars 496 forks source link

Export-M365DSCConfiguration: Error when trying to export O365OrgSettings #3781

Open ccullum opened 1 year ago

ccullum commented 1 year ago

Description of the issue

When trying to export O365OrgSettings on multiple tenants, I am getting error: System.Net.WebException: The remote server returned an error: (400) Bad Request.

The command I am using: Export-M365DSCConfiguration -Components @("O365AdminAuditLogConfig", "O365OrgCustomizationSetting", "O365OrgSettings", "O365SearchAndIntelligenceConfigurations") -Credential $Credential2 -Path 'C:\Users\user1\OneDrive\Desktop\O365' -FileName 'O365.ps1' -Verbose

Microsoft 365 DSC Version

Current as of today.

Which workloads are affected

Office 365 Admin

The DSC configuration

No response

Verbose logs showing the problem

The output I am getting: 
VERBOSE: No existing connections to Microsoft Graph
Exporting Microsoft 365 configuration for Components: O365OrgSettings

Authentication methods specified:
- Credentials

VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1011.1\DSCResources\MSFT_O365OrgSettings\MSFT_O365OrgSettings.psm1
'.
VERBOSE: Importing function 'Export-TargetResource'.
VERBOSE: Importing function 'Get-TargetResource'.
VERBOSE: Importing function 'Set-TargetResource'.
VERBOSE: Importing function 'Test-TargetResource'.
Connecting to {ExchangeOnline}...Error Acquiring Token:
AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access '00000002-0000-0ff1-ce00-000000000000'.
Trace ID: 4b57e05a-e9b6-49ef-8756-2b79c2a36a00
Correlation ID: 2496e6aa-66e0-4fe5-996f-56278614cd9e
Timestamp: 2023-10-11 21:03:14Z
✅
[1/1] Extracting [O365OrgSettings] using {Credentials}...VERBOSE: Attempting connection to {MicrosoftGraph} with:
VERBOSE:
Name                           Value

----                           -----

Credential                     System.Management.Automation.PSCredential

VERBOSE: Dependencies were not already validated.
VERBOSE: Populating RepositorySourceLocation property for module DSCParser.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\DSCParser\1.3.0.10\modules\DSCParser.psm1'.
VERBOSE: Populating RepositorySourceLocation property for module ExchangeOnlineManagement.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\3.4.0\.\netFramework\ExchangeOnlineManagement.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Applications.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Applications\2.7.0\./Microsoft.Graph.Applications.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Authentication.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Authentication\2.7.0\Microsoft.Graph.Authentication.dll'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Authentication\2.7.0\Microsoft.Graph.Authentication.Core.dll'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Authentication\2.7.0\./Microsoft.Graph.Authentication.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Beta.DeviceManagement.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Beta.DeviceManagement\2.7.0\./Microsoft.Graph.Beta.DeviceManagement.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Beta.Devices.CorporateManagement.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Beta.Devices.CorporateManagement\2.7.0\./Microsoft.Graph.Beta.Devices.CorporateManagement.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Beta.DeviceManagement.Administration.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Beta.DeviceManagement.Administration\2.7.0\./Microsoft.Graph.Beta.DeviceManagement.Administration.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Beta.DeviceManagement.Enrollment.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Beta.DeviceManagement.Enrollment\2.7.0\./Microsoft.Graph.Beta.DeviceManagement.Enrollment.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Beta.Identity.DirectoryManagement.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Beta.Identity.DirectoryManagement\2.7.0\./Microsoft.Graph.Beta.Identity.DirectoryManagement.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Beta.Identity.Governance.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Beta.Identity.Governance\2.7.0\./Microsoft.Graph.Beta.Identity.Governance.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Beta.Identity.SignIns.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Beta.Identity.SignIns\2.7.0\./Microsoft.Graph.Beta.Identity.SignIns.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Beta.Reports.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Beta.Reports\2.7.0\./Microsoft.Graph.Beta.Reports.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Beta.Teams.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Beta.Teams\2.7.0\./Microsoft.Graph.Beta.Teams.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.DeviceManagement.Administration.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.DeviceManagement.Administration\2.7.0\./Microsoft.Graph.DeviceManagement.Administration.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Beta.DirectoryObjects.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Beta.DirectoryObjects\2.7.0\./Microsoft.Graph.Beta.DirectoryObjects.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Groups.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Groups\2.7.0\./Microsoft.Graph.Groups.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Planner.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Planner\2.7.0\./Microsoft.Graph.Planner.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Users.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Users\2.7.0\./Microsoft.Graph.Users.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.Graph.Users.Actions.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.Graph.Users.Actions\2.7.0\./Microsoft.Graph.Users.Actions.psm1'.
VERBOSE: Populating RepositorySourceLocation property for module Microsoft.PowerApps.Administration.PowerShell.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft.PowerApps.Administration.PowerShell\2.0.177\Microsoft.PowerApps.Administration.Powershell.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.7.2 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module MicrosoftTeams.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\5.6.0\./MicrosoftTeams.psm1'.
VERBOSE: Populating RepositorySourceLocation property for module MSCloudLoginAssistant.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\ConnectionProfile.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\Azure.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\AzureAD.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\ExchangeOnline.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\Intune.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\MicrosoftGraph.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\Teams.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\PnP.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\PowerPlatform.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\SecurityCompliance.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\Tasks.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\Teams.psm1'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\MSCloudLoginAssistant.psm1'.
VERBOSE: Cannot verify the Microsoft .NET Framework version 4.6.1 because it is not included in the list of permitted versions.
VERBOSE: Populating RepositorySourceLocation property for module PnP.PowerShell.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\PnP.PowerShell\1.12.0\Framework\PnP.PowerShell.dll'.
VERBOSE: Populating RepositorySourceLocation property for module ReverseDSC.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\ReverseDSC\2.0.0.18\ReverseDSC.Core.psm1'.
VERBOSE: Dependencies were all successfully validated.
VERBOSE: Credential was specified. Connecting via User Principal
VERBOSE: Dependencies were already successfully validated.
VERBOSE: Attempting connection to {MicrosoftGraph} with:
VERBOSE:
Name                           Value

----                           -----

TenantId

ManagedIdentity                False

IsSingleInstance               Yes

ApplicationSecret

Credential                     System.Management.Automation.PSCredential

ApplicationId

CertificateThumbprint

VERBOSE: Dependencies were already successfully validated.
VERBOSE: Credential was specified. Connecting via User Principal
VERBOSE: Attempting connection to {Tasks} with:
VERBOSE:
Name                           Value

----                           -----

TenantId

ManagedIdentity                False

IsSingleInstance               Yes

ApplicationSecret

Credential                     System.Management.Automation.PSCredential

ApplicationId

CertificateThumbprint

VERBOSE: Dependencies were already successfully validated.
VERBOSE: Credential was specified. Connecting via User Principal
❌
 Error Log created at {file://C:/Users/user1/OneDrive/PS-Online/21164-M365DSC-ErrorLog.log}
⌛ Export took {31 seconds}

The error log:
[2023/10/11 02:03:12]
{InvalidOperation}
System.Net.WebException: The remote server returned an error: (400) Bad Request.
   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
"Error during Export:"
at Connect-MSCloudLoginTasksWithUser, C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\Tasks.psm1: line 42
at Connect-MSCloudLoginTasks, C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\Tasks.psm1: line 14
at Connect, C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\ConnectionProfile.psm1: line 572
at Connect-M365Tenant, C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\MSCloudLoginAssistant.psm1: line 335
at New-M365DSCConnection, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1011.1\modules\M365DSCUtil.psm1: line 1745
at Get-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1011.1\DSCResources\MSFT_O365OrgSettings\MSFT_O365OrgSettings.psm1: line 156
at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1011.1\DSCResources\MSFT_O365OrgSettings\MSFT_O365OrgSettings.psm1: line 1045
at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1011.1\modules\M365DSCReverse.psm1: line 615
at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1011.1\modules\M365DSCUtil.psm1: line 1312
at <ScriptBlock>, <No file>: line 1
<admin>@<tenant>.onmicrosoft.com
TenantId: <tenant>.onmicrosoft.com

Environment Information + PowerShell Version

Environment info:
OsName               : Microsoft Windows 11 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 22000.1.amd64fre.co_release.210604-1628
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PSVersion Table:
Name                           Value
----                           -----
PSVersion                      5.1.22000.1335
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22000.1335
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
sdfarquhar commented 1 year ago

It looks like the latest release of Microsoft365DSC is requiring a number of Microsoft.Graph.* modules to be at 2.7.0. It seems all of these dependent modules can be updated to this release except Microsoft.Graph.Authentication and Microsoft.Graph.Applications which show on the PowerShell page that the code level 2.7.0 was retracted by the owner. Do you know when these will be updated?

https://www.powershellgallery.com/packages/Microsoft.Graph.Applications/2.7.0 https://www.powershellgallery.com/packages/Microsoft.Graph.Authentication/2.7.0

andikrueger commented 1 year ago

Please try to run the following cmdlet to update your dependencies:

Update-M365DSCDependencies -force
Uninstall-M365DSCOutdatedDependencies
ccullum commented 1 year ago

Hi @andikrueger , I updated and uninstalled as instructed. I ran the export again, but it looks like it failed again with the same error:

Command Export-M365DSCConfiguration -Components @("O365OrgSettings") -Credential $Credential -Path 'C:\Users\user1\OneDrive\Desktop\O365' -FileName 'O365.ps1' -Verbose

Output Exporting Microsoft 365 configuration for Components: O365OrgSettings

Authentication methods specified:

VERBOSE: Removing the imported "Export-TargetResource" function. VERBOSE: Removing the imported "Get-TargetResource" function. VERBOSE: Removing the imported "Set-TargetResource" function. VERBOSE: Removing the imported "Test-TargetResource" function. VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1011.1\DSCResources\MSFT_O365OrgSettings\MSFT_O365OrgSettings.psm1'. VERBOSE: Importing function 'Export-TargetResource'. VERBOSE: Importing function 'Get-TargetResource'. VERBOSE: Importing function 'Set-TargetResource'. VERBOSE: Importing function 'Test-TargetResource'. Connecting to {ExchangeOnline}...Error Acquiring Token: AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access '00000002-0000-0ff1-ce00-000000000000'. Trace ID: 05418e65-c9b7-4401-9e49-1fa39fa36300 Correlation ID: a44e6eb4-77b1-43ee-859f-9c60fdc3f217 Timestamp: 2023-10-16 14:55:10Z ✅ [1/1] Extracting [O365OrgSettings] using {Credentials}...VERBOSE: Attempting connection to {MicrosoftGraph} with: VERBOSE: Name Value


Credential System.Management.Automation.PSCredential

VERBOSE: Dependencies were already successfully validated. VERBOSE: Credential was specified. Connecting via User Principal VERBOSE: Dependencies were already successfully validated. VERBOSE: Attempting connection to {MicrosoftGraph} with: VERBOSE: Name Value


TenantId

ManagedIdentity False

IsSingleInstance Yes

ApplicationSecret

Credential System.Management.Automation.PSCredential

ApplicationId

CertificateThumbprint

VERBOSE: Dependencies were already successfully validated. VERBOSE: Credential was specified. Connecting via User Principal VERBOSE: Attempting connection to {Tasks} with: VERBOSE: Name Value


TenantId

ManagedIdentity False

IsSingleInstance Yes

ApplicationSecret

Credential System.Management.Automation.PSCredential

ApplicationId

CertificateThumbprint

VERBOSE: Dependencies were already successfully validated. VERBOSE: Credential was specified. Connecting via User Principal ❌ Error Log created at {file://C:/Users/user1/OneDrive/Desktop/O365/6008-M365DSC-ErrorLog.log} ⌛ Export took {11 seconds}

Log [2023/10/16 07:55:21] {InvalidOperation} System.Net.WebException: The remote server returned an error: (400) Bad Request. at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request) at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord() "Error during Export:" at Connect-MSCloudLoginTasksWithUser, C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\Tasks.psm1: line 42 at Connect-MSCloudLoginTasks, C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\Tasks.psm1: line 14 at Connect, C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\ConnectionProfile.psm1: line 572 at Connect-M365Tenant, C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\MSCloudLoginAssistant.psm1: line 335 at New-M365DSCConnection, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1011.1\modules\M365DSCUtil.psm1: line 1745 at Get-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1011.1\DSCResources\MSFT_O365OrgSettings\MSFT_O365OrgSettings.psm1: line 156 at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1011.1\DSCResources\MSFT_O365OrgSettings\MSFT_O365OrgSettings.psm1: line 1045 at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1011.1\modules\M365DSCReverse.psm1: line 615 at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1011.1\modules\M365DSCUtil.psm1: line 1312 at , : line 1

@.onmicrosoft.com TenantId: .onmicrosoft.com
ccullum commented 12 months ago

Hi @andikrueger, I tried updating again today: PS C:\Users\Me\OneDrive\PS-Online> Update-M365DSCDependencies -force Installing DSCParser version {1.3.0.10} Installing ExchangeOnlineManagement version {3.4.0} Installing Microsoft.Graph.Applications version {2.7.0} Installing Microsoft.Graph.Authentication version {2.7.0} Installing Microsoft.Graph.Beta.DeviceManagement version {2.7.0} Installing Microsoft.Graph.Beta.Devices.CorporateManagement version {2.7.0} Installing Microsoft.Graph.Beta.DeviceManagement.Administration version {2.7.0} Installing Microsoft.Graph.Beta.DeviceManagement.Enrollment version {2.7.0} Installing Microsoft.Graph.Beta.Identity.DirectoryManagement version {2.7.0} Installing Microsoft.Graph.Beta.Identity.Governance version {2.7.0} Installing Microsoft.Graph.Beta.Identity.SignIns version {2.7.0} Installing Microsoft.Graph.Beta.Reports version {2.7.0} Installing Microsoft.Graph.Beta.Teams version {2.7.0} Installing Microsoft.Graph.DeviceManagement.Administration version {2.7.0} Installing Microsoft.Graph.Beta.DirectoryObjects version {2.7.0} Installing Microsoft.Graph.Groups version {2.7.0} Installing Microsoft.Graph.Planner version {2.7.0} Installing Microsoft.Graph.Users version {2.7.0} Installing Microsoft.Graph.Users.Actions version {2.7.0} Installing Microsoft.PowerApps.Administration.PowerShell version {2.0.177} Installing MicrosoftTeams version {5.6.0} Installing MSCloudLoginAssistant version {1.0.121} Installing PnP.PowerShell version {1.12.0} Installing ReverseDSC version {2.0.0.18} PS C:\Users\Me\OneDrive\PS-Online> Uninstall-M365DSCOutdatedDependencies Checking Microsoft.Graph.Authentication PS C:\Users\Me\OneDrive\PS-Online>

Here is the command: Export-M365DSCConfiguration -Components @("O365OrgSettings") -Credential $CredMSD -Path 'C:\M365DSC\MSD\O365' -FileName 'msdO365.ps1'

Here is the output: Exporting Microsoft 365 configuration for Components: O365OrgSettings

Authentication methods specified:

Connecting to {ExchangeOnline}...Error Acquiring Token: AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access '00000002-0000-0ff1-ce00-000000000000'. Trace ID: 22a7ed9a-f17f-435b-8609-4a5861c03800 Correlation ID: 8494a3f8-7b83-4d48-873e-5c44c3b2c4fa Timestamp: 2023-10-26 14:59:55Z ✅ [1/1] Extracting [O365OrgSettings] using {Credentials}...❌ Error Log created at {file://C:/M365DSC/MSD/O365/19964-M365DSC-ErrorLog.log} ⌛ Export took {89 seconds}

Here is the content of the log: [2023/10/26 08:01:14] {InvalidOperation} System.Net.WebException: The remote server returned an error: (400) Bad Request. at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request) at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord() "Error during Export:" at Connect-MSCloudLoginTasksWithUser, C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\Tasks.psm1: line 42 at Connect-MSCloudLoginTasks, C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\Workloads\Tasks.psm1: line 14 at Connect, C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\ConnectionProfile.psm1: line 572 at Connect-M365Tenant, C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\MSCloudLoginAssistant.psm1: line 335 at New-M365DSCConnection, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1025.1\modules\M365DSCUtil.psm1: line 1754 at Get-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1025.1\DSCResources\MSFT_O365OrgSettings\MSFT_O365OrgSettings.psm1: line 156 at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1025.1\DSCResources\MSFT_O365OrgSettings\MSFT_O365OrgSettings.psm1: line 1045 at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1025.1\modules\M365DSCReverse.psm1: line 615 at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.1025.1\modules\M365DSCUtil.psm1: line 1321 at , : line 1

@.onmicrosoft.com TenantId: .onmicrosoft.com