microsoft / Microsoft365DSC

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

Connecting to {PnP}...❌ Error #3933

Open pradeepmnrecit opened 9 months ago

pradeepmnrecit commented 9 months ago

Description of the issue

Dear All While i run the PS file getting the below error,Kindly help.

PS C:\DSC> .\M365TenantConfig.ps1

PowerShell credential request Enter your credentials. User: admin@NETORGFT15046993.onmicrosoft.com Password for user admin@NETORGFT15046993.onmicrosoft.com: **

Exporting Microsoft 365 configuration for Components: AADAdministrativeUnit, AADApplication, AADAttributeSet, AADAuthenticationContextClassReference, AADAuthenticationMethodPolicy, AADAuthenticationMethodPolicyAuthenticator, AADAuthenticationMethodPolicyEmail, AADAuthenticationMethodPolicyFido2, AADAuthenticationMethodPolicySms, AADAuthenticationMethodPolicySoftware, AADAuthenticationMethodPolicyTemporary, AADAuthenticationMethodPolicyVoice, AADAuthenticationMethodPolicyX509, AADAuthenticationStrengthPolicy, AADAuthorizationPolicy, AADConditionalAccessPolicy, AADCrossTenantAccessPolicy, AADCrossTenantAccessPolicyConfigurationDefault, AADCrossTenantAccessPolicyConfigurationPartner, AADEntitlementManagementAccessPackage, AADEntitlementManagementAccessPackageAssignmentPolicy, AADEntitlementManagementAccessPackageCatalog, AADEntitlementManagementAccessPackageCatalogResource, AADEntitlementManagementConnectedOrganization, AADExternalIdentityPolicy, AADGroup, AADGroupLifecyclePolicy, AADGroupsNamingPolicy, AADGroupsSettings, AADNamedLocationPolicy, AADRoleDefinition, AADRoleEligibilityScheduleRequest, AADRoleSetting, AADSecurityDefaults, AADServicePrincipal, AADSocialIdentityProvider, AADTenantDetails, AADTokenLifetimePolicy, AADUser, EXOAcceptedDomain, EXOActiveSyncDeviceAccessRule, EXOAddressBookPolicy, EXOAddressList, EXOAntiPhishPolicy, EXOAntiPhishRule, EXOApplicationAccessPolicy, EXOAtpPolicyForO365, EXOAuthenticationPolicy, EXOAuthenticationPolicyAssignment, EXOAvailabilityAddressSpace, EXOAvailabilityConfig, EXOCalendarProcessing, EXOCASMailboxPlan, EXOCASMailboxSettings, EXOClientAccessRule, EXODataClassification, EXODataEncryptionPolicy, EXODistributionGroup, EXODkimSigningConfig, EXOEmailAddressPolicy, EXOGlobalAddressList, EXOGroupSettings, EXOHostedConnectionFilterPolicy, EXOHostedContentFilterPolicy, EXOHostedContentFilterRule, EXOHostedOutboundSpamFilterPolicy, EXOHostedOutboundSpamFilterRule, EXOInboundConnector, EXOIntraOrganizationConnector, EXOIRMConfiguration, EXOJournalRule, EXOMailboxAutoReplyConfiguration, EXOMailboxCalendarFolder, EXOMailboxPermission, EXOMailboxPlan, EXOMailboxSettings, EXOMailContact, EXOMailTips, EXOMalwareFilterPolicy, EXOMalwareFilterRule, EXOManagementRole, EXOManagementRoleAssignment, EXOMessageClassification, EXOMobileDeviceMailboxPolicy, EXOOfflineAddressBook, EXOOMEConfiguration, EXOOnPremisesOrganization, EXOOrganizationConfig, EXOOrganizationRelationship, EXOOutboundConnector, EXOOwaMailboxPolicy, EXOPartnerApplication, EXOPerimeterConfiguration, EXOPlace, EXOPolicyTipConfig, EXOQuarantinePolicy, EXORemoteDomain, EXOResourceConfiguration, EXORoleAssignmentPolicy, EXORoleGroup, EXOSafeAttachmentPolicy, EXOSafeAttachmentRule, EXOSafeLinksPolicy, EXOSafeLinksRule, EXOSharedMailbox, EXOSharingPolicy, EXOTransportConfig, EXOTransportRule, O365Group, O365OrgCustomizationSetting, O365OrgSettings, O365SearchAndIntelligenceConfigurations, ODSettings, SPOSite, TeamsUser

Authentication methods specified:

Connecting to {ExchangeOnline}...✅ Connecting to {MicrosoftGraph}...✅ Connecting to {MicrosoftTeams}...✅ Connecting to {PnP}...❌ Partial Export file was saved at: C:\Users\KATADM~1.DOM\AppData\Local\Temp\25d9f647-3a4e-481b-b7a0-0a159bfa2583.partial.ps1 Exception: Powershell 7+ was detected. We need to load the PnP.PowerShell module using the -UseWindowsPowerShell switch which requires the module to be installed under C:\Program Files\WindowsPowerShell\Modules. You can either move the module to that location or use PowerShell 5.1 to install the modules using 'Install-Module Pnp.PowerShell -Force -Scope AllUsers'.

Microsoft 365 DSC Version

1.23.1122.1 1.23.1122.1

Which workloads are affected

Azure Active Directory, Exchange Online, Office 365 Admin, OneDrive for Business, SharePoint Online, Teams

The DSC configuration

