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

Microsoft.Graph.authentication: Could not load file or assembly #2424

Closed
AlexanderHolmeset opened this issue Nov 9, 2023 · 7 comments · Fixed by #2436
Closed

Microsoft.Graph.authentication: Could not load file or assembly #2424

AlexanderHolmeset opened this issue Nov 9, 2023 · 7 comments · Fixed by #2436
Assignees
Labels

Comments

@AlexanderHolmeset
Copy link

AlexanderHolmeset commented Nov 9, 2023

Thanks for reporting the bug. Please ensure you've gone through the following checklist before opening an issue:

Describe the bug

A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. add Microsoft.graph.authentication in azure automation by browsing gallery.
  2. Create runbook with the command: Connect-MgGraph -ManagedIdentity

Expected behavior

To be authenticated.

Module Version
2.9
PowerShell 7.2 (preview) runbook

Environment Data

Please run $PSVersionTable and paste the output below. If running the Docker container image, indicate the tag of the image used and the version of Docker engine.

Screenshots
image

Additional context
If i install 2.8 instead, by downloading to my computer, zip, upload to azure automation it works. Issue is with 2.9.

@AlexanderHolmeset
Copy link
Author

Theres others having the same issue in Azure Functions:
https://twitter.com/AlexHolmeset/status/1722616794706551049
See this thread.

@tld6764
Copy link

tld6764 commented Nov 9, 2023

Same issues here.

@AlexanderHolmeset
Copy link
Author

AlexanderHolmeset commented Nov 9, 2023 via email

@tehmichael
Copy link

Similar issues here

@timayabi2020
Copy link
Contributor

Hi @AlexanderHolmeset thank you for identifying and logging this issue. As a work around please use the script below to preload the missing DLL from AZ.Accounts module:

# Preload missing System.Memory.Data.dll dependency from Az.Accounts module.
$azAccountsLibPath = Join-Path (Split-Path ((Get-Module Az.Accounts -ListAvailable)[0]).Path -Parent) "lib"
Write-Host "$azAccountsLibPath"
Add-Type -AssemblyName (Join-Path $azAccountsLibPath "netstandard2.0" "System.Memory.Data.dll")

# Connect to Microsoft Graph.
Connect-MgGraph -ManagedIdentity

image

@lorisAmbrozzo
Copy link

lorisAmbrozzo commented Nov 14, 2023

@timayabi2020, thanks for the workaround.

I just added the script block to my script like you did:
image

But I still get an error:
image

I am using Powershell Runtime version 5.1. Does your workaround only work with Powershell Runtime 7.2?

Thanks for the clarification! 😊

@sdfarquhar
Copy link

I think this issue is also breaking the M365 DSC connection cmdlets that I am using with an Azure Automation system managed identity, see my post here: microsoft/Microsoft365DSC#3867

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants