azuread.getDirectoryObject
Explore with Pulumi AI
Retrieves the OData type for a generic directory object having the provided object ID.
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 either User.Read.All, Group.Read.All or Directory.Read.All, depending on the type of object being queried.
When authenticated with a user principal, this data source does not require any additional roles.
Example Usage
Look up and output type of object by ID
import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";
const example = azuread.getDirectoryObject({
    objectId: "00000000-0000-0000-0000-000000000000",
});
export const objectType = example.then(example => example.type);
import pulumi
import pulumi_azuread as azuread
example = azuread.get_directory_object(object_id="00000000-0000-0000-0000-000000000000")
pulumi.export("objectType", example.type)
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 {
		example, err := azuread.GetDirectoryObject(ctx, &azuread.GetDirectoryObjectArgs{
			ObjectId: "00000000-0000-0000-0000-000000000000",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("objectType", example.Type)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureAD = Pulumi.AzureAD;
return await Deployment.RunAsync(() => 
{
    var example = AzureAD.GetDirectoryObject.Invoke(new()
    {
        ObjectId = "00000000-0000-0000-0000-000000000000",
    });
    return new Dictionary<string, object?>
    {
        ["objectType"] = example.Apply(getDirectoryObjectResult => getDirectoryObjectResult.Type),
    };
});
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.GetDirectoryObjectArgs;
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 example = AzureadFunctions.getDirectoryObject(GetDirectoryObjectArgs.builder()
            .objectId("00000000-0000-0000-0000-000000000000")
            .build());
        ctx.export("objectType", example.applyValue(getDirectoryObjectResult -> getDirectoryObjectResult.type()));
    }
}
variables:
  example:
    fn::invoke:
      function: azuread:getDirectoryObject
      arguments:
        objectId: 00000000-0000-0000-0000-000000000000
outputs:
  objectType: ${example.type}
Attributes Reference
The following attributes are exported:
- object_id- The object ID of the directory object.
- type- The shortened OData type of the directory object. Possible values include:- Group,- Useror- ServicePrincipal.
Using getDirectoryObject
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 getDirectoryObject(args: GetDirectoryObjectArgs, opts?: InvokeOptions): Promise<GetDirectoryObjectResult>
function getDirectoryObjectOutput(args: GetDirectoryObjectOutputArgs, opts?: InvokeOptions): Output<GetDirectoryObjectResult>def get_directory_object(object_id: Optional[str] = None,
                         opts: Optional[InvokeOptions] = None) -> GetDirectoryObjectResult
def get_directory_object_output(object_id: Optional[pulumi.Input[str]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetDirectoryObjectResult]func GetDirectoryObject(ctx *Context, args *GetDirectoryObjectArgs, opts ...InvokeOption) (*GetDirectoryObjectResult, error)
func GetDirectoryObjectOutput(ctx *Context, args *GetDirectoryObjectOutputArgs, opts ...InvokeOption) GetDirectoryObjectResultOutput> Note: This function is named GetDirectoryObject in the Go SDK.
public static class GetDirectoryObject 
{
    public static Task<GetDirectoryObjectResult> InvokeAsync(GetDirectoryObjectArgs args, InvokeOptions? opts = null)
    public static Output<GetDirectoryObjectResult> Invoke(GetDirectoryObjectInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetDirectoryObjectResult> getDirectoryObject(GetDirectoryObjectArgs args, InvokeOptions options)
public static Output<GetDirectoryObjectResult> getDirectoryObject(GetDirectoryObjectArgs args, InvokeOptions options)
fn::invoke:
  function: azuread:index/getDirectoryObject:getDirectoryObject
  arguments:
    # arguments dictionaryThe following arguments are supported:
- ObjectId string
- Specifies the Object ID of the directory object to look up.
- ObjectId string
- Specifies the Object ID of the directory object to look up.
- objectId String
- Specifies the Object ID of the directory object to look up.
- objectId string
- Specifies the Object ID of the directory object to look up.
- object_id str
- Specifies the Object ID of the directory object to look up.
- objectId String
- Specifies the Object ID of the directory object to look up.
getDirectoryObject Result
The following output properties are available:
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.