# Generated by Microsoft365DSC from https://export.microsoft365dsc.com on 11/23/2023, 11:33:11 AM
# Visit https://microsoft365dsc.com for more information

# Getting client credential
$Credential = Get-Credential

# Exporting resources using credentials
Export-M365DSCConfiguration -Components @("AADAdministrativeUnit", "AADApplication", "AADAttributeSet", "AADAuthenticationContextClassReference", "AADAuthenticationMethodPolicy", "AADAuthenticationMethodPolicyAuthenticator", "AADAuthenticationMethodPolicyEmail", "AADAuthenticationMethodPolicyFido2", "AADAuthenticationMethodPolicySms", "AADAuthenticationMethodPolicySoftware", "AADAuthenticationMethodPolicyTemporary", "AADAuthenticationMethodPolicyVoice", "AADAuthenticationMethodPolicyX509", "AADAuthenticationStrengthPolicy", "AADAuthorizationPolicy", "AADConditionalAccessPolicy", "AADCrossTenantAccessPolicy", "AADCrossTenantAccessPolicyConfigurationDefault", "AADCrossTenantAccessPolicyConfigurationPartner", "AADEntitlementManagementAccessPackage", "AADEntitlementManagementAccessPackageAssignmentPolicy", "AADEntitlementManagementAccessPackageCatalog", "AADEntitlementManagementAccessPackageCatalogResource", "AADEntitlementManagementConnectedOrganization", "AADExternalIdentityPolicy", "AADGroup", "AADGroupLifecyclePolicy", "AADGroupsNamingPolicy", "AADGroupsSettings", "AADNamedLocationPolicy", "AADRoleDefinition", "AADRoleEligibilityScheduleRequest", "AADRoleSetting", "AADSecurityDefaults", "AADServicePrincipal", "AADSocialIdentityProvider", "AADTenantDetails", "AADTokenLifetimePolicy", "AADUser", "EXOAcceptedDomain", "EXOActiveSyncDeviceAccessRule", "EXOAddressBookPolicy", "EXOAddressList", "EXOAntiPhishPolicy", "EXOAntiPhishRule", "EXOApplicationAccessPolicy", "EXOAtpPolicyForO365", "EXOAuthenticationPolicy", "EXOAuthenticationPolicyAssignment", "EXOAvailabilityAddressSpace", "EXOAvailabilityConfig", "EXOCalendarProcessing", "EXOCASMailboxPlan", "EXOCASMailboxSettings", "EXOClientAccessRule", "EXODataClassification", "EXODataEncryptionPolicy", "EXODistributionGroup", "EXODkimSigningConfig", "EXOEmailAddressPolicy", "EXOGlobalAddressList", "EXOGroupSettings", "EXOHostedConnectionFilterPolicy", "EXOHostedContentFilterPolicy", "EXOHostedContentFilterRule", "EXOHostedOutboundSpamFilterPolicy", "EXOHostedOutboundSpamFilterRule", "EXOInboundConnector", "EXOIntraOrganizationConnector", "EXOIRMConfiguration", "EXOJournalRule", "EXOMailboxAutoReplyConfiguration", "EXOMailboxCalendarFolder", "EXOMailboxPermission", "EXOMailboxPlan", "EXOMailboxSettings", "EXOMailContact", "EXOMailTips", "EXOMalwareFilterPolicy", "EXOMalwareFilterRule", "EXOManagementRole", "EXOManagementRoleAssignment", "EXOMessageClassification", "EXOMobileDeviceMailboxPolicy", "EXOOfflineAddressBook", "EXOOMEConfiguration", "EXOOnPremisesOrganization", "EXOOrganizationConfig", "EXOOrganizationRelationship", "EXOOutboundConnector", "EXOOwaMailboxPolicy", "EXOPartnerApplication", "EXOPerimeterConfiguration", "EXOPlace", "EXOPolicyTipConfig", "EXOQuarantinePolicy", "EXORemoteDomain", "EXOResourceConfiguration", "EXORoleAssignmentPolicy", "EXORoleGroup", "EXOSafeAttachmentPolicy", "EXOSafeAttachmentRule", "EXOSafeLinksPolicy", "EXOSafeLinksRule", "EXOSharedMailbox", "EXOSharingPolicy", "EXOTransportConfig", "EXOTransportRule", "O365Group", "O365OrgCustomizationSetting", "O365OrgSettings", "O365SearchAndIntelligenceConfigurations", "ODSettings", "SPOSite", "TeamsUser") -Credential $Credential

Verbose logs showing the problem

not sure

Environment Information + PowerShell Version

OsName               : Microsoft Windows Server 2022 Datacenter Azure Edition
OsOperatingSystemSKU : 407
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Name                           Value
----                           -----
PSVersion                      7.4.0
PSEdition                      Core
GitCommitId                    7.4.0
OS                             Microsoft Windows 10.0.20348
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
andikrueger commented 9 months ago

Please run M365DSC in a PS 5 session. For PS7 see this blog post: https://microsoft365dsc.com/user-guide/get-started/powershell7-support/

pradeepmnrecit commented 9 months ago

Hi Andiikrueger

Now i am using powershell 5.1 getting the below error

Unable to retrieve SPO Admin URL. Please check connectivity and if you have the Sites.Read.All permission. At C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.0.121\MSCloudLoginAssistant.psm1:550 char:9

pradeepmnrecit commented 9 months ago

Dear All

Also Can anybody guide on this please.

Authentication methods specified:

