This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreDid you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now
We're excited to announce the release of Power BI APIs .NET SDK v3.
The new version is easier to use, have additional capabilities including the new credentials classes and easier way to encrypt credentials.
According to Microsoft Lifecycle Policy, as new versions are released, the previous version will eventually be retired. The Power BI APIs .NET SDK v2 is now deprecated, and will be retired in 24 months (February 2022). We might make exceptions to this policy for service security or health reliability issues.
We strongly recommend that you migrate to the latest version as soon as possible, new APIs will only be added to the Power BI APIs .NET SDK v3.
v3 release is not compatible with previous versions, code changes are required when updating to v3.
The Power BI APIs .NET SDK is released as Microsoft.PowerBI.Api NuGet package.
GatewayPublicKey publicKey = new GatewayPublicKey
{
Exponent = "...",
Modulus = "..."
};
CredentialsBase credentials = new BasicCredentials("<USER>", "<PASSWORD>");
var credentialsEncryptor = new AsymmetricKeyEncryptor(publicKey);
var credentialDetails = new CredentialDetails(credentials, PrivacyLevel.None, EncryptedConnection.Encrypted, credentialsEncryptor);
| var reports = await client.Reports.GetReportsInGroupAsync(WorkspaceId); |
| var reports = await client.Reports.GetReportsInGroupAsync(new Guid(WorkspaceId)); |
Change in response handling if a string is expected:
| report = reports.Value.FirstOrDefault(r => r.Id.Equals(ReportId, StringComparison.InvariantCultureIgnoreCase)); |
| report = reports.Value.FirstOrDefault(r => r.Id.ToString().Equals(ReportId, StringComparison.InvariantCultureIgnoreCase)); |
Change in Generate token:
| var tokenResponse = await client.Reports.GenerateTokenInGroupAsync(WorkspaceId, report.Id, generateTokenRequestParameters); |
| var tokenResponse = await client.Reports.GenerateTokenInGroupAsync(new Guid(WorkspaceId), report.Id, generateTokenRequestParameters); |
Change in Generate token response handling if a string is expected:
| m_embedConfig.Id = report.Id; |
| m_embedConfig.Id = report.Id.ToString(); |
Required fields are not nullable, i.e. Expiration is not nullable and the Value property should be removed:
| var minutesToExpiration = EmbedToken.Expiration.Value - DateTime.UtcNow; |
| var minutesToExpiration = EmbedToken.Expiration - DateTime.UtcNow; |
Consistency on operations names, i.e. use GetDataset instead of GetDatasetById:
| var datasets = await client.Datasets.GetDatasetByIdInGroupAsync(WorkspaceId, report.DatasetId); |
| var datasets = await client.Datasets.GetDatasetInGroupAsync(new Guid(WorkspaceId), report.DatasetId); |
That’s all for this post. We hope you found it useful.
We recommend that you start adopting Power BI APIs .NET SDK version 3 as soon as you can.
Please share your feedback with us, if you want to read more:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.