Forum Discussion
Microsoft.PowerBI.Api, dependent on deprecated package Microsoft.Rest.ClientRuntime.
- Anonymous3 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
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