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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
ducky
Helper I
Helper I

API - UpdateGroupAsAdmin - Assign a log analytics workspace

Im trying to assign to each Powerbi workspace a log analytics workspace via API. Below its part of my script that should do that. 
Only showing this as the rest Im sure its working. I believe that something is amiss with the request body. But this is how its constructed in the docs so i have no idea why its not working. 
 (im not using the profile id as its not in the documentation, although I tried with it too) 

 

$workspaceId 
 $profileId 

# Construct the headers and URL for the API call
$SPHeader = @{'X-PowerBI-profile-id' = $profileId}
$url = "https://api.powerbi.com/v1.0/myorg/admin/groups/$workspaceId"

$body = @{
      "logAnalyticsWorkspace" = @{
        "subscriptionId" = "subscriptionId"
        "resourceGroup" = "resourceGroupName"
        "resourceName" = "LogAnalyticsWorkspaceName"
      }
    }

    # Make the API call
    $response = Invoke-PowerBIRestMethod -Method 'Patch' -Url $url -Body $body -Verbose
    $response | ConvertTo-Json

 

1 REPLY 1
lbendlin
Super User
Super User

When you Invoke-PowerBIRestMethod you use relative URIs, not the full URL  (you would use the full URL with Invoke-RestMethod)

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.