microsoft / Microsoft365DSC

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

Script fails with the final line stating: Connecting to {PnP}...❌ #4974

Open jpcapone opened 3 months ago

jpcapone commented 3 months ago

Description of the issue

image

Microsoft 365 DSC Version

1.24.731.1

Which workloads are affected

Azure Active Directory (Entra ID), Exchange Online, Security & Compliance Center, SharePoint Online, Teams

The DSC configuration

# Generated by Microsoft365DSC from https://export.microsoft365dsc.com on 8/20/2024, 9:55:02 PM
# Visit https://microsoft365dsc.com for more information

# Getting client credential
$Credential = Get-Credential

# Exporting resources using credentials
Export-M365DSCConfiguration -Components @("AADApplication", "AADAuthenticationMethodPolicy", "AADGroup", "AADNamedLocationPolicy", "AADServicePrincipal", "AADUser", "EXOAntiPhishPolicy", "EXODistributionGroup", "EXOMailboxAutoReplyConfiguration", "EXOMailboxSettings", "EXOOwaMailboxPolicy", "EXOSafeLinksPolicy", "EXOSharedMailbox", "O365AdminAuditLogConfig", "O365OrgSettings", "O365SearchAndIntelligenceConfigurations", "ODSettings", "SCAutoSensitivityLabelRule", "SCComplianceSearch", "SCDLPCompliancePolicy", "SPOAccessControlSettings", "SPOHubSite", "SPOSharingSettings", "SPOSite", "SPOStorageEntity", "TeamsChannel", "TeamsChannelsPolicy", "TeamsFilesPolicy", "TeamsGuestMeetingConfiguration", "TeamsUser") -Credential $Credential

Verbose logs showing the problem

PS C:\Users\admin> Get-Module SharePointPnPPowerShellOnline -ListAvailable | Select-Object Name,Version | Sort-Object Version -Descending
PS C:\Users\admin> Install-Module PnP.PowerShell -Scope CurrentUser
PS C:\Users\admin> Export-M365DSCConfiguration -Components @("AADApplication", "AADAuthenticationMethodPolicy", "AADGroup", "AADNamedLocationPolicy", "AADServicePrincipal", "AADUser", "EXOAntiPhishPolicy", "EXODistributionGroup", "EXOMailboxAutoReplyConfiguration", "EXOMailboxSettings", "EXOOwaMailboxPolicy", "EXOSafeLinksPolicy", "EXOSharedMailbox", "O365AdminAuditLogConfig", "O365OrgSettings", "O365SearchAndIntelligenceConfigurations", "ODSettings", "SCAutoSensitivityLabelRule", "SCComplianceSearch", "SCDLPCompliancePolicy", "SPOAccessControlSettings", "SPOHubSite", "SPOSharingSettings", "SPOSite", "SPOStorageEntity", "TeamsChannel", "TeamsChannelsPolicy", "TeamsFilesPolicy", "TeamsGuestMeetingConfiguration", "TeamsUser") -Credential $Credential
[WARNING] We recommend providing the username in the format of <tenant>.onmicrosoft.* for the Credential property.
Exporting Microsoft 365 configuration for Components: AADApplication, AADAuthenticationMethodPolicy, AADGroup, AADNamedLocationPolicy, AADServicePrincipal, AADUser, EXOAntiPhishPolicy, EXODistributionGroup, EXOMailboxAutoReplyConfiguration, EXOMailboxSettings, EXOOwaMailboxPolicy, EXOSafeLinksPolicy, EXOSharedMailbox, O365AdminAuditLogConfig, O365OrgSettings, O365SearchAndIntelligenceConfigurations, ODSettings, SCAutoSensitivityLabelRule, SCComplianceSearch, SCDLPCompliancePolicy, SPOAccessControlSettings, SPOHubSite, SPOSharingSettings, SPOSite, SPOStorageEntity, TeamsChannel, TeamsChannelsPolicy, TeamsFilesPolicy, TeamsGuestMeetingConfiguration, TeamsUser

Authentication methods specified:
- Credentials

Connecting to {ExchangeOnline}...✅
Connecting to {MicrosoftGraph}...✅
Connecting to {MicrosoftTeams}...✅
Connecting to {PnP}...❌
Partial Export file was saved at: C:\Users\ADMINI\AppData\Local\Temp\2\1a735ef8-db3e-4d34-a83a-70537e690cae.partial.ps1
PS C:\Users\admin> Get-ComputerInfo -Property @(

Environment Information + PowerShell Version

This is also happening on 
Key   : PSVersion
Value : 5.1.22621.3958
Name  : PSVersion
Current
OsName               : Microsoft Windows Server 2022 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PS C:\Users\admin>
PS C:\Users\admin> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.4
PSEdition                      Core
GitCommitId                    7.4.4
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
rmayuk commented 3 months ago

Not sure it this is related by I am now suddenly getting this?

[WARNING] Based on the provided Authentication parameters, the following resources cannot be extracted: O365SearchAndIntelligenceConfigurations Connecting to {ExchangeOnline}...❌ Partial Export file was saved at: C:\Users\xxxxx\AppData\Local\Temp\b635fe90-4897-480c-ae57-8bd20d058c4d.partial.ps1 Export-M365DSCConfiguration :The role assigned to application xxxxxxxxx-cb99-451c-b4ad-5bacda9834a3 isn't supported in this scenario. Please check online documentation for assigning correct Directory Roles to Azure AD Application for EXO App-Only Authentication.

andikrueger commented 3 months ago

Could you please check which version of PNP.PowerShell is installed on your system:

Get-Module Pnp.PowerShell

The return should be

        ModuleName      = 'PnP.PowerShell'
        RequiredVersion = '1.12.0'

installed in the global modules folder.

jpcapone commented 3 months ago

Could you please check which version of PNP.PowerShell is installed on your system:

Get-Module Pnp.PowerShell

The return should be

        ModuleName      = 'PnP.PowerShell'
        RequiredVersion = '1.12.0'

installed in the global modules folder.

this is what I get image