Forum Discussion
Tenant parameter on Connect-PowerBIServiceAccount for all parametersets
- Anonymous1 year ago
Hi powerapps_tec,
Thank you for reaching out to the Microsoft Fabric Forum Community.
If the issue still persists, I’d recommend raising a support ticket with Microsoft. The support team can look into the backend and provide more in depth assistance tailored to your environment.
https://learn.microsoft.com/en-us/power-bi/support/create-support-ticketIf you find this response helpful, please consider marking it as the accepted solution and giving it a thumbs-up to support others in the community.
Thank you & regards,
Prasanna Kumar
Current reality:
-
You cannot today natively pass
-TenantIdand guarantee it will behave as expected across all flows. -
Microsoft sometimes recommends interactive login (ugh, not automation friendly).
-
Some partial workarounds exist using MSAL libraries (manual token fetching) but they are clunky.
Your Alternatives (today):
1. Use -Environment switch
Sometimes specifying
-Environmentlike this can help:
Connect-PowerBIServiceAccount -Environment "Public"
But it won’t switch tenant automatically — this mainly impacts cloud environment, not tenant selection.2. Manually fetch token using MSAL.PS
You can manually fetch a token for the right tenant and then connect:
Install-Module MSAL.PS
$TenantId = "<TenantId>"
$ClientId = "04b07795-8ddb-461a-bbee-02f9e1bf7b46" # Public client ID for Microsoft apps
$Scope = "https://analysis.windows.net/powerbi/api/.default"$AuthResult = Get-MsalToken -TenantId $TenantId -ClientId $ClientId -Scopes $Scope -Interactive
Connect-PowerBIServiceAccount -AccessToken $AuthResult.AccessToken
Note: You'll still need interactive approval unless you have app registration setups.Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!