[MUSIC]
>> Module 7, Automate Solution Management.
I'm Peter Myers, the course developer.
>> I'm Amit Shuster, product
manager for Power BI Embedded Analytics.
>> In this video, we'll describe
how to automate solution management,
automation libraries, and how
to use workspace-based isolation.
Let's now start with automating solution management.
>> Developing an automation solution is typically
useful when you need to reproduce management steps.
It can results in faster and more accurate management.
For example, it can be used for lifecycle management,
onboarding new customers in a multi-tenancy solution,
or for IT operations.
>> We'll discuss multi-tenant solution design
later in this video.
There are three automation libraries you can
use: the Microsoft Graph API,
the Power BI API,
and the Azure Resource Management (or ARM API).
>> Use the Microsoft Graph API to
manage cloud service resources.
For example, it can be used to create an app,
create a service principal,
and create a service principal secret.
Note that these operations are also
available with the Azure command line interface (CLI).
Let me now show you an example.
In the first code fragment that you can see here,
the graph API is used to authenticate to
Azure and getting the Azure AD user.
Next, we want to create the app secret,
so we need to configure the password credential object.
Then we will create
a new Azure AD application
by specifying all these parameters.
Lastly, we will create the app service principal.
We will assign the current user as the app owner,
and we will add a service principal of
the new app as a member of the security group.
Use the Power BI REST APIs
to access and manage Power BI content.
For example, you can create a workspace,
assign a workspaces to a capacity,
grant workspace access, and also import content.
Let me now show you an example.
In this fragment of script,
we're going to add the service principal
as a workspace admin
and we're going to import
the Power BI Desktop file to this workspace.
Use the Azure Resource Management API
to manage a capacity.
For example, you can create and delete capacities,
suspend or resume a capacity,
scale a capacity up or down,
or test for the existence of a capacity.
Note that these APIs are
only relevant for the Azure SKUs.
>> The separation of tenants can be achieved in
the Power BI service by
creating one workspace per tenant.
Each workspace then contains
the relevant Power BI artifacts for that tenant.
Also, each workspace is
connected only to that tenant's data.
To add additional isolation and scalability,
you can define a dedicated service principal
for each tenant and workspace.
The setup of each tenant can be
achieved with automation scripts,
as we've just described.
>> There are two steps to follow.
Here is how it's done.
First, you need to create a service principal and
add service principal as
a contributor to your "golden workspace".
>> What do we mean by a "golden workspace", Amit?
>> A "golden workspace" is a workspace where I have
my master report that I
can go and clone to my different tenants.
Now using new service principal,
you can create a new workspace for the new tenant,
publish the golden content,
that we just described as
the master report, into the new workspace.
Then you can update the datasets
to connect to real tenant data,
either update the data source or import
the new datasets to this workspace.
Lastly, assign the new workspaces
to a capacity to go to production.
>> Well, let's see how this flow works in action.
Workspace isolation ensures that a workspace per
tenant contains all the required Power BI content.
First, we create that "golden workspace" containing
all Power BI artifacts ready
for replication for each tenant.
Create a specific instance,
in this case, for Tenant 1,
by creating a new workspace using
the service principal and
cloning the "golden workspace" artifacts.
The dataset is updated to access
Tenant 1 data and we can use
automation scripts to do all of this setup.
Finally, we can add the new workspace to a capacity.
Again, you can use automation scripts to do this setup.
>> When we're ready to onboard a new tenant,
we can just repeat these steps.
We will have a Service Principal 2 that will
create the Tenant 2 workspace,
and we'll clone the data,
and finally, assign capacity to it.
>> Great. In the next video,
I'll show you how to onboard
a new workspace using a PowerShell script.