microsoft / Microsoft365DSC

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

PowerShell DSC resource MSFT_AADConditionalAccessPolicy - Connect-MgGraph' is not recognized #4909

Open aollivierre opened 1 month ago

aollivierre commented 1 month ago

Description of the issue

PowerShell DSC resource MSFT_AADConditionalAccessPolicy failed to execute Test-TargetResource functionality with error message: The term 'Connect-MgGraph' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. + CategoryInfo : InvalidOperation: (:) [], CimException + FullyQualifiedErrorId : ProviderOperationExecutionFailure + PSComputerName : localhost

Microsoft 365 DSC Version

1.24.717.1

Which workloads are affected

Azure Active Directory (Entra ID)

The DSC configuration

No response

Verbose logs showing the problem

Directory: C:\Export\AAD\AADConditionalAccessPolicy                                                                                                                                                                                                                                                                                                                                                                                   Mode                LastWriteTime         Length Name                                                                                         ----                -------------         ------ ----                                                                                         -a----        7/18/2024   3:59 PM          75648   localhost.mof                                                                             VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' =                 MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.                                        VERBOSE: An LCM method call arrived from computer LAB-VSCODE02 with user sid S-1-5-21-825518178-4142383166-1343103298-500.                    VERBOSE: [LAB-VSCODE02]: LCM:  [ Start  Set      ]                                                                                            VERBOSE: [LAB-VSCODE02]: LCM:  [ Start  Resource ]  [[AADConditionalAccessPolicy]AADConditionalAccessPolicy-001 - BLOCK - ADMINS - Outside    Canada and US]                                                                                                                                VERBOSE: [LAB-VSCODE02]: LCM:  [ Start  Test     ]  [[AADConditionalAccessPolicy]AADConditionalAccessPolicy-001 - BLOCK - ADMINS - Outside    Canada and US]                                                                                                                                VERBOSE: [LAB-VSCODE02]:                            [[AADConditionalAccessPolicy]AADConditionalAccessPolicy-001 - BLOCK - ADMINS - Outside    Canada and US] Testing configuration of AzureAD CA Policies                                                                                   VERBOSE: [LAB-VSCODE02]:                            [[AADConditionalAccessPolicy]AADConditionalAccessPolicy-001 - BLOCK - ADMINS - Outside    Canada and US] Getting configuration of AzureAD Conditional Access Policy                                                                     VERBOSE: [LAB-VSCODE02]: LCM:  [ End    Test     ]  [[AADConditionalAccessPolicy]AADConditionalAccessPolicy-001 - BLOCK - ADMINS - Outside    Canada and US]  in 1.2380 seconds.                                                                                                            PowerShell DSC resource MSFT_AADConditionalAccessPolicy  failed to execute Test-TargetResource functionality with error message: The term     'Connect-MgGraph' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or   if a path was included, verify that the path is correct and try again.                                                                            + CategoryInfo          : InvalidOperation: (:) [], CimException                                                                              + FullyQualifiedErrorId : ProviderOperationExecutionFailure                                                                                   + PSComputerName        : localhost

Environment Information + PowerShell Version

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

Name                           Value
----                           -----
PSVersion                      5.1.20348.2582
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.20348.2582
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
NikCharlebois commented 1 month ago

Looks like you are missing dependencies. Make sure to run Update-M365DSCModule and try again.