Azure-Samples / powerbi-powershell

Samples for calling the Power BI REST API via PowerShell
MIT License
256 stars 189 forks source link

Doesn't work for me #3

Open pjoshi123 opened 6 years ago

pjoshi123 commented 6 years ago

This script for dataset refresh doesn't work for me. Does it need a gateway, similar to the usual data refresh? I don't have a gateway yet.

guyinacube commented 6 years ago

If it is an on-premises data source, it will need a gateway.

acstaffa commented 6 years ago

I am having this problem... someone could help me?

PS C:\WINDOWS\system32> C:\Users\alexandre.staffa\SUHAI SEGURADORA\Informações de Gestão - Documentos\Atualizar Vendas.ps1

   $adal = "${env:ProgramFiles(x86)}\Microsoft 

SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"

   $adalforms = "${env:ProgramFiles(x86)}\Microsoft 

SDKs\Azure\PowerShell\ServiceManagement\Azure\Services\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll"

   [System.Reflection.Assembly]::LoadFrom($adal) | Out-Null

   [System.Reflection.Assembly]::LoadFrom($adalforms) | Out-Null

   $redirectUri = "urn:ietf:wg:oauth:2.0:oob"

   $resourceAppIdURI = "https://analysis.windows.net/powerbi/api"

   $authority = "https://login.microsoftonline.com/common/oauth2/authorize";

   $authContext = New-Object "Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext" -ArgumentList $authority

   $authResult = $authContext.AcquireToken($resourceAppIdURI, $clientId, $redirectUri, "Auto")

   return $authResult

GetAuthToken : O termo 'GetAuthToken' não é reconhecido como nome de cmdlet, função, arquivo de script ou programa operável. Verifique a grafia do nome ou, se um caminho tiver sido incluído, veja se o caminho está correto e tente novamente. No C:\Users\alexandre.staffa\SUHAI SEGURADORA\Informações de Gestão - Documentos\Atualizar Vendas.ps1:26 caractere:10

Não é possível chamar um método em uma expressão de valor nulo. No C:\Users\alexandre.staffa\SUHAI SEGURADORA\Informações de Gestão - Documentos\Atualizar Vendas.ps1:27 caractere:1

MODO DETALHADO: POST https://api.powerbi.com/v1.0/myorg/groups/blank/datasets/blank/refreshes with 0-byte payload Invoke-RestMethod : O servidor remoto retornou um erro: (403) Proibido. No C:\Users\alexandre.staffa\SUHAI SEGURADORA\Informações de Gestão - Documentos\Atualizar Vendas.ps1:38 caractere:1

MODO DETALHADO: GET https://api.powerbi.com/v1.0/myorg/groups/erased/datasets/erased/refreshes with 0-byte payload Invoke-RestMethod : O servidor remoto retornou um erro: (403) Proibido. No C:\Users\alexandre.staffa\SUHAI SEGURADORA\Informações de Gestão - Documentos\Atualizar Vendas.ps1:40 caractere:1

PS C:\WINDOWS\system32>