Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
villasenorbritt
Resolver I
Resolver I

API Request Blocked by Keyblocker

I am getting an error when trying to push data into Bi from SQL via Powershell. It says that ""The request was blocked by Keyblocker". I tried limiting my query to under 10,000 rows with no luck. Here is my code:

 

(PowerShell)

$dataSource = '******' #Server Name
$userName = '****** ' #SQL User Name
$password = '*********' #SQL User Password
$database = '*******' #Database Name

$connectionString ="Server=$dataSource;Database=$database;trusted_connection=false; user id =$userName;Password=$password;Integrated Security=False"
$connection = New-Object System.Data.SqlClient.SqlConnection
$connection.ConnectionString = $connectionString
$connection.Open()

$query = '  
  SELECT [data],[datetime], [id], [source_id] FROM [dbo].[vwResawLine2FPM] 
  '
$command = $connection.CreateCommand()
$command.CommandText = $query
$dataset = $command.ExecuteReader()
#paste the endpoint URL which you have inside Power BI
$endpoint = "ENDPOINT"
#push data to Power BI 
while ($dataset.Read()) {
    $payload = @{
                "data" =$dataset['data']
                "datetime" =$dataset['datetime']
                "source_id" =$dataset['source_id']
		"id" =$dataset['id']
    } 
    Invoke-RestMethod -Method Post -Uri "$endpoint" -Body (ConvertTo-Json @($payload))
}
$connection.Close();
$connection.Dispose();

 

 

I am hoping someone here has an indication of the issue. Basically, there is not much online explaining what this issue could be outside of the info found in the normal documentation, and I believe I have abided by the API limitations. 

2 REPLIES 2
v-yueyunzh-msft
Community Support
Community Support

Hi , @villasenorbritt 

According to the error message you encounter, it seems that your API request is blocked by the policy of your network environment or the firewall on the data source side, because as far as I know, there is generally no firewall setting on the Power BI side that will block the request, you can refer to a few similar cases and contact your company's network administrator to do some troubleshooting:

API - Keyblocker - Microsoft Power BI Community

Getting "The request is blocked" when accessing Po... - Power Platform Community (microsoft.com)

Vague "The request is blocked" when navigating to website - - Microsoft Community

 

Best Regards,

Aniya Zhang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

I am being told this error could also be due to me being rate limited when usign the API. Would you know any good resources for how to change my script so that it pipes everything into a variable as opposed to making so many API calls?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.