Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
I've created a service principal in Azure with the below permissions:
This service principal has also been granted access to Fabric APIs, and to Admin APIs in the Fabric Admin console. Additionally, the service principal has been added as an admin for our tenant. I can access regular API endpoints, like Groups, as expected, but when I try to access the Get Activities endpoint in the Admin API, I get a 400 error with nothing in the body. The endpoint I am targetting is https://api.powerbi.com/v1.0/myorg/admin/activityevents.
What am I doing incorrectly when trying to access this API?
Solved! Go to Solution.
Hi @tfanaswala
It sounds like you've set up everything correctly. Since you've got the right permissions and access, the issue is likely with the API request itself. Here are a few things you can check:
1. Check the Request URL:
The Get Activities API needs specific parameters like `startDateTime` and `endDateTime`. Make sure they’re in the correct format (ISO 8601) and within a 30-day range.
Example: https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime=2024-03-01T00:00:00Z&endDateTi...
2. Verify Your Token:
Double-check that you’re using a valid Bearer token with the right scopes. The token should have permissions like `Dataset.Read.All` or `Tenant.Read.All`.
3. Confirm Admin API Access:
Even though the permissions look good, the service principal needs to be explicitly allowed to use the Admin API.
Go to Power BI Admin Portal → Tenant Settings → Admin API Settings and make sure the option "Allow service principals to use read-only Admin APIs" is enabled.
4. Try a Simple API Call:
You could test with PowerShell to rule out other issues. Here’s an example:
powershell
Invoke-RestMethod -Uri "https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime=2024-03-01T00:00:00Z&endDateTi...
5. Check Azure Logs:
If nothing works, check Azure AD logs for any failed sign-ins or authorization issues.
Go to Azure Active Directory → Monitoring → Sign-ins for more details.
If this post was helpful, please consider marking Accept as solution to assist other members in finding it more easily.
If you continue to face issues, feel free to reach out to us for further assistance!
Hi @tfanaswala ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.
Thanks!!
Hi @tfanaswala
It sounds like you've set up everything correctly. Since you've got the right permissions and access, the issue is likely with the API request itself. Here are a few things you can check:
1. Check the Request URL:
The Get Activities API needs specific parameters like `startDateTime` and `endDateTime`. Make sure they’re in the correct format (ISO 8601) and within a 30-day range.
Example: https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime=2024-03-01T00:00:00Z&endDateTi...
2. Verify Your Token:
Double-check that you’re using a valid Bearer token with the right scopes. The token should have permissions like `Dataset.Read.All` or `Tenant.Read.All`.
3. Confirm Admin API Access:
Even though the permissions look good, the service principal needs to be explicitly allowed to use the Admin API.
Go to Power BI Admin Portal → Tenant Settings → Admin API Settings and make sure the option "Allow service principals to use read-only Admin APIs" is enabled.
4. Try a Simple API Call:
You could test with PowerShell to rule out other issues. Here’s an example:
powershell
Invoke-RestMethod -Uri "https://api.powerbi.com/v1.0/myorg/admin/activityevents?startDateTime=2024-03-01T00:00:00Z&endDateTi...
5. Check Azure Logs:
If nothing works, check Azure AD logs for any failed sign-ins or authorization issues.
Go to Azure Active Directory → Monitoring → Sign-ins for more details.
If this post was helpful, please consider marking Accept as solution to assist other members in finding it more easily.
If you continue to face issues, feel free to reach out to us for further assistance!
You were right that there was something wrong with the API call. I needed to wrap the dates in quotation marks, and I was going too far back in time when I was querying for events.
Are you sure the URL is correctly formed with start and end dates in the correct format. Can you share an example URL
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
6 | |
4 | |
2 | |
2 |
User | Count |
---|---|
4 | |
3 | |
3 | |
3 | |
3 |