Skip to content

dbatools 2.1.31 and MicrosoftTeams 7.1.0 Incompatability in PowerShell 7.5 Microsoft.Identity Assembly Loading Errors #9693

Open
@finnslossdc

Description

@finnslossdc

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

PS C:\> Import-Module dbatools
PS C:\> Import-Module MicrosoftTeams
[ERROR] Import-Module: Could not load file or assembly 'Microsoft.Identity.Client, Version=4.62.0.0, Culture=neutral,
PublicKeyToken=0a613f4dd989e8ae'. The located assembly's manifest definition does not match the assembly reference.
(0x80131040)
PS C:\> Import-Module MicrosoftTeams
PS C:\> Import-Module dbatools
PS C:\> Connect-MicrosoftTeams
[ERROR] Connect-MicrosoftTeams: Could not load file or assembly 'Microsoft.IdentityModel.Abstractions, Version=6.35.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)

Steps to Reproduce

Import-Module dbatools
Import-Module MicrosoftTeams

Or

Import-Module MicrosoftTeams
Import-Module dbatools
Connect-MicrosoftTeams

Please confirm that you are running the most recent version of dbatools

Yes ran Update-Module dbatools and no update was installed.

Other details or mentions

I have this workaround for now:

If MicrosoftTeams is loaded first:
Copying version 6.35.0.41201 of Microsoft.IdentityModel.Abstractions.dll
From
"C:\Program Files\PowerShell\Modules\MicrosoftTeams\7.1.0\net472\Microsoft.IdentityModel.Abstractions.dll"
To (Overwriting version 6.24.0.31013185938)
"C:\Program Files\PowerShell\Modules\dbatools.library\2024.4.12\core\lib\Microsoft.IdentityModel.Abstractions.dll"

If dbatools is loaded first:
Copying version 4.62.0.0 of Microsoft.Identity.Client.dll
From
"C:\Program Files\PowerShell\Modules\MicrosoftTeams\7.1.0\netcoreapp3.1\Microsoft.Identity.Client.dll"
To (Overwriting version 4.53.0.0)
"C:\Program Files\PowerShell\Modules\dbatools.library\2024.4.12\core\lib\win-sqlclient\Microsoft.Identity.Client.dll"

Copying both files from Teams to dbatools means the module loads in any order.
For my purposes this appears to work ok, unsure if this causes any other issues.

What PowerShell host was used when producing this error

PowerShell Core (pwsh.exe)

PowerShell Host Version

Name Value
PSVersion 7.5.0
PSEdition Core
GitCommitId 7.5.0
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

SQL Server Edition and Build number

N/A

.NET Framework Version

.NET 9.0.1

PSChildName Version
Client 4.8.09032
Full 4.8.09032
Client 4.0.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugs lifetriage requiredNew issue that has not been reviewed by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions