MSIdentityTools icon indicating copy to clipboard operation
MSIdentityTools copied to clipboard

Export-MsIdAppConsentGrantReport - The module 'Microsoft.Graph.DirectoryObjects' with version '2.9.1'

Open wobblewobble opened this issue 1 year ago • 2 comments

Describe the bug

Trying to use the command Export-MsIdAppConsentGrantReport to export report. Getting error message in PS7 (PSVersion 7.4.5)

PS C:\UAT> Get-InstalledModule

Version Name Repository Description


2.24.0 Microsoft.Graph.Authentication PSGallery Microsoft Graph PowerShell Authentication Module. 2.24.0 Microsoft.Graph.DirectoryObjects PSGallery Microsoft Graph PowerShell Cmdlets 2.0.70 MSIdentityTools PSGallery Tools for managing, troubleshooting, and reporting on various aspects of Microsoft Identity products and se…

PS C:\UAT> Export-MsIdAppConsentGrantReport -ReportOutputType ExcelWorkbook -ExcelWorkbookPath C:\Delete\MFA\uat\UAT-App-Report.xlsx Write-Error: The module 'Microsoft.Graph.DirectoryObjects' with version '2.9.1' not found. To resolve, try installing module 'Microsoft.Graph.DirectoryObjects' with version '2.9.1' to match currently loaded modules. For example: Install-Module Microsoft.Graph.DirectoryObjects -RequiredVersion '2.9.1' Write-Error: The module 'Microsoft.Graph.Applications' with version '2.9.1' not found. To resolve, try installing module 'Microsoft.Graph.Applications' with version '2.9.1' to match currently loaded modules. For example: Install-Module Microsoft.Graph.Applications -RequiredVersion '2.9.1' PS C:\UAT> $PSVersionTable

Name Value


PSVersion 7.4.5 PSEdition Core GitCommitId 7.4.5 OS Microsoft Windows 10.0.19045 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

To Reproduce

Steps to reproduce the behavior: To run the report https://azuread.github.io/MSIdentityTools/commands/Export-MsIdAppConsentGrantReport#example-2

Install-Module ImportExcel PS > Connect-MgGraph -Scopes Directory.Read.All PS > Export-MsIdAppConsentGrantReport -ReportOutputType ExcelWorkbook -ExcelWorkbookPath .\report.xlsx

Expected behavior

Lists and categorizes privilege for delegated permissions (OAuth2PermissionGrants) and application permissions (AppRoleAssignments).

Screenshots

If applicable, add screenshots to help explain your problem.

Environment (please complete the following information)

  • Operating System: Windows 10
  • PowerShell Version: 7.4.5
  • MS Graph PowerShell SDK Module Version: [e.g. 1.6.2, 1.9.3, 2.0.0]

Additional context

Add any other context about the problem here.

wobblewobble avatar Oct 11 '24 17:10 wobblewobble

Thanks I'll look into removing the requirement for this specific version.

merill avatar Oct 16 '24 03:10 merill

@wobblewobble

This Powershell project has a function which checks if commands/modules are installed.

This functions checks what Microsoft.Graph.Authentication is installed in the current powershell session. Using this Version it then checks for the same versioned sub modules.

$MgAuthenticationModuleVersion = Get-Command 'Connect-MgGraph' -Module 'Microsoft.Graph.Authentication' | Select-Object -ExpandProperty Version

It's likely you have a conflict in versions that has caused your issues. This checker could probably have a better error explaining this or linking to a guide to resolve your mg graph install.

Here's a quick example of how I replicated a similar mismatch.

Image

Image

https://learn.microsoft.com/en-us/powershell/microsoftgraph/installation?view=graph-powershell-1.0

robbieveivers avatar Feb 02 '25 11:02 robbieveivers