Forum Discussion
PowerShell script for partition refresh
- Anonymous3 years ago
I have found the solution I just missed to create the security groups in Azure and added that to power Bi Admin portal (developer settings )
You may want to reformulate your question. This is not an issue with partition refresh, it is an issue getting the auth token. (there is one more hurdle - you need to get a token that has the right scope).
How have you configured your Azure app registration?
Yes i have configured your Azure app registration.. can tell me more about the auth token and where i can find it ?
- lbendlin3 years agoSuper User
function GetAuthToken { if(-not (Get-Module AzureRm.Profile)) { Import-Module AzureRm.Profile } $clientId = "<your app id>" $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 } # Get the auth token from AAD $token = GetAuthToken # Building Rest API header with authorization token $authHeader = @{ 'Content-Type'='application/json' 'Authorization'=$token.CreateAuthorizationHeader() }once you have that you can use it in the auth header for your refresh requests. Use jwt.io to validate that the token has the right scope.
- Anonymous3 years agoNot applicable
I tried to run the script.. after chaning the Client id but i am getting this error
AADSTS650057: Invalid resource. The client has requested access to a resource which is not listed in the requested permissions in the client's application registration. Client app ID: 4ac1f38e-ab66-474e-99c6-8d3dcce7be55(Test10). Resource value from request: https://analysis.windows.net/powerbi/api. Resource app ID: 00000009-0000-0000-c000-000000000000. List of valid resources from app registration: 00000003-0000-0000-c000-000000000000
- lbendlin3 years agoSuper User
As I mentioned above it looks like your app registration doesn't have the required scope.