Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wobblewobble opened this issue Oct 11, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@wobblewobble
Copy link

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 wobblewobble added the bug Something isn't working label Oct 11, 2024
@merill
Copy link
Member

merill commented Oct 16, 2024

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

@robbieveivers
Copy link
Contributor

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants