Connect-PowerBIServiceAccount: Failed to populate environments in settings

Views: 64
Reading Time: 3 minutes

Introduction

Speak guys !!

In this post, I would like to demonstrate to you the solution to a problem that happened to me a few days ago, when the routine of automatic update of the Power BI data set (Using PowerShell and the API with Agent or SSIS to Automate Updating a Power BI Data Set) stopped updating, displaying the error message below:

Connect-PowerBIServiceAccount: Failed to populate environments in settings

This feature is very interesting, as it allows you to use PowerShell Cmdlets to update data sets from Power BI after performing the data update on the data sources, avoiding the need to have to synchronize the data update on the source and update the data. dataset in Power BI.

How to fix the problem

The solution to this problem turns out to be very simple: Just update the Power BI Cmdlets on your server. To find out if you are using the most current version quickly, just try to install the cmdlets again using the command below:

If you see a message like the message below, your cmdlet version is out of date:

If this is the case, we will remove the current version and perform a new installation. To do this, navigate to the “C: \ Program Files \ WindowsPowerShell \ Modules” directory and remove the directories highlighted below:

After removing these directories, try installing the cmdlets again:

Ready! Your Powershell scripts for managing Power BI are now up to date and working properly:

If your PowerShell finds an error while trying to run the Install-Module command, it is because your machine is still using PowerShell 4.0 or earlier. If this is your case, you will need to install the Windows Management Framework 5.1 to add this module to your PowerShell. If you want to update your Powershell to the latest version, access this link here.

If you want to know more about how to update the Power BI dataset using PowerShell cmdlets, be sure to read my article Using PowerShell and the API with Agent or SSIS to Automate Updating a Power BI Data Set.

So that's it, guys!
I hope you enjoyed this solution to a very simple problem to solve, but it doesn't have a lot of documentation on the Internet.

A big hug and until next time!