Forum Discussion
ducky
1 year agoAdvocate 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
- lbendlinSuper User
When you Invoke-PowerBIRestMethod you use relative URIs, not the full URL (you would use the full URL with Invoke-RestMethod)