Skip to content

Error Acquiring Token / Unable to load System.Diagnostics.DiagnosticSource #433

Description

Good afternoon,

We've been receiving the following error when running Connect-PowerBIServiceAccount -ServicePrincipal after updating to version 1.3.80:

Connect-PowerBIServiceAccount : One or more errors occurred. (Error Acquiring Token:
System.IO.FileLoadException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)
File name: 'System.Diagnostics.DiagnosticSource, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
 ---> System.IO.FileLoadException: Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at System.Reflection.Assembly.LoadFromResolveHandler(Object sender, ResolveEventArgs args)
   at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)
   at System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(RuntimeAssembly assembly, String assemblyFullName)
   at Microsoft.Identity.Client.Platforms.Features.OpenTelemetry.OtelInstrumentation..ctor()
   at Microsoft.Identity.Client.PlatformsCommon.Shared.AbstractPlatformProxy.InternalGetOtelInstrumentation()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
--- End of stack trace from previous location ---
   at System.Lazy`1.CreateValue()
   at Microsoft.Identity.Client.PlatformsCommon.Shared.AbstractPlatformProxy.get_OtelInstrumentation()
   at Microsoft.Identity.Client.Internal.Requests.RequestBase.LogFailureTelemetryToOtel(String errorCodeToLog, ApiIds apiId, CacheRefreshReason cacheRefreshReason)
   at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync(CancellationToken cancellationToken)
   at Microsoft.Identity.Client.ApiConfig.Executors.ConfidentialClientExecutor.ExecuteAsync(AcquireTokenCommonParameters commonParameters, AcquireTokenForClientParameters clientParameters, CancellationToken cancellationToken)
   at Microsoft.PowerBI.Common.Authentication.ServicePrincipalAuthenticationFactory.Authenticate(String clientId, SecureString clientSecret, IPowerBIEnvironment environment, IPowerBILogger logger, IPowerBISettings settings))

Output of Get-Module -ListAvailable MicrosoftPowerBIMgmt*:

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Manifest   1.3.80                MicrosoftPowerBIMgmt                Desk      
Binary     1.3.80                MicrosoftPowerBIMgmt.Admin          Desk      {Add-PowerBIEncryptionKey, Get-PowerBIE…
Binary     1.3.80                MicrosoftPowerBIMgmt.Capacities     Desk      Get-PowerBICapacity
Binary     1.3.80                MicrosoftPowerBIMgmt.Data           Desk      {Add-PowerBIDataset, Set-PowerBITable, …
Binary     1.3.80                MicrosoftPowerBIMgmt.Profile        Desk      {Connect-PowerBIServiceAccount, Disconn…
Binary     1.3.80                MicrosoftPowerBIMgmt.Reports        Desk      {Get-PowerBIReport, New-PowerBIReport, …
Binary     1.3.80                MicrosoftPowerBIMgmt.Workspaces     Desk      {Get-PowerBIWorkspace, Get-PowerBIWorks…

Full command:

$password = ConvertTo-SecureString $clientSecret -AsPlainText -Force
$credentials = New-Object System.Management.Automation.PSCredential ("$clientId", $password)
Connect-PowerBIServiceAccount -ServicePrincipal -Credential $credentials -Tenant "$tenantId"

I have verified that this works with version 1.2.1111 of the module.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions