power bi and powershell - microsoft€¦ · you can still use the power bi mgmt module. photo by...

20
Power BI and PowerShell A Match Made in Heaven Craig Porteous

Upload: others

Post on 01-May-2020

19 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

Power BI and PowerShellA Match Made in HeavenCraig Porteous

Page 2: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

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

Page 3: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;
Page 4: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

▪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

Page 5: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

Why do we need to manage Power BI?

Error Handling

Control Security

Manage Content

Data

Page 6: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

The Power BI Admin Portal

App Engagement info

Organisation level settings

Content Management

Page 7: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

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

Page 8: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

API vs PowerShell Modules

Azure PowerShell Modules• msOnline (v1)• AzureAD (v2)

REST API

Power BI REST API• Using Invoke-RESTMethod• MicrosoftPowerBIMgmt

Page 9: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

DEMO

Page 10: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

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…

Page 11: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

DEMO

Page 12: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

What can’t we do with PowerShell

Read Data

Create Dashboards

Publish or Update Apps

Author Reports

Page 13: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

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

Page 14: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

▪Authentication options;

▪Prerequisites to automation;

▪Create and update a dataset entirely in PowerShell.

Piecing it all together

Photo by Adam Birkett on Unsplash

Page 15: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

Prompted Authentication

MicrosoftPowerBIMgmt

Power BI

CodeData

Auth

Page 16: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

Unattended Authentication

AppAuth Token

Power BIAzure

CodeData

PowerBI-MetadataSecure String or

Credential Manager

OR

Page 17: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

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

Page 18: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

DEMO

Page 19: Power BI and PowerShell - Microsoft€¦ · You can still use the Power BI Mgmt module. Photo by Matthew Garoffolo on Unsplash Authentication options; Prerequisites to automation;

▪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