Skip to content

Microsoft.Graph.Authentication fails in Azure Automation Account due to a dependency on System.Runtime 8.0.0.0Β #3151

@erobillard

Description

@erobillard

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

  1. Create and configure an Azure Automation Account to authenticate as a managed identity. Configure as Powershell, 7.2 runtime environment.
  2. Install these modules:
    Microsoft.Graph
    Microsoft.Graph.Authentication
    Microsoft.Graph.Teams
  3. Confirm the installed version is 2.26.0
  4. Create and execute a runbook with the lines:
    Connect-AzAccount -Identity
    Connect-MgGraph -Identity
  5. 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). 

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions