Forum Discussion
Power BI workspace creation using API
Hi Team,
I am using API (https:// api. powerbi. com/ v1.0/ myorg/ groups) to create a Power BI workspace using java code. For authenticationpurpose I am using Azure Service Principle.
I would like to use User Assigned Managed Identity instead of SP. My code is running in AKS cluster.
Please give me documentation list if any.
What roles we have to assign to User Assigned Managed Identity.
HI jaineshp
We have achieved the target.
Please note that Power BI roles renamed to Fabric.
https://powerbi.microsoft.com/en-us/blog/power-bi-administrator-role-will-be-renamed-to-fabric-administrator/
Steps performed is
1. Workload identity configuration in AKS cluster2. Assign Fabric Administrator role
3. Tenant Setting Location
The setting "Allow service principals to use Power BI APIs" is found at:
- Power BI Admin Portal → Tenant settings → Developer settings
- Look for "Allow service principals to use Power BI APIs"
4. Add UAMI to capacity group in azure
Thank you all..
17 Replies
- jaineshpMemorable Member
Hi Koteswara,
Yes, it’s possible to use User Assigned Managed Identity (UAMI) instead of a Service Principal when calling the Power BI REST API — especially in an AKS (Azure Kubernetes Service) environment. Below is a summary of what you need:
1. Required Roles for UAMI
Assign the following Azure AD and Power BI roles to the UAMI:
Azure AD App Role:
Assign Power BI Service Administrator or Power BI Admin API permission via Microsoft Graph/App Registrations.
Power BI Tenant Setting:
Ensure "Allow service principals to use Power BI APIs" is enabled under Admin Portal > Tenant Settings.
Workspace Access (optional):
For managing content inside the workspace, assign the UAMI as Admin to that workspace (if applicable).
2. Useful Documentation
Here’s the official documentation you’ll find useful:
3. Running in AKS
Since your code runs in AKS:
Ensure your AKS pod is configured with the UAMI using Azure AD Workload Identity or Azure AD Pod Identity (depending on your setup).
Use DefaultAzureCredential (Azure SDK) to authenticate via the managed identity.
Example (Java SDK):
TokenCredential credential = new DefaultAzureCredentialBuilder().build();Let me know if you need a sample token acquisition flow or role assignment script.
—
Best regards,
Jainesh Poojara / Power BI Developer- KoteswaraNew Member
Hi Jainesh Poojara,
Thanks for your reply.
Yes. Workload identity configured to in AKS cluster. I am using UAMI already for azure storage APIs.For Azure storage I am passing scope as https://storage.azure.com/.default
What value we should pass here? Will it accept my old one (Which I am using with SP) https://analysis.windows.net/powerbi/api/.default ?- KoteswaraNew Member
Please note that useful documentation links are not opening. Please do needful
- KoteswaraNew Member
Look like Power Bi roles renamed to Fabric.
https://powerbi.microsoft.com/en-us/blog/power-bi-administrator-role-will-be-renamed-to-fabric-administrator/ - rohit1991Super User
Hi Koteswara ,
Using a User Assigned Managed Identity (UAMI) is fully supported for calling the Power BI REST API from AKS. Here’s the streamlined approach:
1. Scope: Stick with https://analysis.windows.net/powerbi/api/.default as your scope when acquiring tokens for Power BI REST API. This is the same as with a Service Principal.2. Permissions/Roles: Assign your UAMI either the Power BI Service Admin role (for full API control) or just Admin/Member rights on specific workspaces, depending on what your automation needs. In Power BI Admin Portal, make sure “Allow service principals to use Power BI APIs” is enabled—this is required for managed identities too.
3. AKS Setup: If your AKS pod is already using the UAMI for Azure Storage, you’re set. In your Java code, use the Azure SDK’s DefaultAzureCredential to authenticate—no secrets or SP credentials needed.
You don’t have to change your scope or approach when switching from SP to Managed Identity. As long as the right roles are in place and workload identity is configured, UAMI works great for Power BI API automation in AKS. - v-dineshyaCommunity Support
- KoteswaraNew Member
Hi jaineshp , rohit1991 , Poojara_D12 and v-dineshya
Thanks for your assistance.
Allow me for some time. I will check and confirm you here.
Thanks.- KoteswaraNew Member
Hi Team,
I got reply form my IT team saying they did not find respective role.
Please help me
- Poojara_D12Super User
Hi Koteswara
When you want to switch from using a Service Principal (SP) to a User Assigned Managed Identity (UAMI) for creating a Power BI workspace via the Power BI REST API (https://api.powerbi.com/v1.0/myorg/groups) from your Java code running in Azure Kubernetes Service (AKS), the key change is in how you authenticate. Managed identities allow your AKS workloads to obtain Azure AD tokens without storing credentials. You will need to enable Managed Identity for your AKS workload (using Azure AD workload identity or aad-pod-identity) and configure your Java code to acquire an access token from Azure Instance Metadata Service (IMDS) for the Power BI resource (https://analysis.windows.net/powerbi/api). After obtaining the token, you use it as a Bearer token in your REST API calls just like before. The User Assigned Managed Identity must be: (1) granted Power BI Admin or Contributor permissions on the target Power BI tenant through the Microsoft 365 Admin Center (or via Power BI Admin portal, enabling Service Principal access for this identity), and (2) have the Azure role assignment (Reader or Contributor) only if you are managing Azure resources—but for Power BI REST API, the critical step is to allow the identity in the Power BI Admin portal under "Tenant settings → Developer settings → Allow service principals to use Power BI APIs" and optionally assign it to specific security groups. In summary, after assigning the UAMI to AKS, enabling workload identity, and granting API access in the Power BI Admin portal, your Java code can seamlessly authenticate with MSI instead of storing client secrets.