Forum Discussion
Power BI API via PowerShell fails in Azure DevOps
The reason I can't use Power BI Actions (I tried!) is that it needs a username and password. This is not acceptible for our clients. Best practice is to use a client id.
Via PowerShell this is 100% possible. In fact the scripts work when I run them locally on my laptop. They seem to get stuck on the authentication part when I run them as part of a DevOps pipeline.
I'm interested in your blog article!
Hi Anonymous
Ok could you please try my script below
$applicationId = "xxxxxxxx"; $securePassword = "xxxxxx" | ConvertTo-SecureString -AsPlainText -Force $credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $applicationId, $securePassword Connect-PowerBIServiceAccount -ServicePrincipal -Credential $credential -TenantId "xxxx"
Which is using the Client ID autentication part.
I've also provided this answer in SO
By this way it will work in both your local and azure devops
- Anonymous7 years agoNot applicable
This doesn't work because the Power BI cmdlets don't accept service principals for most operations. For example:
Therefore I'm trying to login using a native app (instead of web app) using the code I posted in the OP. That works perfectly fine in Windows, just not in DevOps.
- Jayendran7 years ago
Solution Sage
Hi Anonymous
It should work. I think you are in luck today. I've just completed my Article
Download Full code
https://gallery.technet.microsoft.com/AzureDevOps-CICD-for-fefd58b8
I've explained all in details about in this article. It would help you. Best of luck !
- Jayendran7 years ago
Solution Sage
Hi Anonymous
Do you have any update ? If my replay helps please accept it as answer/giving kudos which will help other community members