Issue: "Method 'get_SerializationSettings' does not have an implementation" in Azure devops runtime while connecting to AZ Accounts
I am using Microsoft365DSC version 1.25.219.2 . I am trying to send an email notification once the drift is corrected in devops release pipeline. Using an Axure devops hostpool environment having windows 2019. I am using certificate based authentication and to get the access token, I need to make a connection to Az.Accounts and then get access token by this command $accessToken = Get-AzAccessToken -TenantId $tenantId -ResourceUrl $resourceUrl.
I have tried using Az.Account version 4.0.2 but landed up into this error -
Connect-AzAccount : Method 'get_SerializationSettings' in type 'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient' from assembly 'Microsoft.Azure.PowerShell.Clients.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.
Have tried other methods like downgrading the AZ version to use 2.12.1 , but got other error.
Connect-AzAccount : ClientCertificateCredential authentication failed: Method not found:
'Microsoft.Identity.Client.ConfidentialClientApplicationBuilder Microsoft.Identity.Client.ConfidentialClientApplication
Builder.WithClientAssertion(System.Func2<System.Threading.CancellationToken,System.Threading.Tasks.Task1<System.String>>)'.
The same version of Az.Accounts 4.0.2 in local VM works fine without any errors. What is the issue with the release pipeline in Azure devops runtime environment? how can I resolve this issue.
I saw something similar if multiple versions of the Az.Accounts module were installed at the same time or if there were other modules requiring a higher / lower version of it. M365DSC requires a version of 3.0.2 to be present. So I would go with that version and uninstall other Az modules that are not required.
Hi Fabien, thanks for your response. I see that while using this command, Install-Module Microsoft365DSC -RequiredVersion 1.25.219.2 -Force and Update-M365DSCDependencies, the pnp.powershell module is getting installed . "Installing PnP.PowerShell version {1.12.0}". seems this is causing conflict and issues with connecting to Az.Accounts. If I ran the command to install Az.Accounts 3.0.2 , and the pnp.powershell 1.12.0 is not installed, then it works fine. How can I resolve this?
We currently have an implementation pending for requiring specific dependencies during load time. This might fix your issue. I'll link the PR here: #6191
The dependency PR was successfully merged. @iamarindampal can you try again and check if the issue is still present?