azuread.getDomains
Explore with Pulumi AI
Use this data source to access information about existing Domains within Azure Active Directory.
API Permissions
The following API permissions are required in order to use this data source.
When authenticated with a service principal, this data source requires one of the following application roles: Domain.Read.All or Directory.Read.All
When authenticated with a user principal, this data source does not require any additional roles.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";
const aadDomains = azuread.getDomains({});
export const domainNames = aadDomains.then(aadDomains => aadDomains.domains.map(__item => __item.domainName));
import pulumi
import pulumi_azuread as azuread
aad_domains = azuread.get_domains()
pulumi.export("domainNames", [__item.domain_name for __item in aad_domains.domains])
package main
import (
	"github.com/pulumi/pulumi-azuread/sdk/v6/go/azuread"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
aadDomains, err := azuread.GetDomains(ctx, &azuread.GetDomainsArgs{
}, nil);
if err != nil {
return err
}
ctx.Export("domainNames", pulumi.StringArray(%!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ example.pp:3,11-43)))
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureAD = Pulumi.AzureAD;
return await Deployment.RunAsync(() => 
{
    var aadDomains = AzureAD.GetDomains.Invoke();
    return new Dictionary<string, object?>
    {
        ["domainNames"] = aadDomains.Apply(getDomainsResult => getDomainsResult.Domains).Select(__item => __item.DomainName).ToList(),
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuread.AzureadFunctions;
import com.pulumi.azuread.inputs.GetDomainsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var aadDomains = AzureadFunctions.getDomains();
        ctx.export("domainNames", aadDomains.applyValue(getDomainsResult -> getDomainsResult.domains()).stream().map(element -> element.domainName()).collect(toList()));
    }
}
Coming soon!
Using getDomains
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getDomains(args: GetDomainsArgs, opts?: InvokeOptions): Promise<GetDomainsResult>
function getDomainsOutput(args: GetDomainsOutputArgs, opts?: InvokeOptions): Output<GetDomainsResult>def get_domains(admin_managed: Optional[bool] = None,
                include_unverified: Optional[bool] = None,
                only_default: Optional[bool] = None,
                only_initial: Optional[bool] = None,
                only_root: Optional[bool] = None,
                supports_services: Optional[Sequence[str]] = None,
                opts: Optional[InvokeOptions] = None) -> GetDomainsResult
def get_domains_output(admin_managed: Optional[pulumi.Input[bool]] = None,
                include_unverified: Optional[pulumi.Input[bool]] = None,
                only_default: Optional[pulumi.Input[bool]] = None,
                only_initial: Optional[pulumi.Input[bool]] = None,
                only_root: Optional[pulumi.Input[bool]] = None,
                supports_services: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetDomainsResult]func GetDomains(ctx *Context, args *GetDomainsArgs, opts ...InvokeOption) (*GetDomainsResult, error)
func GetDomainsOutput(ctx *Context, args *GetDomainsOutputArgs, opts ...InvokeOption) GetDomainsResultOutput> Note: This function is named GetDomains in the Go SDK.
public static class GetDomains 
{
    public static Task<GetDomainsResult> InvokeAsync(GetDomainsArgs args, InvokeOptions? opts = null)
    public static Output<GetDomainsResult> Invoke(GetDomainsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetDomainsResult> getDomains(GetDomainsArgs args, InvokeOptions options)
public static Output<GetDomainsResult> getDomains(GetDomainsArgs args, InvokeOptions options)
fn::invoke:
  function: azuread:index/getDomains:getDomains
  arguments:
    # arguments dictionaryThe following arguments are supported:
- AdminManaged bool
- Set to trueto only return domains whose DNS is managed by Microsoft 365. Defaults tofalse.
- IncludeUnverified bool
- Set to trueif unverified Azure AD domains should be included. Defaults tofalse.
- OnlyDefault bool
- Set to trueto only return the default domain.
- OnlyInitial bool
- Set to trueto only return the initial domain, which is your primary Azure Active Directory tenant domain. Defaults tofalse.
- OnlyRoot bool
- Set to trueto only return verified root domains. Excludes subdomains and unverified domains.
- SupportsServices List<string>
- A list of supported services that must be supported by a domain. Possible values include - Email,- Sharepoint,- EmailInternalRelayOnly,- OfficeCommunicationsOnline,- SharePointDefaultDomain,- FullRedelegation,- SharePointPublic,- OrgIdAuthentication,- Yammerand- Intune.- Note on filters If - include_unverifiedis set to- true, you cannot specify- only_defaultor- only_initial. Additionally, you cannot combine- only_defaultwith- only_initial.
- AdminManaged bool
- Set to trueto only return domains whose DNS is managed by Microsoft 365. Defaults tofalse.
- IncludeUnverified bool
- Set to trueif unverified Azure AD domains should be included. Defaults tofalse.
- OnlyDefault bool
- Set to trueto only return the default domain.
- OnlyInitial bool
- Set to trueto only return the initial domain, which is your primary Azure Active Directory tenant domain. Defaults tofalse.
- OnlyRoot bool
- Set to trueto only return verified root domains. Excludes subdomains and unverified domains.
- SupportsServices []string
- A list of supported services that must be supported by a domain. Possible values include - Email,- Sharepoint,- EmailInternalRelayOnly,- OfficeCommunicationsOnline,- SharePointDefaultDomain,- FullRedelegation,- SharePointPublic,- OrgIdAuthentication,- Yammerand- Intune.- Note on filters If - include_unverifiedis set to- true, you cannot specify- only_defaultor- only_initial. Additionally, you cannot combine- only_defaultwith- only_initial.
- adminManaged Boolean
- Set to trueto only return domains whose DNS is managed by Microsoft 365. Defaults tofalse.
- includeUnverified Boolean
- Set to trueif unverified Azure AD domains should be included. Defaults tofalse.
- onlyDefault Boolean
- Set to trueto only return the default domain.
- onlyInitial Boolean
- Set to trueto only return the initial domain, which is your primary Azure Active Directory tenant domain. Defaults tofalse.
- onlyRoot Boolean
- Set to trueto only return verified root domains. Excludes subdomains and unverified domains.
- supportsServices List<String>
- A list of supported services that must be supported by a domain. Possible values include - Email,- Sharepoint,- EmailInternalRelayOnly,- OfficeCommunicationsOnline,- SharePointDefaultDomain,- FullRedelegation,- SharePointPublic,- OrgIdAuthentication,- Yammerand- Intune.- Note on filters If - include_unverifiedis set to- true, you cannot specify- only_defaultor- only_initial. Additionally, you cannot combine- only_defaultwith- only_initial.
- adminManaged boolean
- Set to trueto only return domains whose DNS is managed by Microsoft 365. Defaults tofalse.
- includeUnverified boolean
- Set to trueif unverified Azure AD domains should be included. Defaults tofalse.
- onlyDefault boolean
- Set to trueto only return the default domain.
- onlyInitial boolean
- Set to trueto only return the initial domain, which is your primary Azure Active Directory tenant domain. Defaults tofalse.
- onlyRoot boolean
- Set to trueto only return verified root domains. Excludes subdomains and unverified domains.
- supportsServices string[]
- A list of supported services that must be supported by a domain. Possible values include - Email,- Sharepoint,- EmailInternalRelayOnly,- OfficeCommunicationsOnline,- SharePointDefaultDomain,- FullRedelegation,- SharePointPublic,- OrgIdAuthentication,- Yammerand- Intune.- Note on filters If - include_unverifiedis set to- true, you cannot specify- only_defaultor- only_initial. Additionally, you cannot combine- only_defaultwith- only_initial.
- admin_managed bool
- Set to trueto only return domains whose DNS is managed by Microsoft 365. Defaults tofalse.
- include_unverified bool
- Set to trueif unverified Azure AD domains should be included. Defaults tofalse.
- only_default bool
- Set to trueto only return the default domain.
- only_initial bool
- Set to trueto only return the initial domain, which is your primary Azure Active Directory tenant domain. Defaults tofalse.
- only_root bool
- Set to trueto only return verified root domains. Excludes subdomains and unverified domains.
- supports_services Sequence[str]
- A list of supported services that must be supported by a domain. Possible values include - Email,- Sharepoint,- EmailInternalRelayOnly,- OfficeCommunicationsOnline,- SharePointDefaultDomain,- FullRedelegation,- SharePointPublic,- OrgIdAuthentication,- Yammerand- Intune.- Note on filters If - include_unverifiedis set to- true, you cannot specify- only_defaultor- only_initial. Additionally, you cannot combine- only_defaultwith- only_initial.
- adminManaged Boolean
- Set to trueto only return domains whose DNS is managed by Microsoft 365. Defaults tofalse.
- includeUnverified Boolean
- Set to trueif unverified Azure AD domains should be included. Defaults tofalse.
- onlyDefault Boolean
- Set to trueto only return the default domain.
- onlyInitial Boolean
- Set to trueto only return the initial domain, which is your primary Azure Active Directory tenant domain. Defaults tofalse.
- onlyRoot Boolean
- Set to trueto only return verified root domains. Excludes subdomains and unverified domains.
- supportsServices List<String>
- A list of supported services that must be supported by a domain. Possible values include - Email,- Sharepoint,- EmailInternalRelayOnly,- OfficeCommunicationsOnline,- SharePointDefaultDomain,- FullRedelegation,- SharePointPublic,- OrgIdAuthentication,- Yammerand- Intune.- Note on filters If - include_unverifiedis set to- true, you cannot specify- only_defaultor- only_initial. Additionally, you cannot combine- only_defaultwith- only_initial.
getDomains Result
The following output properties are available:
- Domains
List<Pulumi.Azure AD. Outputs. Get Domains Domain> 
- A list of tenant domains. Each domainobject provides the attributes documented below.
- Id string
- The provider-assigned unique ID for this managed resource.
- AdminManaged bool
- Whether the DNS for the domain is managed by Microsoft 365.
- IncludeUnverified bool
- OnlyDefault bool
- OnlyInitial bool
- OnlyRoot bool
- SupportsServices List<string>
- Domains
[]GetDomains Domain 
- A list of tenant domains. Each domainobject provides the attributes documented below.
- Id string
- The provider-assigned unique ID for this managed resource.
- AdminManaged bool
- Whether the DNS for the domain is managed by Microsoft 365.
- IncludeUnverified bool
- OnlyDefault bool
- OnlyInitial bool
- OnlyRoot bool
- SupportsServices []string
- domains
List<GetDomains Domain> 
- A list of tenant domains. Each domainobject provides the attributes documented below.
- id String
- The provider-assigned unique ID for this managed resource.
- adminManaged Boolean
- Whether the DNS for the domain is managed by Microsoft 365.
- includeUnverified Boolean
- onlyDefault Boolean
- onlyInitial Boolean
- onlyRoot Boolean
- supportsServices List<String>
- domains
GetDomains Domain[] 
- A list of tenant domains. Each domainobject provides the attributes documented below.
- id string
- The provider-assigned unique ID for this managed resource.
- adminManaged boolean
- Whether the DNS for the domain is managed by Microsoft 365.
- includeUnverified boolean
- onlyDefault boolean
- onlyInitial boolean
- onlyRoot boolean
- supportsServices string[]
- domains
Sequence[GetDomains Domain] 
- A list of tenant domains. Each domainobject provides the attributes documented below.
- id str
- The provider-assigned unique ID for this managed resource.
- admin_managed bool
- Whether the DNS for the domain is managed by Microsoft 365.
- include_unverified bool
- only_default bool
- only_initial bool
- only_root bool
- supports_services Sequence[str]
- domains List<Property Map>
- A list of tenant domains. Each domainobject provides the attributes documented below.
- id String
- The provider-assigned unique ID for this managed resource.
- adminManaged Boolean
- Whether the DNS for the domain is managed by Microsoft 365.
- includeUnverified Boolean
- onlyDefault Boolean
- onlyInitial Boolean
- onlyRoot Boolean
- supportsServices List<String>
Supporting Types
GetDomainsDomain  
- AdminManaged bool
- Set to trueto only return domains whose DNS is managed by Microsoft 365. Defaults tofalse.
- AuthenticationType string
- The authentication type of the domain. Possible values include ManagedorFederated.
- Default bool
- Whether this is the default domain that is used for user creation.
- DomainName string
- The name of the domain.
- Initial bool
- Whether this is the initial domain created by Azure Active Directory.
- Root bool
- Whether the domain is a verified root domain (not a subdomain).
- SupportedServices List<string>
- A list of capabilities / services supported by the domain. Possible values include Email,Sharepoint,EmailInternalRelayOnly,OfficeCommunicationsOnline,SharePointDefaultDomain,FullRedelegation,SharePointPublic,OrgIdAuthentication,YammerandIntune.
- Verified bool
- Whether the domain has completed domain ownership verification.
- AdminManaged bool
- Set to trueto only return domains whose DNS is managed by Microsoft 365. Defaults tofalse.
- AuthenticationType string
- The authentication type of the domain. Possible values include ManagedorFederated.
- Default bool
- Whether this is the default domain that is used for user creation.
- DomainName string
- The name of the domain.
- Initial bool
- Whether this is the initial domain created by Azure Active Directory.
- Root bool
- Whether the domain is a verified root domain (not a subdomain).
- SupportedServices []string
- A list of capabilities / services supported by the domain. Possible values include Email,Sharepoint,EmailInternalRelayOnly,OfficeCommunicationsOnline,SharePointDefaultDomain,FullRedelegation,SharePointPublic,OrgIdAuthentication,YammerandIntune.
- Verified bool
- Whether the domain has completed domain ownership verification.
- adminManaged Boolean
- Set to trueto only return domains whose DNS is managed by Microsoft 365. Defaults tofalse.
- authenticationType String
- The authentication type of the domain. Possible values include ManagedorFederated.
- default_ Boolean
- Whether this is the default domain that is used for user creation.
- domainName String
- The name of the domain.
- initial Boolean
- Whether this is the initial domain created by Azure Active Directory.
- root Boolean
- Whether the domain is a verified root domain (not a subdomain).
- supportedServices List<String>
- A list of capabilities / services supported by the domain. Possible values include Email,Sharepoint,EmailInternalRelayOnly,OfficeCommunicationsOnline,SharePointDefaultDomain,FullRedelegation,SharePointPublic,OrgIdAuthentication,YammerandIntune.
- verified Boolean
- Whether the domain has completed domain ownership verification.
- adminManaged boolean
- Set to trueto only return domains whose DNS is managed by Microsoft 365. Defaults tofalse.
- authenticationType string
- The authentication type of the domain. Possible values include ManagedorFederated.
- default boolean
- Whether this is the default domain that is used for user creation.
- domainName string
- The name of the domain.
- initial boolean
- Whether this is the initial domain created by Azure Active Directory.
- root boolean
- Whether the domain is a verified root domain (not a subdomain).
- supportedServices string[]
- A list of capabilities / services supported by the domain. Possible values include Email,Sharepoint,EmailInternalRelayOnly,OfficeCommunicationsOnline,SharePointDefaultDomain,FullRedelegation,SharePointPublic,OrgIdAuthentication,YammerandIntune.
- verified boolean
- Whether the domain has completed domain ownership verification.
- admin_managed bool
- Set to trueto only return domains whose DNS is managed by Microsoft 365. Defaults tofalse.
- authentication_type str
- The authentication type of the domain. Possible values include ManagedorFederated.
- default bool
- Whether this is the default domain that is used for user creation.
- domain_name str
- The name of the domain.
- initial bool
- Whether this is the initial domain created by Azure Active Directory.
- root bool
- Whether the domain is a verified root domain (not a subdomain).
- supported_services Sequence[str]
- A list of capabilities / services supported by the domain. Possible values include Email,Sharepoint,EmailInternalRelayOnly,OfficeCommunicationsOnline,SharePointDefaultDomain,FullRedelegation,SharePointPublic,OrgIdAuthentication,YammerandIntune.
- verified bool
- Whether the domain has completed domain ownership verification.
- adminManaged Boolean
- Set to trueto only return domains whose DNS is managed by Microsoft 365. Defaults tofalse.
- authenticationType String
- The authentication type of the domain. Possible values include ManagedorFederated.
- default Boolean
- Whether this is the default domain that is used for user creation.
- domainName String
- The name of the domain.
- initial Boolean
- Whether this is the initial domain created by Azure Active Directory.
- root Boolean
- Whether the domain is a verified root domain (not a subdomain).
- supportedServices List<String>
- A list of capabilities / services supported by the domain. Possible values include Email,Sharepoint,EmailInternalRelayOnly,OfficeCommunicationsOnline,SharePointDefaultDomain,FullRedelegation,SharePointPublic,OrgIdAuthentication,YammerandIntune.
- verified Boolean
- Whether the domain has completed domain ownership verification.
Package Details
- Repository
- Azure Active Directory (Azure AD) pulumi/pulumi-azuread
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azureadTerraform Provider.