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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
rampatel58
Microsoft Employee
Microsoft Employee

Getting error Need admin approval

Hi All,

 

I want to extract dataset refresh history for the dataset. I am using the RESR API in power shell script. I registared native app and provided all the permissions.

created below power shell script.

$clientId = "NativeAppClientId"

# End Parameters =======================================

# Calls the Active Directory Authentication Library (ADAL) to authenticate against AAD
function GetAuthToken
{
if(-not (Get-Module AzureRm.Profile)) {
Import-Module AzureRm.Profile
}

$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()
}
# properly format groups path
$groupsPath = ""
if ($groupID -eq "me") {
$groupsPath = "myorg"
} else {
$groupsPath = "myorg/groups/$groupID"
}

# Check the refresh history
$uri = "https://api.powerbi.com/v1.0/$groupsPath/datasets/$datasetID/refreshes"
Invoke-RestMethod -Uri $uri -Headers $authHeader -Method GET -verbose

While running the above code getting the error "

Need admin approval
 

needs permission to access resources in your organization that only an admin can grant. Please ask an admin to grant permission to this app before you can use it.

Note: I am not the admin of my cloud
 
please help me want need to be done to resove this error. Also what  approval is required and how my admin can provide the access?
2 REPLIES 2
manikumar34
Solution Sage
Solution Sage

@rampatel58 @igajera , 

I'm not clear whther you created Azure application or not. 

If you had created then give Admin permissions to that application on the dataset or report you are trying to export or embed. 

 

Regards, 

Manikumar





If this helps, Appreciate your KUDOS!
Did I answer your question? Mark my post as a solution!


Proud to be a Super User!




igajera
New Member

I am getting the same issue even though I followed the exact steps with their sample application https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-sample-for-your-organization?tabs...

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.