1. Packages
  2. Azure Active Directory (Azure AD)
  3. API Docs
  4. getDomains
Azure Active Directory (Azure AD) v5.47.2 published on Tuesday, Feb 27, 2024 by Pulumi

azuread.getDomains

Explore with Pulumi AI

azuread logo
Azure Active Directory (Azure AD) v5.47.2 published on Tuesday, Feb 27, 2024 by Pulumi

    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

    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 main
    
    import (
    	"github.com/pulumi/pulumi-azuread/sdk/v5/go/azuread"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		aadDomains, err := azuread.GetDomains(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		var splat0 []*string
    		for _, val0 := range aadDomains.Domains {
    			splat0 = append(splat0, val0.DomainName)
    		}
    		ctx.Export("domainNames", splat0)
    		return nil
    	})
    }
    
    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()));
        }
    }
    
    import pulumi
    import pulumi_azuread as azuread
    
    aad_domains = azuread.get_domains()
    pulumi.export("domainNames", [__item.domain_name for __item in aad_domains.domains])
    
    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));
    

    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)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: azuread:index/getDomains:getDomains
      arguments:
        # arguments dictionary

    The following arguments are supported:

    AdminManaged bool
    Set to true to only return domains whose DNS is managed by Microsoft 365. Defaults to false.
    IncludeUnverified bool
    Set to true if unverified Azure AD domains should be included. Defaults to false.
    OnlyDefault bool
    Set to true to only return the default domain.
    OnlyInitial bool
    Set to true to only return the initial domain, which is your primary Azure Active Directory tenant domain. Defaults to false.
    OnlyRoot bool
    Set to true to 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, Yammer and Intune.

    Note on filters If include_unverified is set to true, you cannot specify only_default or only_initial. Additionally, you cannot combine only_default with only_initial.

    AdminManaged bool
    Set to true to only return domains whose DNS is managed by Microsoft 365. Defaults to false.
    IncludeUnverified bool
    Set to true if unverified Azure AD domains should be included. Defaults to false.
    OnlyDefault bool
    Set to true to only return the default domain.
    OnlyInitial bool
    Set to true to only return the initial domain, which is your primary Azure Active Directory tenant domain. Defaults to false.
    OnlyRoot bool
    Set to true to 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, Yammer and Intune.

    Note on filters If include_unverified is set to true, you cannot specify only_default or only_initial. Additionally, you cannot combine only_default with only_initial.

    adminManaged Boolean
    Set to true to only return domains whose DNS is managed by Microsoft 365. Defaults to false.
    includeUnverified Boolean
    Set to true if unverified Azure AD domains should be included. Defaults to false.
    onlyDefault Boolean
    Set to true to only return the default domain.
    onlyInitial Boolean
    Set to true to only return the initial domain, which is your primary Azure Active Directory tenant domain. Defaults to false.
    onlyRoot Boolean
    Set to true to 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, Yammer and Intune.

    Note on filters If include_unverified is set to true, you cannot specify only_default or only_initial. Additionally, you cannot combine only_default with only_initial.

    adminManaged boolean
    Set to true to only return domains whose DNS is managed by Microsoft 365. Defaults to false.
    includeUnverified boolean
    Set to true if unverified Azure AD domains should be included. Defaults to false.
    onlyDefault boolean
    Set to true to only return the default domain.
    onlyInitial boolean
    Set to true to only return the initial domain, which is your primary Azure Active Directory tenant domain. Defaults to false.
    onlyRoot boolean
    Set to true to 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, Yammer and Intune.

    Note on filters If include_unverified is set to true, you cannot specify only_default or only_initial. Additionally, you cannot combine only_default with only_initial.

    admin_managed bool
    Set to true to only return domains whose DNS is managed by Microsoft 365. Defaults to false.
    include_unverified bool
    Set to true if unverified Azure AD domains should be included. Defaults to false.
    only_default bool
    Set to true to only return the default domain.
    only_initial bool
    Set to true to only return the initial domain, which is your primary Azure Active Directory tenant domain. Defaults to false.
    only_root bool
    Set to true to 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, Yammer and Intune.

    Note on filters If include_unverified is set to true, you cannot specify only_default or only_initial. Additionally, you cannot combine only_default with only_initial.

    adminManaged Boolean
    Set to true to only return domains whose DNS is managed by Microsoft 365. Defaults to false.
    includeUnverified Boolean
    Set to true if unverified Azure AD domains should be included. Defaults to false.
    onlyDefault Boolean
    Set to true to only return the default domain.
    onlyInitial Boolean
    Set to true to only return the initial domain, which is your primary Azure Active Directory tenant domain. Defaults to false.
    onlyRoot Boolean
    Set to true to 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, Yammer and Intune.

    Note on filters If include_unverified is set to true, you cannot specify only_default or only_initial. Additionally, you cannot combine only_default with only_initial.

    getDomains Result

    The following output properties are available:

    Domains List<Pulumi.AzureAD.Outputs.GetDomainsDomain>
    A list of tenant domains. Each domain object 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 []GetDomainsDomain
    A list of tenant domains. Each domain object 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<GetDomainsDomain>
    A list of tenant domains. Each domain object 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 GetDomainsDomain[]
    A list of tenant domains. Each domain object 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[GetDomainsDomain]
    A list of tenant domains. Each domain object 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 domain object 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 true to only return domains whose DNS is managed by Microsoft 365. Defaults to false.
    AuthenticationType string
    The authentication type of the domain. Possible values include Managed or Federated.
    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, Yammer and Intune.
    Verified bool
    Whether the domain has completed domain ownership verification.
    AdminManaged bool
    Set to true to only return domains whose DNS is managed by Microsoft 365. Defaults to false.
    AuthenticationType string
    The authentication type of the domain. Possible values include Managed or Federated.
    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, Yammer and Intune.
    Verified bool
    Whether the domain has completed domain ownership verification.
    adminManaged Boolean
    Set to true to only return domains whose DNS is managed by Microsoft 365. Defaults to false.
    authenticationType String
    The authentication type of the domain. Possible values include Managed or Federated.
    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, Yammer and Intune.
    verified Boolean
    Whether the domain has completed domain ownership verification.
    adminManaged boolean
    Set to true to only return domains whose DNS is managed by Microsoft 365. Defaults to false.
    authenticationType string
    The authentication type of the domain. Possible values include Managed or Federated.
    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, Yammer and Intune.
    verified boolean
    Whether the domain has completed domain ownership verification.
    admin_managed bool
    Set to true to only return domains whose DNS is managed by Microsoft 365. Defaults to false.
    authentication_type str
    The authentication type of the domain. Possible values include Managed or Federated.
    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, Yammer and Intune.
    verified bool
    Whether the domain has completed domain ownership verification.
    adminManaged Boolean
    Set to true to only return domains whose DNS is managed by Microsoft 365. Defaults to false.
    authenticationType String
    The authentication type of the domain. Possible values include Managed or Federated.
    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, Yammer and Intune.
    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 azuread Terraform Provider.
    azuread logo
    Azure Active Directory (Azure AD) v5.47.2 published on Tuesday, Feb 27, 2024 by Pulumi