Connecting to {ExchangeOnline}...✅ Connecting to {MicrosoftGraph}...✅ Connecting to {MicrosoftTeams}...✅ [1/8] Extracting [EXOAcceptedDomain] using {Credentials}... |---[1/3] NETORGFT15046993.onmicrosoft.com✅ |---[2/3] katinasia.onmicrosoft.com✅ |---[3/3] testkat.com✅ [2/8] Extracting [EXOAddressList] using {Credentials}... 🟡 The current tenant is not registered to allow for Address Lists [3/8] Extracting [O365AdminAuditLogConfig] using {Credentials}...✅ [4/8] Extracting [O365Group] using {Credentials}... |---[1/6] testkat.com✅ |---[2/6] All Company✅ |---[3/6] Test KAT Developers Group✅ |---[4/6] TEST KAT Sharepoint✅ |---[5/6] TEST KAT1✅ |---[6/6] Test KAT Team✅ [5/8] Extracting [O365OrgSettings] using {Credentials}...✅ [6/8] Extracting [TeamsAppPermissionPolicy] using {Credentials}...❌ Error Log created at {file://C:/DSC/5984-M365DSC-ErrorLog.log} [7/8] Extracting [TeamsChannel] using {Credentials}...❌ Error Log created at {file://C:/DSC/5984-M365DSC-ErrorLog.log} [8/8] Extracting [TeamsOrgWideAppSettings] using {Credentials}...❌ Error Log created at {file://C:/DSC/5984-M365DSC-ErrorLog.log} ✅ ⌛ Export took {64 seconds}

Destination Path: c:\dsc\

pradeepmnrecit commented 9 months ago

Sorry the error logs are below. Kindly advice please....

[2023/11/23 01:34:57] {NotSpecified} System.Management.Automation.RemoteException: You must call the Connect-MicrosoftTeams cmdlet before calling any other cmdlets. "Error during Export:" at , C:\Users\katadmin.DOMAIN\AppData\Local\Temp\remoteIpMoProxy_MicrosoftTeams_5.8.0_localhost_7add03c4-c481-4fef-8ab4-81500bb2f911\remoteIpMoProxy_MicrosoftTeams_5.8.0_localhost_7add03c4-c481-4fef-8ab4-81500bb2f911.psm1: line 45832 at Export-TargetResource, C:\Users\katadmin.DOMAIN\Documents\PowerShell\Modules\Microsoft365DSC\1.23.1122.1\DSCResources\MSFT_TeamsChannel\MSFT_TeamsChannel.psm1: line 382 at Start-M365DSCConfigurationExtract, C:\Users\katadmin.DOMAIN\Documents\PowerShell\Modules\Microsoft365DSC\1.23.1122.1\modules\M365DSCReverse.psm1: line 615 at Export-M365DSCConfiguration, C:\Users\katadmin.DOMAIN\Documents\PowerShell\Modules\Microsoft365DSC\1.23.1122.1\modules\M365DSCUtil.psm1: line 1320 at , C:\DSC\M365TenantConfig.ps1: line 8 at , : line 1 admin@NETORGFT15046993.onmicrosoft.com TenantId: NETORGFT15046993.onmicrosoft.com

[2023/11/23 01:34:58] {NotSpecified} System.Management.Automation.RemoteException: Session is not established, run Connect-MicrosoftTeams before requesting access token "Error retrieving data:" at Get-CsTeamsSettingsCustomApp, C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\5.8.0\internal\Merged_internal.ps1: line 14760 at Get-CsTeamsSettingsCustomApp, C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\5.8.0\custom\Merged_custom_PsExt.ps1: line 2109 at Get-CsTeamsSettingsCustomApp, C:\Program Files\WindowsPowerShell\Modules\MicrosoftTeams\5.8.0\exports\ProxyCmdletDefinitionsWithHelp.ps1: line 44712 admin@NETORGFT15046993.onmicrosoft.com TenantId: NETORGFT15046993.onmicrosoft.com

andikrueger commented 9 months ago

Could you share the outcome of

Get-Module -ListAvailable
pradeepmnrecit commented 9 months ago

Dear Andi

PS C:\DSC> Get-Module -ListAvailable

Directory: C:\Users\katadmin.DOMAIN\Documents\PowerShell\Modules

ModuleType Version PreRelease Name PSEdition ExportedCommands


Manifest 1.4.0.0 AuditPolicyDsc Desk Script 4.1.1 BaselineManagement Desk {ConvertFrom-GPO, Merge-GPOs, Merge-GPOsfromOU} Manifest 1.3.1 GPRegistryPolicyDsc Desk Script 1.0.0 GPRegistryPolicyParser Desk {Read-PolFile, Read-RegistryPolicies, New-RegistrySettingsEntry, New-GPRegistryPolicyFile…} Script 4.5.0 GuestConfiguration Desk {New-GuestConfigurationPackage, Get-GuestConfigurationPackageComplianceStatus, Protect-Gues… Manifest 1.23.1122… Microsoft365DSC Desk {Assert-M365DSCBlueprint, Compare-M365DSCConfigurations, Confirm-M365DSCDependencies, Expor… Manifest 2.2.0 PnP.PowerShell Desk {Add-PnPAdaptiveScopeProperty, Add-PnPPropertyBagValue, Add-PnPSiteClassification, Copy-PnP… Script 2.0.7 PSDesiredStateConfiguration Core {Configuration, New-DscChecksum, Get-DscResource, Invoke-DscResource} Manifest 2.10.0.0 SecurityPolicyDsc Desk

Directory: C:\Program Files\PowerShell\Modules

ModuleType Version PreRelease Name PSEdition ExportedCommands


Manifest 1.4.0.0 DSCParser Desk ConvertTo-DSCObject Script 3.4.0 ExchangeOnlineManagement Desk {Add-VivaModuleFeaturePolicy, Get-ConnectionInformation, Get-DefaultTenantBriefingConfig, G… Script 2.9.1 Microsoft.Graph.Applications Core,Desk {Add-MgApplicationKey, Add-MgApplicationPassword, Add-MgServicePrincipalKey, Add-MgServiceP… Script 2.9.1 Microsoft.Graph.Authentication Core,Desk {Connect-MgGraph, Disconnect-MgGraph, Get-MgContext, Invoke-MgGraphRequest…} Script 2.9.1 Microsoft.Graph.Beta.DeviceManagem… Core,Desk {Get-MgBetaAdminEdge, Get-MgBetaAdminEdgeInternetExplorerMode, Get-MgBetaAdminEdgeInternetE… Script 2.9.1 Microsoft.Graph.Beta.DeviceManagem… Core,Desk {Get-MgBetaDeviceManagementApplePushNotificationCertificate, Get-MgBetaDeviceManagementAudi… Script 2.9.1 Microsoft.Graph.Beta.DeviceManagem… Core,Desk {Get-MgBetaDeviceManagementAndroidDeviceOwnerEnrollmentProfile, Get-MgBetaDeviceManagementA… Script 2.9.1 Microsoft.Graph.Beta.Devices.Corpo… Core,Desk {Clear-MgBetaDeviceAppManagementWindowsInformationProtectionDeviceRegistration, Get-MgBetaD… Script 2.9.1 Microsoft.Graph.Beta.DirectoryObje… Core,Desk {Confirm-MgBetaDirectoryObjectMemberGroup, Confirm-MgBetaDirectoryObjectMemberObject, Get-M… Script 2.9.1 Microsoft.Graph.Beta.Identity.Dire… Core,Desk {Add-MgBetaTenantRelationshipManagedTenantAlertUserInputLog, Add-MgBetaTenantRelationshipMa… Script 2.9.1 Microsoft.Graph.Beta.Identity.Gove… Core,Desk {Add-MgBetaAccessReviewDecision, Add-MgBetaAccessReviewInstanceDecision, Add-MgBetaIdentity… Script 2.9.1 Microsoft.Graph.Beta.Identity.Sign… Core,Desk {Confirm-MgBetaInformationProtectionSignature, Confirm-MgBetaRiskyServicePrincipalCompromis… Script 2.9.1 Microsoft.Graph.Beta.Reports Core,Desk {Confirm-MgBetaAuditLogSignInCompromised, Confirm-MgBetaAuditLogSignInSafe, Get-MgBetaAdmin… Script 2.9.1 Microsoft.Graph.Beta.Teams Core,Desk {Add-MgBetaChatMember, Add-MgBetaTeamChannelMember, Add-MgBetaTeamMember, Add-MgBetaTeamPri… Script 2.9.1 Microsoft.Graph.DeviceManagement.A… Core,Desk {Get-MgDeviceManagementApplePushNotificationCertificate, Get-MgDeviceManagementAuditEvent, … Script 2.9.1 Microsoft.Graph.Groups Core,Desk {Add-MgGroupDriveListContentTypeCopy, Add-MgGroupDriveListContentTypeCopyFromContentTypeHub… Script 2.9.1 Microsoft.Graph.Planner Core,Desk {Get-MgGroupPlanner, Get-MgGroupPlannerPlan, Get-MgGroupPlannerPlanBucket, Get-MgGroupPlann… Script 2.9.1 Microsoft.Graph.Users Core,Desk {Get-MgUser, Get-MgUserCount, Get-MgUserCreatedObject, Get-MgUserCreatedObjectAsServicePrin… Script 2.9.1 Microsoft.Graph.Users.Actions Core,Desk {Add-MgUserChatMember, Add-MgUserDriveListContentTypeCopy, Add-MgUserDriveListContentTypeCo… Script 2.0.177 Microsoft.PowerApps.Administration… Desk {New-AdminPowerAppCdsDatabase, Get-AdminPowerAppCdsDatabaseLanguages, Get-AdminPowerAppCdsD… Script 5.8.0 MicrosoftTeams Core,Desk {Add-TeamChannelUser, Add-TeamUser, Connect-MicrosoftTeams, Disconnect-MicrosoftTeams…} Script 1.0.121 MSCloudLoginAssistant Desk {Test-MSCloudLogin, Connect-M365Tenant, Invoke-MSCloudLoginMicrosoftGraphAPI, Get-SPOAdminU… Manifest 2.2.0 PnP.PowerShell Desk {Add-PnPAdaptiveScopeProperty, Add-PnPPropertyBagValue, Add-PnPSiteClassification, Copy-PnP… Manifest 1.12.0 PnP.PowerShell Core,Desk {Add-PnPAdaptiveScopeProperty, Add-PnPPropertyBagValue, Add-PnPSiteClassification, Copy-PnP… Manifest 2.0.0.18 ReverseDSC Desk {Get-DSCParamType, Get-DSCBlock, Get-DSCFakeParameters, Get-DSCDependsOnBlock…}

Directory: C:\program files\powershell\7\Modules

ModuleType Version PreRelease Name PSEdition ExportedCommands


Manifest 7.0.0.0 CimCmdlets Core {Get-CimAssociatedInstance, Get-CimClass, Get-CimInstance, Get-CimSession…} Manifest 1.2.5 Microsoft.PowerShell.Archive Desk {Compress-Archive, Expand-Archive} Manifest 7.0.0.0 Microsoft.PowerShell.Diagnostics Core {Get-WinEvent, New-WinEvent, Get-Counter} Manifest 7.0.0.0 Microsoft.PowerShell.Host Core {Start-Transcript, Stop-Transcript} Manifest 7.0.0.0 Microsoft.PowerShell.Management Core {Add-Content, Clear-Content, Get-Clipboard, Set-Clipboard…} Binary 1.0.1 Microsoft.PowerShell.PSResourceGet Core,Desk {Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository, Get-PSScriptFileInfo…} Manifest 7.0.0.0 Microsoft.PowerShell.Security Core {Get-Acl, Set-Acl, Get-PfxCertificate, Get-Credential…} Manifest 7.0.0.0 Microsoft.PowerShell.Utility Core {Export-Alias, Get-Alias, Import-Alias, New-Alias…} Manifest 7.0.0.0 Microsoft.WSMan.Management Core {Disable-WSManCredSSP, Enable-WSManCredSSP, Get-WSManCredSSP, Set-WSManQuickConfig…} Script 1.4.8.1 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…} Script 2.2.5 PowerShellGet Desk {Find-Command, Find-DSCResource, Find-Module, Find-RoleCapability…} Script 7.0.0.0 PSDiagnostics Core {Disable-PSTrace, Disable-PSWSManCombinedTrace, Disable-WSManTrace, Enable-PSTrace…} Script 2.3.4 PSReadLine Desk {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler, Get-PSRea… Binary 2.0.3 ThreadJob Desk Start-ThreadJob

Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version PreRelease Name PSEdition ExportedCommands


Manifest 1.4.0.0 DSCParser Desk ConvertTo-DSCObject Script 3.4.0 ExchangeOnlineManagement Desk {Add-VivaModuleFeaturePolicy, Get-ConnectionInformation, Get-DefaultTenantBriefingConfig, G… Script 2.9.1 Microsoft.Graph.Applications Core,Desk {Add-MgApplicationKey, Add-MgApplicationPassword, Add-MgServicePrincipalKey, Add-MgServiceP… Script 2.9.1 Microsoft.Graph.Authentication Core,Desk {Connect-MgGraph, Disconnect-MgGraph, Get-MgContext, Invoke-MgGraphRequest…} Script 2.9.1 Microsoft.Graph.Beta.DeviceManagem… Core,Desk {Get-MgBetaAdminEdge, Get-MgBetaAdminEdgeInternetExplorerMode, Get-MgBetaAdminEdgeInternetE… Script 2.9.1 Microsoft.Graph.Beta.DeviceManagem… Core,Desk {Get-MgBetaDeviceManagementApplePushNotificationCertificate, Get-MgBetaDeviceManagementAudi… Script 2.9.1 Microsoft.Graph.Beta.DeviceManagem… Core,Desk {Get-MgBetaDeviceManagementAndroidDeviceOwnerEnrollmentProfile, Get-MgBetaDeviceManagementA… Script 2.9.1 Microsoft.Graph.Beta.Devices.Corpo… Core,Desk {Clear-MgBetaDeviceAppManagementWindowsInformationProtectionDeviceRegistration, Get-MgBetaD… Script 2.9.1 Microsoft.Graph.Beta.DirectoryObje… Core,Desk {Confirm-MgBetaDirectoryObjectMemberGroup, Confirm-MgBetaDirectoryObjectMemberObject, Get-M… Script 2.9.1 Microsoft.Graph.Beta.Identity.Dire… Core,Desk {Add-MgBetaTenantRelationshipManagedTenantAlertUserInputLog, Add-MgBetaTenantRelationshipMa… Script 2.9.1 Microsoft.Graph.Beta.Identity.Gove… Core,Desk {Add-MgBetaAccessReviewDecision, Add-MgBetaAccessReviewInstanceDecision, Add-MgBetaIdentity… Script 2.9.1 Microsoft.Graph.Beta.Identity.Sign… Core,Desk {Confirm-MgBetaInformationProtectionSignature, Confirm-MgBetaRiskyServicePrincipalCompromis… Script 2.9.1 Microsoft.Graph.Beta.Reports Core,Desk {Confirm-MgBetaAuditLogSignInCompromised, Confirm-MgBetaAuditLogSignInSafe, Get-MgBetaAdmin… Script 2.9.1 Microsoft.Graph.Beta.Teams Core,Desk {Add-MgBetaChatMember, Add-MgBetaTeamChannelMember, Add-MgBetaTeamMember, Add-MgBetaTeamPri… Script 2.9.1 Microsoft.Graph.DeviceManagement.A… Core,Desk {Get-MgDeviceManagementApplePushNotificationCertificate, Get-MgDeviceManagementAuditEvent, … Script 2.9.1 Microsoft.Graph.Groups Core,Desk {Add-MgGroupDriveListContentTypeCopy, Add-MgGroupDriveListContentTypeCopyFromContentTypeHub… Script 2.9.1 Microsoft.Graph.Planner Core,Desk {Get-MgGroupPlanner, Get-MgGroupPlannerPlan, Get-MgGroupPlannerPlanBucket, Get-MgGroupPlann… Script 2.9.1 Microsoft.Graph.Users Core,Desk {Get-MgUser, Get-MgUserCount, Get-MgUserCreatedObject, Get-MgUserCreatedObjectAsServicePrin… Script 2.9.1 Microsoft.Graph.Users.Actions Core,Desk {Add-MgUserChatMember, Add-MgUserDriveListContentTypeCopy, Add-MgUserDriveListContentTypeCo… Script 2.0.177 Microsoft.PowerApps.Administration… Desk {New-AdminPowerAppCdsDatabase, Get-AdminPowerAppCdsDatabaseLanguages, Get-AdminPowerAppCdsD… Script 1.0.1 Microsoft.PowerShell.Operation.Val… Desk {Get-OperationValidation, Invoke-OperationValidation} Manifest 1.23.1122… Microsoft365DSC Desk {Assert-M365DSCBlueprint, Compare-M365DSCConfigurations, Confirm-M365DSCDependencies, Expor… Script 5.8.0 MicrosoftTeams Core,Desk {Add-TeamChannelUser, Add-TeamUser, Connect-MicrosoftTeams, Disconnect-MicrosoftTeams…} Script 1.0.121 MSCloudLoginAssistant Desk {Test-MSCloudLogin, Connect-M365Tenant, Invoke-MSCloudLoginMicrosoftGraphAPI, Get-SPOAdminU… Binary 1.0.0.1 PackageManagement Desk {Find-Package, Get-Package, Get-PackageProvider, Get-PackageSource…} Script 3.4.0 Pester Desk {Describe, Context, It, Should…} Manifest 1.12.0 PnP.PowerShell Core,Desk {Add-PnPAdaptiveScopeProperty, Add-PnPPropertyBagValue, Add-PnPSiteClassification, Copy-PnP… Script 1.0.0.1 PowerShellGet Desk {Install-Module, Find-Module, Save-Module, Update-Module…} Script 2.0.7 PSDesiredStateConfiguration Core {Configuration, New-DscChecksum, Get-DscResource, Invoke-DscResource} Script 2.0.0 PSReadline Desk {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remove-PSReadLineKeyHandler, Get-PSRea… Manifest 2.0.0.18 ReverseDSC Desk {Get-DSCParamType, Get-DSCBlock, Get-DSCFakeParameters, Get-DSCDependsOnBlock…}

Directory: C:\Windows\system32\WindowsPowerShell\v1.0\Modules

ModuleType Version PreRelease Name PSEdition ExportedCommands


Manifest 1.0.0.0 AppBackgroundTask Core,Desk {Disable-AppBackgroundTaskDiagnosticLog, Enable-AppBackgroundTaskDiagnosticLog, Set-AppBack… Manifest 2.0.1.0 Appx Core,Desk {Add-AppxPackage, Get-AppxPackage, Get-AppxPackageManifest, Remove-AppxPackage…} Manifest 1.0.0.0 BitLocker Core,Desk {Unlock-BitLocker, Suspend-BitLocker, Resume-BitLocker, Remove-BitLockerKeyProtector…} Manifest 2.0.0.0 BitsTransfer Core,Desk {Add-BitsFile, Complete-BitsTransfer, Get-BitsTransfer, Remove-BitsTransfer…} Manifest 1.0.0.0 BranchCache Core,Desk {Add-BCDataCacheExtension, Clear-BCCache, Disable-BC, Disable-BCDowngrading…} Manifest 1.0 ConfigDefenderPerformance Core,Desk {New-MpPerformanceRecording, Get-MpPerformanceReport} Manifest 1.0.3.0 DeliveryOptimization Core,Desk {Get-DeliveryOptimizationLog, Get-DeliveryOptimizationLogAnalysis, Delete-DeliveryOptimizat… Manifest 1.0.0.0 DirectAccessClientComponents Core,Desk {Disable-DAManualEntryPointSelection, Enable-DAManualEntryPointSelection, Get-DAClientExper… Script 3.0 Dism Core,Desk {Add-AppxProvisionedPackage, Add-WindowsDriver, Add-WindowsCapability, Add-WindowsImage…} Manifest 1.0.0.0 DnsClient Core,Desk {Resolve-DnsName, Clear-DnsClientCache, Get-DnsClient, Get-DnsClientCache…} Manifest 1.0.0.0 EventTracingManagement Core,Desk {Start-EtwTraceSession, New-EtwTraceSession, Get-EtwTraceSession, Update-EtwTraceSession…} Manifest 2.0.0.0 International Core,Desk {Get-WinDefaultInputMethodOverride, Set-WinDefaultInputMethodOverride, Get-WinHomeLocation,… Manifest 1.0.0.0 Kds Core,Desk {Add-KdsRootKey, Get-KdsRootKey, Test-KdsRootKey, Set-KdsConfiguration…} Script 1.0.0.0 LAPS Core,Desk {Find-LapsADExtendedRights, Get-LapsADPassword, Invoke-LapsPolicyProcessing, Reset-LapsPass… Manifest 3.0.0.0 Microsoft.PowerShell.Diagnostics Core,Desk {Get-WinEvent, Get-Counter, Import-Counter, Export-Counter…} Manifest 1.0.0.0 Microsoft.PowerShell.LocalAccounts Core,Desk {Add-LocalGroupMember, Disable-LocalUser, Enable-LocalUser, Get-LocalGroup…} Manifest 1.0 MMAgent Core,Desk {Disable-MMAgent, Enable-MMAgent, Set-MMAgent, Get-MMAgent…} Manifest 2.0.0.0 NetAdapter Core,Desk {Disable-NetAdapter, Disable-NetAdapterBinding, Disable-NetAdapterChecksumOffload, Disable-… Manifest 1.0.0.0 NetConnection Core,Desk {Get-NetConnectionProfile, Set-NetConnectionProfile} Manifest 1.0.0.0 NetEventPacketCapture Core,Desk {New-NetEventSession, Remove-NetEventSession, Get-NetEventSession, Set-NetEventSession…} Manifest 2.0.0.0 NetLbfo Core,Desk {Add-NetLbfoTeamMember, Add-NetLbfoTeamNic, Get-NetLbfoTeam, Get-NetLbfoTeamMember…} Manifest 1.0.0.0 NetNat Core,Desk {Get-NetNat, Get-NetNatExternalAddress, Get-NetNatStaticMapping, Get-NetNatSession…} Manifest 2.0.0.0 NetQos Core,Desk {Get-NetQosPolicy, Set-NetQosPolicy, Remove-NetQosPolicy, New-NetQosPolicy} Manifest 2.0.0.0 NetSecurity Core,Desk {Get-DAPolicyChange, New-NetIPsecAuthProposal, New-NetIPsecMainModeCryptoProposal, New-NetI… Manifest 1.0.0.0 NetSwitchTeam Core,Desk {New-NetSwitchTeam, Remove-NetSwitchTeam, Get-NetSwitchTeam, Rename-NetSwitchTeam…} Manifest 1.0.0.0 NetTCPIP Core,Desk {Get-NetIPAddress, Get-NetIPInterface, Get-NetIPv4Protocol, Get-NetIPv6Protocol…} Manifest 1.0.0.0 NetworkConnectivityStatus Core,Desk {Get-DAConnectionStatus, Get-NCSIPolicyConfiguration, Reset-NCSIPolicyConfiguration, Set-NC… Manifest 1.0.0.0 NetworkSwitchManager Core,Desk {Disable-NetworkSwitchEthernetPort, Enable-NetworkSwitchEthernetPort, Get-NetworkSwitchEthe… Manifest 1.0.0.0 NetworkTransition Core,Desk {Add-NetIPHttpsCertBinding, Disable-NetDnsTransitionConfiguration, Disable-NetIPHttpsProfil… Manifest 1.0 NFS Core,Desk {Get-NfsMappedIdentity, Get-NfsNetgroup, Install-NfsMappingStore, New-NfsMappedIdentity…} Binary 1.0.0.0 OsConfiguration Core,Desk {Get-OsConfigurationDocument, Get-OsConfigurationDocumentContent, Get-OsConfigurationDocume… Manifest 1.0.0.0 PcsvDevice Core,Desk {Get-PcsvDevice, Start-PcsvDevice, Stop-PcsvDevice, Restart-PcsvDevice…} Manifest 1.0.0.0 PKI Core,Desk {Add-CertificateEnrollmentPolicyServer, Export-Certificate, Export-PfxCertificate, Get-Cert… Manifest 1.0.0.0 PnpDevice Core,Desk {Get-PnpDevice, Get-PnpDeviceProperty, Enable-PnpDevice, Disable-PnpDevice} Manifest 1.1 PrintManagement Core,Desk {Add-Printer, Add-PrinterDriver, Add-PrinterPort, Get-PrintConfiguration…} Binary 1.0.12 ProcessMitigations Core,Desk {Get-ProcessMitigation, Set-ProcessMitigation, ConvertTo-ProcessMitigationPolicy} Manifest 1.0.0.0 ScheduledTasks Core,Desk {Get-ScheduledTask, Set-ScheduledTask, Register-ScheduledTask, Unregister-ScheduledTask…} Manifest 2.0.0.0 SecureBoot Core,Desk {Confirm-SecureBootUEFI, Set-SecureBootUEFI, Get-SecureBootUEFI, Format-SecureBootUEFI…} Manifest 2.0.0.0 SmbShare Core,Desk {Get-SmbShare, Remove-SmbShare, Set-SmbShare, Block-SmbShareAccess…} Manifest 2.0.0.0 SmbWitness Core,Desk {Get-SmbWitnessClient, Move-SmbWitnessClient, gsmbw, msmbw…} Manifest 2.0.0.0 SoftwareInventoryLogging Core,Desk {Get-SilComputer, Get-SilComputerIdentity, Get-SilSoftware, Get-SilWindowsUpdate…} Manifest 1.0.0.0 StartLayout Core,Desk {Export-StartLayout, Import-StartLayout, Export-StartLayoutEdgeAssets, Get-StartApps} Manifest 2.0.0.0 Storage Core,Desk {Add-InitiatorIdToMaskingSet, Add-PartitionAccessPath, Add-PhysicalDisk, Add-StorageFaultDo… Manifest 2.0.0.0 TLS Core,Desk {New-TlsSessionTicketKey, Enable-TlsSessionTicketKey, Disable-TlsSessionTicketKey, Export-T… Manifest 1.0.0.0 TroubleshootingPack Core,Desk {Get-TroubleshootingPack, Invoke-TroubleshootingPack} Manifest 2.0.0.0 TrustedPlatformModule Core,Desk {Get-Tpm, Initialize-Tpm, Clear-Tpm, Unblock-Tpm…} Binary 2.1.639.0 UEV Core,Desk Manifest 2.0.0.0 VpnClient Core,Desk {Add-VpnConnection, Set-VpnConnection, Remove-VpnConnection, Get-VpnConnection…} Manifest 1.0.0.0 Wdac Core,Desk {Get-OdbcDriver, Set-OdbcDriver, Get-OdbcDsn, Add-OdbcDsn…} Manifest 2.0.0.0 Whea Core,Desk {Get-WheaMemoryPolicy, Set-WheaMemoryPolicy} Manifest 1.0.0.0 WindowsDeveloperLicense Core,Desk {Get-WindowsDeveloperLicense, Unregister-WindowsDeveloperLicense, Show-WindowsDeveloperLice… Script 1.0 WindowsErrorReporting Core,Desk {Enable-WindowsErrorReporting, Disable-WindowsErrorReporting, Get-WindowsErrorReporting} Manifest 1.0.0.0 WindowsSearch Core,Desk {Get-WindowsSearchSetting, Set-WindowsSearchSetting} Manifest 1.0.0.0 WindowsUpdate Core,Desk Get-WindowsUpdateLog

PS C:\DSC>

andikrueger commented 9 months ago

Please remove the PnP.PowerShell V2.2.0 in Directory: C:\Users\katadmin.DOMAIN\Documents\PowerShell\Modules

pradeepmnrecit commented 9 months ago

Dear Andi

After i remove the PnP from the above mentioned location ..Still its same.

PS C:\DSC> .\msdsc.ps1

PowerShell credential request Enter your credentials. User: admin@NETORGFT15046993.onmicrosoft.com Password for user admin@NETORGFT15046993.onmicrosoft.com: **

Exporting Microsoft 365 configuration for Components: AADTenantDetails, EXOAcceptedDomain, O365AdminAuditLogConfig, O365OrgCustomizationSetting, O365OrgSettings, PlannerBucket, SCLabelPolicy, SPOHomeSite, SPOSite, SPOSiteDesignRights, TeamsAppPermissionPolicy

Authentication methods specified:

Connecting to {ExchangeOnline}...✅ Connecting to {MicrosoftGraph}...✅ Connecting to {MicrosoftTeams}...✅ Connecting to {PnP}...❌ Partial Export file was saved at: C:\Users\KATADM~1.DOM\AppData\Local\Temp\6e8dd8c2-3ec0-41c7-9ea5-f84b015cff1e.partial.

GeldHades27355 commented 5 months ago

Hi Team, was this ever resolved? I'm getting the exact same error at the same place:

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: 57f1936a-0838-48d4-b305-b9b34f696e00 Correlation ID: 4ef6ad53-9d1a-4e99-807f-9472a70e57a3 Timestamp: 2024-03-20 16:22:49Z ✅ Connecting to {MicrosoftGraph}...✅ Connecting to {MicrosoftTeams}...✅ Connecting to {PnP}...❌ Partial Export file was saved at: C:\Users\GLOBAL~1\AppData\Local\Temp\29fd4642-2874-4b7e-b119-e375985xxxxx.partial.ps1 Unable to retrieve SPO Admin URL. Please check connectivity and if you have the Sites.Read.All permission. At C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.1.13\MSCloudLoginAssistant.psm1:444 char:9

Quick summary of the setup:

Lastly, I found that get-SPOadminurl and get-SPOadministrationurl provide different results. One throws the error above, the other does not. Oddly the cmdlet throwing the error ist the one NOT in module microsoft365dsc. Does that indicate anything?

PS C:\Users\GlobalAdmin> get-spoadministrationurl -Credential xyz@solopro.work WARNING: We recommend providing the username in the format of .onmicrosoft.* for the Credential property. https://soloproworkplace-admin.sharepoint.com/ [this is the correct URL btw]

PS C:\Users\GlobalAdmin> get-spoadminurl -Credential xyz@solopro.work Unable to retrieve SPO Admin URL. Please check connectivity and if you have the Sites.Read.All permission. At C:\Program Files\WindowsPowerShell\Modules\MSCloudLoginAssistant\1.1.13\MSCloudLoginAssistant.psm1:444 char:9

GeldHades27355 commented 5 months ago

OK, I got it working. That being said, I've rarely seen something so fickle in its authentication preferences. 🤪 It seems using a different combination of fingers on my keyboard is enough to break authentication and extraction. We're using credentials for now, as I'd like to avoid creating service principals if I can (which may be more consistent).

@pradeepmnrecit I used the https://microsoft365dsc.com/user-guide/cmdlets/Update-M365DSCAllowedGraphScopes/ cmdlet to force add READ permissions to all resources on the master tenant. It was only after that that things started working and the "Unable to retrieve SPO Admin URL." went away.

Also, I found restarting my PC fully, as well as manually signing in to each service BEFORE running Export-M365DSCConfiguration seemed to make the process more reliable. (we have strict MFA on all Entra accounts, some of them with passwordless/phishing resistant MFA).

And yet, I am watching an extraction right now that just skipped right over the O365OrgSettings, before I was able to even begin the devicelogin. Naturally, this resource failed.

ArtemPozharovDNSBelgium commented 2 months ago

I found a workaround by using Connect-MgGraph -Scopes "Sites.Read.All". Previously, I received a message about missing permissions for “Sites.Read.All”. Instead of displaying a console message about missing permissions, it would be more user-friendly to automatically execute a command that prompts for confirmation, allowing the user to grant the necessary permissions with a single click.