In this camp session, we'll explore how to get started writing and testing PowerShell scripts to automate common administrative tasks in a Power BI environment. We'll begin by introducing the Power BI cmdlets library and discussing the various ways to authenticate both as a user and as a service principal. Campers will learn how to use PowerShell to automate common tasks such as uploading PBIX files, patching datasource credentials, updating dataset parameters and refreshing datasets.
The session will also explore advanced scripting techniques using the Invoke-PowerBIRestMethod cmdlet which makes it possible to call Power BI Service API operations directly. Campers will learn how to parse together REST URLs for the Power BI Service API and to convert PowerShell objects into JSON to populate the body of an HTTP request. This, in turn, will allow campers to write PowerShell scripts that take full advantage of what the Power BI Service API has to offer.
What Campers Will Learn:
- Install the Power BI cmdlet library for PowerShell
- Authenticate to the Power BI Service as a User and as a Service Principal
- Write scripts to create new workspaces and to manage workspace users
- Write scripts to upload PBIX files, patch datasource credentials and refresh datasets.
- Call Power BI Service API operations directly using Invoke-PowerBiRestMethod
- Export event activity from the Power BI activity log to monitor usage
To make the most of this session, it is recommended (but not required) that campers have prior experience writing and testing PowerShell scripts using the Windows PowerShell Integrated Scripting Environment (ISE).