Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2023 01:26 PM
You don't need to generate the üat token for the service principal. You can take just a token from the Azure ad app (service principal). You can also generate a short live token before the call (by assigning the service principal as the managed identity for your resource).
For PowerBI, change the dataset owner to service principal, so there is no need for the token:
# Define variables
$workspaceId = "your_workspace_id"
$servicePrincipalId = "your_service_principal_id"
$tenantId = "your_tenant_id"
# Authenticate with Power BI service
Connect-PowerBIServiceAccount
# Get the current workspace object
$workspace = Get-PowerBIWorkspace -Id $workspaceId
# Set the new owner to the service principal
$newOwner = New-PowerBIPrincipal -ObjectId $servicePrincipalId -TenantId $tenantId -PrincipalType ServicePrincipal
# Change the workspace owner
Set-PowerBIWorkspace -Workspace $workspace -NewOwner $newOwner
My blog: https://databrickster.medium.com/