azuread logo
Azure Active Directory (Azure AD) v5.34.0, Jan 23 23

azuread.getApplicationPublishedAppIds

Use this data source to discover application IDs for APIs published by Microsoft.

This data source uses an unofficial source of application IDs, as there is currently no available official indexed source for applications or APIs published by Microsoft.

The app IDs returned by this data source are sourced from the Azure Global (Public) Cloud, however some of them are known to work in government and national clouds.

Example Usage

Listing well-known application IDs

using System.Collections.Generic;
using Pulumi;
using AzureAD = Pulumi.AzureAD;

return await Deployment.RunAsync(() => 
{
    var wellKnown = AzureAD.GetApplicationPublishedAppIds.Invoke();

    return new Dictionary<string, object?>
    {
        ["publishedAppIds"] = wellKnown.Apply(getApplicationPublishedAppIdsResult => getApplicationPublishedAppIdsResult.Result),
    };
});
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 {
		wellKnown, err := azuread.GetApplicationPublishedAppIds(ctx, nil, nil)
		if err != nil {
			return err
		}
		ctx.Export("publishedAppIds", wellKnown.Result)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuread.AzureadFunctions;
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 wellKnown = AzureadFunctions.getApplicationPublishedAppIds();

        ctx.export("publishedAppIds", wellKnown.applyValue(getApplicationPublishedAppIdsResult -> getApplicationPublishedAppIdsResult.result()));
    }
}
import pulumi
import pulumi_azuread as azuread

well_known = azuread.get_application_published_app_ids()
pulumi.export("publishedAppIds", well_known.result)
import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";

const wellKnown = azuread.getApplicationPublishedAppIds({});
export const publishedAppIds = wellKnown.then(wellKnown => wellKnown.result);
variables:
  wellKnown:
    fn::invoke:
      Function: azuread:getApplicationPublishedAppIds
      Arguments: {}
outputs:
  publishedAppIds: ${wellKnown.result}

Granting access to an application

using System.Collections.Generic;
using Pulumi;
using AzureAD = Pulumi.AzureAD;

return await Deployment.RunAsync(() => 
{
    var wellKnown = AzureAD.GetApplicationPublishedAppIds.Invoke();

    var msgraph = new AzureAD.ServicePrincipal("msgraph", new()
    {
        ApplicationId = wellKnown.Apply(getApplicationPublishedAppIdsResult => getApplicationPublishedAppIdsResult.Result?.MicrosoftGraph),
        UseExisting = true,
    });

    var example = new AzureAD.Application("example", new()
    {
        DisplayName = "example",
        RequiredResourceAccesses = new[]
        {
            new AzureAD.Inputs.ApplicationRequiredResourceAccessArgs
            {
                ResourceAppId = wellKnown.Apply(getApplicationPublishedAppIdsResult => getApplicationPublishedAppIdsResult.Result?.MicrosoftGraph),
                ResourceAccesses = new[]
                {
                    new AzureAD.Inputs.ApplicationRequiredResourceAccessResourceAccessArgs
                    {
                        Id = msgraph.AppRoleIds.Apply(appRoleIds => appRoleIds.User_Read_All),
                        Type = "Role",
                    },
                    new AzureAD.Inputs.ApplicationRequiredResourceAccessResourceAccessArgs
                    {
                        Id = msgraph.Oauth2PermissionScopeIds.Apply(oauth2PermissionScopeIds => oauth2PermissionScopeIds.User_ReadWrite),
                        Type = "Scope",
                    },
                },
            },
        },
    });

});
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 {
		wellKnown, err := azuread.GetApplicationPublishedAppIds(ctx, nil, nil)
		if err != nil {
			return err
		}
		msgraph, err := azuread.NewServicePrincipal(ctx, "msgraph", &azuread.ServicePrincipalArgs{
			ApplicationId: *pulumi.String(wellKnown.Result.MicrosoftGraph),
			UseExisting:   pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = azuread.NewApplication(ctx, "example", &azuread.ApplicationArgs{
			DisplayName: pulumi.String("example"),
			RequiredResourceAccesses: azuread.ApplicationRequiredResourceAccessArray{
				&azuread.ApplicationRequiredResourceAccessArgs{
					ResourceAppId: *pulumi.String(wellKnown.Result.MicrosoftGraph),
					ResourceAccesses: azuread.ApplicationRequiredResourceAccessResourceAccessArray{
						&azuread.ApplicationRequiredResourceAccessResourceAccessArgs{
							Id: msgraph.AppRoleIds.ApplyT(func(appRoleIds map[string]string) (string, error) {
								return appRoleIds.User.Read.All, nil
							}).(pulumi.StringOutput),
							Type: pulumi.String("Role"),
						},
						&azuread.ApplicationRequiredResourceAccessResourceAccessArgs{
							Id: msgraph.Oauth2PermissionScopeIds.ApplyT(func(oauth2PermissionScopeIds map[string]string) (string, error) {
								return oauth2PermissionScopeIds.User.ReadWrite, nil
							}).(pulumi.StringOutput),
							Type: pulumi.String("Scope"),
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		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.ServicePrincipal;
import com.pulumi.azuread.ServicePrincipalArgs;
import com.pulumi.azuread.Application;
import com.pulumi.azuread.ApplicationArgs;
import com.pulumi.azuread.inputs.ApplicationRequiredResourceAccessArgs;
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 wellKnown = AzureadFunctions.getApplicationPublishedAppIds();

        var msgraph = new ServicePrincipal("msgraph", ServicePrincipalArgs.builder()        
            .applicationId(wellKnown.applyValue(getApplicationPublishedAppIdsResult -> getApplicationPublishedAppIdsResult.result().MicrosoftGraph()))
            .useExisting(true)
            .build());

        var example = new Application("example", ApplicationArgs.builder()        
            .displayName("example")
            .requiredResourceAccesses(ApplicationRequiredResourceAccessArgs.builder()
                .resourceAppId(wellKnown.applyValue(getApplicationPublishedAppIdsResult -> getApplicationPublishedAppIdsResult.result().MicrosoftGraph()))
                .resourceAccesses(                
                    ApplicationRequiredResourceAccessResourceAccessArgs.builder()
                        .id(msgraph.appRoleIds().applyValue(appRoleIds -> appRoleIds.User.Read.All()))
                        .type("Role")
                        .build(),
                    ApplicationRequiredResourceAccessResourceAccessArgs.builder()
                        .id(msgraph.oauth2PermissionScopeIds().applyValue(oauth2PermissionScopeIds -> oauth2PermissionScopeIds.User.ReadWrite()))
                        .type("Scope")
                        .build())
                .build())
            .build());

    }
}

Coming soon!

import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";

const wellKnown = azuread.getApplicationPublishedAppIds({});
const msgraph = new azuread.ServicePrincipal("msgraph", {
    applicationId: wellKnown.then(wellKnown => wellKnown.result?.MicrosoftGraph),
    useExisting: true,
});
const example = new azuread.Application("example", {
    displayName: "example",
    requiredResourceAccesses: [{
        resourceAppId: wellKnown.then(wellKnown => wellKnown.result?.MicrosoftGraph),
        resourceAccesses: [
            {
                id: msgraph.appRoleIds["User.Read.All"],
                type: "Role",
            },
            {
                id: msgraph.oauth2PermissionScopeIds["User.ReadWrite"],
                type: "Scope",
            },
        ],
    }],
});
resources:
  msgraph:
    type: azuread:ServicePrincipal
    properties:
      applicationId: ${wellKnown.result.MicrosoftGraph}
      useExisting: true
  example:
    type: azuread:Application
    properties:
      displayName: example
      requiredResourceAccesses:
        - resourceAppId: ${wellKnown.result.MicrosoftGraph}
          resourceAccesses:
            - id: ${msgraph.appRoleIds"User.Read.All"[%!s(MISSING)]}
              type: Role
            - id: ${msgraph.oauth2PermissionScopeIds"User.ReadWrite"[%!s(MISSING)]}
              type: Scope
variables:
  wellKnown:
    fn::invoke:
      Function: azuread:getApplicationPublishedAppIds
      Arguments: {}

Using getApplicationPublishedAppIds

function getApplicationPublishedAppIds(opts?: InvokeOptions): Promise<GetApplicationPublishedAppIdsResult>
def get_application_published_app_ids(opts: Optional[InvokeOptions] = None) -> GetApplicationPublishedAppIdsResult
func GetApplicationPublishedAppIds(ctx *Context, opts ...InvokeOption) (*GetApplicationPublishedAppIdsResult, error)

> Note: This function is named GetApplicationPublishedAppIds in the Go SDK.

public static class GetApplicationPublishedAppIds 
{
    public static Task<GetApplicationPublishedAppIdsResult> InvokeAsync(InvokeOptions? opts = null)
}
public static CompletableFuture<GetApplicationPublishedAppIdsResult> getApplicationPublishedAppIds(InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: azuread:index/getApplicationPublishedAppIds:getApplicationPublishedAppIds
  arguments:
    # arguments dictionary

getApplicationPublishedAppIds Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Result Dictionary<string, string>

A map of application names to application IDs.

Id string

The provider-assigned unique ID for this managed resource.

Result map[string]string

A map of application names to application IDs.

id String

The provider-assigned unique ID for this managed resource.

result Map<String,String>

A map of application names to application IDs.

id string

The provider-assigned unique ID for this managed resource.

result {[key: string]: string}

A map of application names to application IDs.

id str

The provider-assigned unique ID for this managed resource.

result Mapping[str, str]

A map of application names to application IDs.

id String

The provider-assigned unique ID for this managed resource.

result Map<String>

A map of application names to application IDs.

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.