ActiveDirectory.Domains
An Active Directory forest's domains, their object categories and each category's objects with their attributes.
Group: Online services. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
ActiveDirectory.Domains(optional forestRootDomainName as nullable text) as table
| Parameter | Type | Description |
|---|---|---|
forestRootDomainName | nullable text optional | The forest's root domain, such as norwayanalytics.no; left out: this computer's domain. |
Returns
table. Domain and Object Categories, a row per domain of the forest.
Remarks
- Object Categories has Category (user, group, computer, organizationalUnit ...) and Objects. Objects has displayName and distinguishedName, then a record per class the objects are (top, person, user, securityPrincipal ...), holding that class's attributes.
- Attributes are typed as the directory's schema types them: numbers, logicals, datetimes, binaries, texts; an attribute that holds several values gives a list. Expand the records you need with
Table.ExpandRecordColumn. - Signed in with Windows, as you.
Examples
The users and their account names
let
Source = ActiveDirectory.Domains("norwayanalytics.no"),
Categories = Source{[Domain = "norwayanalytics.no"]}[#"Object Categories"],
Users = Categories{[Category = "user"]}[Objects],
Expanded = Table.ExpandRecordColumn(Users, "securityPrincipal", {"sAMAccountName"})
in
Table.SelectColumns(Expanded, {"displayName", "sAMAccountName"})
Result: not shown here: it needs an Active Directory domain.