The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
$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
When you Invoke-PowerBIRestMethod you use relative URIs, not the full URL (you would use the full URL with Invoke-RestMethod)