-
Notifications
You must be signed in to change notification settings - Fork 200
Description
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
- Create and configure an Azure Automation Account to authenticate as a managed identity. Configure as Powershell, 7.2 runtime environment.
- Install these modules:
Microsoft.Graph
Microsoft.Graph.Authentication
Microsoft.Graph.Teams - Confirm the installed version is 2.26.0
- Create and execute a runbook with the lines:
Connect-AzAccount -Identity
Connect-MgGraph -Identity - Watch it fail.
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
```</details>
### Configuration
Azure Powershell 7.2 Runbook
### Other information
Someone compiled this with a dependency on System.Runtime 8.0 rather than the latest available to an Azure Automation Account, and there's no way to force the version (i.e., set a -RequiredVersion parameter).