Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
I have a .NET 8 app connecting to Power BI API using the provided SDK nuget package (Microsoft.PowerBI.Api).
Is there a provided retry handler for bad service codes?
Thank you.
Solved! Go to Solution.
Thank you for the follow-up, you're absolutely right to clarify that Microsoft.PowerBI.Api is not part of the .NET Graph SDK or a NuGet server API.The Power BI .NET SDK (Microsoft.PowerBI.Api) does not have built-in retry logic.
Unlike the Graph SDK, which includes a built-in retry handler for throttling (like 429s or 5xx errors), the Power BI SDK is a more lightweight wrapper over the REST API. That means you’ll need to implement your own retry mechanism if you want to handle transient faults or throttling scenarios.
A common approach is to use a library like Polly to define a retry policy. Here’s an example of how that might look in C#:
var retryPolicy = Policy
.Handle<HttpRequestException>()
.OrResult<HttpResponseMessage>(r =>
(int)r.StatusCode == 429 || (int)r.StatusCode >= 500)
.WaitAndRetryAsync(3, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
var result = await retryPolicy.ExecuteAsync(() =>
powerBIClient.Reports.GetReportInGroupAsync(groupId, reportId));
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! |
Regards,
B Manikanteswara Reddy
Hi @nelsonnyland ,
Thank you for reaching out to Microsoft Fabric Community Forum.
Any GET request made to a API endpoint may return an HTTP redirect (301 or 302). Clients should gracefully handle such redirects by observing the Location header and issuing a subsequent GET. Documentation concerning specific endpoints will not explicitly call out where redirects may be used.
In the case of a 500-level status code, the client can implement a reasonable retry mechanism. The official NuGet client retries three times when encountering any 500-level status code or TCP/DNS error.
Please refer the below documents for better understanding.
Overview of the NuGet Server API | Microsoft Learn
NuGet.org Frequently-Asked Questions | Microsoft Learn
.NET Graph SDK v5 RetryHandler question - Microsoft Q&A
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! |
Regards,
B Manikanteswara Reddy
Hi Manikanteswara,
It looks like there is some misunderstanding. I am looking for information regarding (Microsoft.PowerBI.Api). This is not a .NET Graph SDK, and as far as I know this is not a NuGet Server API. I have not been able to find any documentation specifically about the Power BI SDK that states whether it has a retry mechanism. Given that the .NET Graph SDK comes with retry handling, I would not be surprised if that was indeed the case.
Regards,
Nelson Nyland
Thank you for the follow-up, you're absolutely right to clarify that Microsoft.PowerBI.Api is not part of the .NET Graph SDK or a NuGet server API.The Power BI .NET SDK (Microsoft.PowerBI.Api) does not have built-in retry logic.
Unlike the Graph SDK, which includes a built-in retry handler for throttling (like 429s or 5xx errors), the Power BI SDK is a more lightweight wrapper over the REST API. That means you’ll need to implement your own retry mechanism if you want to handle transient faults or throttling scenarios.
A common approach is to use a library like Polly to define a retry policy. Here’s an example of how that might look in C#:
var retryPolicy = Policy
.Handle<HttpRequestException>()
.OrResult<HttpResponseMessage>(r =>
(int)r.StatusCode == 429 || (int)r.StatusCode >= 500)
.WaitAndRetryAsync(3, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
var result = await retryPolicy.ExecuteAsync(() =>
powerBIClient.Reports.GetReportInGroupAsync(groupId, reportId));
If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! |
Regards,
B Manikanteswara Reddy
Hi @nelsonnyland ,
We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Please don't forget to give a "Kudos |
Regards,
B Manikanteswara Reddy
User | Count |
---|---|
5 | |
5 | |
3 | |
2 | |
2 |
User | Count |
---|---|
9 | |
7 | |
5 | |
4 | |
4 |