Forum Discussion

RaghavJev's avatar
RaghavJev
New Member
3 years ago
Solved

Microsoft.PowerBI.Api, dependent on deprecated package Microsoft.Rest.ClientRuntime.

Hi Team,

 

We have a WPF app using Microsoft.PowerBI.Api, which is dependent on Microsoft.Rest.ClientRuntime package, "This package has been deprecated as it is legacy and is no longer maintained."  Suggested alternate for Microsoft.Rest.ClientRuntime is Azure.Core 1.34.0.  However Microsoft.PowerBI.APi is depending on Microsoft.Rest.ClientRuntime packgae.

 

Can someone provide the best approach to fix this?

 

Thanks,

Raghav

  • Anonymous's avatar
    Anonymous
    2 years ago

    HI RaghavJev,

    As the document said the 'Microsoft.Rest.ClientRuntime' package will continue to receive critical bug fixes until September 2023 and you can continuous use these functions until September.

    For migrate from 'Microsoft.Rest.ClientRuntime' to 'Azure.core', you can use the Azure.Core.Pipeline.HttpPipeline class instead of Microsoft.Rest.ServiceClient and use the Azure.Core.TokenCredential class instead Microsoft.Rest.ServiceClientCredentials.

    For example:

    using Azure.Core;
    using Azure.Identity;
    using Azure.Security.KeyVault.Secrets;
    using Microsoft.PowerBI.Api;
    using Microsoft.PowerBI.Api.Models;
    using System;
    
    // Create a new instance of TokenCredential using DefaultAzureCredential
    TokenCredential credential = new DefaultAzureCredential();
    
    // Authenticate with Power BI using TokenCredential
    var client = new PowerBIClient(new Uri("https://api.powerbi.com"), credential);

    The above code uses DefaultAzureCredential to authenticate with Power BI using Azure Active Directory . You can also use other types of credentials, such as ClientSecretCredential, depending on your authentication requirements .

    // create a client
    var client = new SecretClient(new Uri("http://example.com"), new DefaultAzureCredential());

    Regards,

    Xiaoxin Sheng

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI RaghavJev,

    As the document said the 'Microsoft.Rest.ClientRuntime' package will continue to receive critical bug fixes until September 2023 and you can continuous use these functions until September.

    For migrate from 'Microsoft.Rest.ClientRuntime' to 'Azure.core', you can use the Azure.Core.Pipeline.HttpPipeline class instead of Microsoft.Rest.ServiceClient and use the Azure.Core.TokenCredential class instead Microsoft.Rest.ServiceClientCredentials.

    For example:

    using Azure.Core;
    using Azure.Identity;
    using Azure.Security.KeyVault.Secrets;
    using Microsoft.PowerBI.Api;
    using Microsoft.PowerBI.Api.Models;
    using System;
    
    // Create a new instance of TokenCredential using DefaultAzureCredential
    TokenCredential credential = new DefaultAzureCredential();
    
    // Authenticate with Power BI using TokenCredential
    var client = new PowerBIClient(new Uri("https://api.powerbi.com"), credential);

    The above code uses DefaultAzureCredential to authenticate with Power BI using Azure Active Directory . You can also use other types of credentials, such as ClientSecretCredential, depending on your authentication requirements .

    // create a client
    var client = new SecretClient(new Uri("http://example.com"), new DefaultAzureCredential());

    Regards,

    Xiaoxin Sheng