Forum Discussion
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
- lbendlinSuper User
Would you mind pointing to documentation about this new feature?
- lbendlinSuper User
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.
- bengtsson_peterFrequent Visitor
Where do you find domain info from the scan? I can't find anything 😞
- Thor89Frequent Visitor
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:
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.
- bengtsson_peterFrequent Visitor
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:
BUT - if I after the expansion manually add "domainId", I do in fact get the domains!
letSource = 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"
- dtjdtjAdvocate 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.