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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
bsmucker
Frequent Visitor

Power BI Embedded | Automate configuring Azure Log Analytics for Power BI

Hello all,

 

Following up on a related post for Power BI Premium workspaces, I am attempting to script a process using service principal authentication to add hundreds of workspaces on Power BI embedded SKUs to Log Analytics workspaces.

 

Similar to the user's post in the related thread, the goal is to connect the workspaces to Log Analytics and automate the process described here: Configure Azure Log Analytics for Power BI

bsmucker_1-1738211141466.png

 

So far, I cannot figure out how to script this process using a service principal and API commands. The closest lead I've found has been the Admin - Groups UpdateGroupAsAdmin API,  but I receive a 401 Unauthorized response when using a service principal that is both a Fabric Administrator and has Tenant.ReadWrite.All permissions as well as Contribtor permissions on the subscription.

 

The request body for this API call appears to have all of the information we would need to configure the Power BI workspace to use Log Analytics:

 

{
  "logAnalyticsWorkspace": {
    "subscriptionId": "d778934f-bda2-41d9-b5c7-6cf41372c1a0",
    "resourceGroup": "myResourceGroup",
    "resourceName": "myLogAnalyticsWorkspace"
  }
}

 

 

If I run the following command that is similar to the one cited in the linked post, I receive a list of Log Analytics workspaces on my subscription, but not a list of resource IDs for the Power BI workspaces for which I want to configure Log Analytics:

 

az resource list --resource-type "Microsoft.OperationalInsights/workspaces"

 


Additionally, not only do we want to connect all workspaces that currently existin our embedded capacity / resource group / subscription, but also we wish to automatically add new ones that are created and added to capacities automatically during onboarding.

 

Has anyone else had success automating configuring Azure Log Analytics for Power BI at scale?

 

 

3 REPLIES 3
lbendlin
Super User
Super User

 I am attempting to script a process using service principal authentication to add hundreds of workspaces on Power BI embedded SKUs to Log Analytics workspaces.

I hope you are aware of the cost implications?

Yes, but it is a project requirement.

Examine the token at jwt.io - you will likely find that the scope is missing. Start over with a fresh app registration, thistime don't use delegated permissions.

Helpful resources

Announcements
Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

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.