Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Thor89
Frequent Visitor

Setting workspace domain via API

Does anyone know if there is a way to set the new domain feature via the API?

I have more than 1300 workspaces to set and doing that by hand is not really an option.

I've seen that the domain info of a workspace is returned in the Metadata scanning in the API but I've not seen anything in the API documentation on setting the domain of a workspace.

9 REPLIES 9
dtjdtj
Advocate I
Advocate I

Hello,

Any news here? Does anyone know if there's any way to automate domains related tasks (e.g. automatically create domains, automatically assign workspaces to domains, etc)?

Thanks.

bengtsson_peter
Frequent Visitor

Where do you find domain info from the scan? I can't find anything 😞

https://learn.microsoft.com/en-us/rest/api/power-bi/admin/workspace-info-post-workspace-info

I run the metadata scan with all argumets set to true and the domain id is then included in that result set.

Not sure which one of them adds it or it's part of the default execution I at least get it from this call.

Example URL:

https://api.powerbi.com/v1.0/myorg/admin/workspaces/getInfo?lineage=true&datasourceDetails=true&data...

 

Note that this will only get you the domain id of the workspaces that a domain has been set for. It does not allow you to set the domain. I've still not found an API way to do that. I ended up writing a bot to do it via the UI so that I could set the domain on all my orginizations workspaces.

Well, this is a bit wierd... I do the same thing. When I get to the step where I expand the column with the scan records, I only get these columns:

bengtsson_peter_0-1697449977501.png

 

BUT - if I after the expansion manually add "domainId", I do in fact get the domains!

 

let
    Source = Result,
    workspaces = Source[workspaces],
    #"Converted to Table" = Table.FromList(workspaces, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1"{"id", "name", "type", "state", "isOnDedicatedCapacity", "domainId", "reports", "dashboards", "datasets", "dataflows", "datamarts", "users"}, {"workspace_id", "workspaceName", "type", "state", "isOnDedicatedCapacity", "domain_id", "reports", "dashboards", "datasets", "dataflows", "datamarts", "users"}),
  #"Changed column type" = Table.TransformColumnTypes(#"Expanded Column1", {{"workspace_id", type text}, {"workspaceName", type text}, {"type", type text}, {"state", type text}, {"isOnDedicatedCapacity", type logical}, {"domain_id", type text}, {"reports", type any}, {"dashboards", type any}, {"datasets", type any}, {"dataflows", type any}, {"datamarts", type any}, {"users", type any}})
in
    #"Changed column type"

 

 

bengtsson_peter_2-1697451343955.png

 

 

 

I guess my next question is: "How do I get the domain names"?

That's a bit of manual work.

Go to the domain settings in the admin portal, there you'll have a list of all the domains by name.

Click a domain and the settings for that domain will open up, the url will be something like this https://app.powerbi.com/admin-portal/domains/{GUID}?experience=power-bi
You then have the Name of the domain as well as it's GUID in the URL, the GUID is the domain id in the metadata scan.

lbendlin
Super User
Super User

Would you mind pointing to documentation about this new feature?

No wonder they kept quiet about that. Rather intriguing choice of wording.

 

Keep monitoring this page Available Features - REST API (Power BI Power BI REST APIs) | Microsoft Learn - they often update the content when new calls are made available.

Helpful resources

Announcements
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors
Top Kudoed Authors