-
Notifications
You must be signed in to change notification settings - Fork 179
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 fails in Azure Automation Account due to a dependency on System.Runtime 8.0.0.0 #3151
Comments
Related issue: #3147 |
Hi @erobillard apologies for that experience. There is an existing issue here azureautomation/runbooks#112, requesting that team to provide an option for 7.4. Meanwhile, you can downgrade to v2.25.0 or use Azure functions. |
Thanks @timayabi2020, a downgrade to 2.25.0 did resolve the issue as a workaround. |
Azure Automation is capped at PowerShell 7.2 which is built upon dotnet 6 which is officially out of support since Nov 12th 2024 🤔 I cannot believe they still don't provide PowerShell 7.4 (dotnet8) for Azure Automation.... |
Workaround:
|
You can also download modules from https://www.powershellgallery.com/packages/Microsoft.Graph/2.25.0 Rename the nupkg file to, for example Microsoft.Graph.zip, or remember to change the name as you upload it to Modules in the Azure Automation Account. Version 2.25.0 worked for me, you shouldn't need to go any earlier. I also find things to be more stable when version numbers match within a namespace like Microsoft.Graph.* |
A workaround is to enable Runtime environment experience (in public preview) and create a custom Runtime environment.
|
Describe the bug
The following 2 lines fail in an Azure Automation Account Runbook (7.2 runtime environment):
Connect-AzAccount -Identity
Connect-MgGraph -Identity
With the error:
Could not load file or assembly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
This was working with the following assemblies all on 2.25.0:
Microsoft.Graph
Microsoft.Graph.Authentication
Microsoft.Graph.Teams
Today the same lines fail with a tenant running these 3 DLLs on version 2.26.0
Expected behavior
The code should authenticate to Graph. All other Runbooks in this same Azure Automation Account succeed when authenticating with a client secret to retrieve a token, i.e.:
$response = Invoke-RestMethod -Method Post -Uri "https://login.microsoftonline.com/$tenantId/oauth2/v2.0/token" -ContentType "application/x-www-form-urlencoded" -Body $body
As soon as the Connect-MgGraph is required (in this case to add a member to a Shared channel in MS-Teams), authentication fails with the error as described.
How to reproduce
Microsoft.Graph
Microsoft.Graph.Authentication
Microsoft.Graph.Teams
Connect-AzAccount -Identity
Connect-MgGraph -Identity
SDK Version
2.26.0
Latest version known to work for scenario above?
2.25.0
Known Workarounds
None I can find.
Debug output
Click to expand log
```The text was updated successfully, but these errors were encountered: