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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Provided Powershell via GUI for Data Streaming API - does not work - 401 unauthorized

Streaming datasets, when you create one for API use, it provides Raw/CURL/Powershell examples. I run these exactly as they are and they will not work. If i use the powershell module for PowerBIMgmt it works with my own credentials, but not with the provided code that is supposed to cookie-cutter work in all scenarios.

 

Example from the Power BI dashboard:

$payload = @{
"Cloud Defender Score" =98.6
"Protected Servers" =98.6
"Unprotected Servers" =98.6
"Total Protected Resources" =98.6
}
Invoke-RestMethod -Method Post -Uri "$endpoint" -Body (ConvertTo-Json @($payload))
 
 
Result:
Invoke-RestMethod : The remote server returned an error: (401) Unauthorized. At line:69 char:1 + Invoke-RestMethod -Method Post -Uri "$endpoint" -Body (ConvertTo-Json ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
 
This will occur when using it from powershell terminal interactively or with azure automation accounts.

 

Status: Investigating

Hi @bmelton,

 

May I know which api are you using? Is there any official document including the examples that you refer to?  

 

Best Regards,

Community Support Team _ Caiyun

Comments
v-cazheng-msft
Community Support
Status changed to: Investigating

Hi @bmelton,

 

May I know which api are you using? Is there any official document including the examples that you refer to?  

 

Best Regards,

Community Support Team _ Caiyun