power bi and powershell - microsoft€¦ · you can still use the power bi mgmt module. photo by...
TRANSCRIPT
Power BI and PowerShellA Match Made in HeavenCraig Porteous
Craig Porteous
https://craigporteous.com
@cporteous
https://github.com/cporteou
https://www.linkedin.com/in/craigporteous/
Data Engineer @ Incremental Group
Worked in BI with the Microsoft stack for more than 10 years.
SQL Glasgow UG co-leader. DATA:Scotland Founder. Microsoft Data Platform MVP
▪Why do we need to manage Power BI?
▪What can we do with PowerShell?
▪API vs PowerShell Module(s);
▪Not an admin? There are still options;
▪Put it into practice.
What we’ll cover
Photo by Glenn Carstens-Peters on Unsplash
Why do we need to manage Power BI?
Error Handling
Control Security
Manage Content
Data
The Power BI Admin Portal
App Engagement info
Organisation level settings
Content Management
What can we do with PowerShell?
Control and audit Permissions
Refresh datasets and view history
Manage Workspaces, Reports, Datasets etc
Track User and Tenant Licenses
Circumvent license restrictions ;)
Au
tom
atio
n
API vs PowerShell Modules
Azure PowerShell Modules• msOnline (v1)• AzureAD (v2)
REST API
Power BI REST API• Using Invoke-RESTMethod• MicrosoftPowerBIMgmt
DEMO
Apps
Data Sources
Dataflows
Groups
Datasets Reports DashboardsGatewaysOn-Premises
Data Sources
Permissions
Features Capacity
Get TablesDeleteRefresh HistoryRefresh datasetEtc…Create
DeleteUpdate
Etc…
Get infoUpdate
Get infoAdd UserDelete UserEtc…
CreateDeleteAdd UserDelete UserEtc…
AddGet infoGet TileClone Tile
Get infoCloneDeleteEtc…
Get InfoAssign Workspace
Get info
https://docs.microsoft.com/en-us/rest/api/power-bi/
REST API Capabilities
Get AppGet DashboardsGet Reports Etc…
Get infoDelete
RefreshEtc…
DEMO
What can’t we do with PowerShell
Read Data
Create Dashboards
Publish or Update Apps
Author Reports
Not an admin?
All is not lost!▪Restricted to Workspaces you are
a member of;
▪Read and start dataset refreshes;
▪View and update security*;
▪Track user and tenant licenses;
▪You can still use the Power BIMgmt module.
Photo by Matthew Garoffolo on Unsplash
▪Authentication options;
▪Prerequisites to automation;
▪Create and update a dataset entirely in PowerShell.
Piecing it all together
Photo by Adam Birkett on Unsplash
Prompted Authentication
MicrosoftPowerBIMgmt
Power BI
CodeData
Auth
Unattended Authentication
AppAuth Token
Power BIAzure
CodeData
PowerBI-MetadataSecure String or
Credential Manager
OR
Service Principals
App
Workspace*Power BI
*This authentication method only works with v2 workspaces
Auth Token
Power BI
CodeData
Requires:Power BI AdminAD Group for Service Principal
DEMO
▪But…
▪Unattended Authentication isn’t “Official”;
▪2FA is not compatible with unattended auth;
▪Automation isn’t simple ….yet!
▪The API is always evolving;
▪Modules are a work in progress – Contribute!
PowerShell ‘s Power BI
Questions?
https://github.com/cporteou/Presentations
Photo by Matt Jones on Unsplash