1. Packages
  2. Azure Active Directory (Azure AD)
  3. API Docs
  4. getApplicationPublishedAppIds
Azure Active Directory (Azure AD) v6.0.1 published on Monday, Oct 14, 2024 by Pulumi

azuread.getApplicationPublishedAppIds

Explore with Pulumi AI

azuread logo
Azure Active Directory (Azure AD) v6.0.1 published on Monday, Oct 14, 2024 by Pulumi

    Example Usage

    Listing well-known application IDs

    import * as pulumi from "@pulumi/pulumi";
    import * as azuread from "@pulumi/azuread";
    
    const wellKnown = azuread.getApplicationPublishedAppIds({});
    export const publishedAppIds = wellKnown.then(wellKnown => wellKnown.result);
    
    import pulumi
    import pulumi_azuread as azuread
    
    well_known = azuread.get_application_published_app_ids()
    pulumi.export("publishedAppIds", well_known.result)
    
    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 {
    		wellKnown, err := azuread.GetApplicationPublishedAppIds(ctx, map[string]interface{}{}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("publishedAppIds", wellKnown.Result)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    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 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()));
        }
    }
    
    variables:
      wellKnown:
        fn::invoke:
          Function: azuread:getApplicationPublishedAppIds
          Arguments: {}
    outputs:
      publishedAppIds: ${wellKnown.result}
    

    Granting access to an application

    import * as pulumi from "@pulumi/pulumi";
    import * as azuread from "@pulumi/azuread";
    
    const wellKnown = azuread.getApplicationPublishedAppIds({});
    const msgraph = new azuread.ServicePrincipal("msgraph", {
        clientId: 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",
                },
            ],
        }],
    });
    
    import pulumi
    import pulumi_azuread as azuread
    
    well_known = azuread.get_application_published_app_ids()
    msgraph = azuread.ServicePrincipal("msgraph",
        client_id=well_known.result["MicrosoftGraph"],
        use_existing=True)
    example = azuread.Application("example",
        display_name="example",
        required_resource_accesses=[{
            "resource_app_id": well_known.result["MicrosoftGraph"],
            "resource_accesses": [
                {
                    "id": msgraph.app_role_ids["User.Read.All"],
                    "type": "Role",
                },
                {
                    "id": msgraph.oauth2_permission_scope_ids["User.ReadWrite"],
                    "type": "Scope",
                },
            ],
        }])
    
    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 {
    		wellKnown, err := azuread.GetApplicationPublishedAppIds(ctx, map[string]interface{}{}, nil)
    		if err != nil {
    			return err
    		}
    		msgraph, err := azuread.NewServicePrincipal(ctx, "msgraph", &azuread.ServicePrincipalArgs{
    			ClientId:    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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureAD = Pulumi.AzureAD;
    
    return await Deployment.RunAsync(() => 
    {
        var wellKnown = AzureAD.GetApplicationPublishedAppIds.Invoke();
    
        var msgraph = new AzureAD.ServicePrincipal("msgraph", new()
        {
            ClientId = 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 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()
                .clientId(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());
    
        }
    }
    
    resources:
      msgraph:
        type: azuread:ServicePrincipal
        properties:
          clientId: ${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

    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 getApplicationPublishedAppIds(opts?: InvokeOptions): Promise<GetApplicationPublishedAppIdsResult>
    function getApplicationPublishedAppIdsOutput(opts?: InvokeOptions): Output<GetApplicationPublishedAppIdsResult>
    def get_application_published_app_ids(opts: Optional[InvokeOptions] = None) -> GetApplicationPublishedAppIdsResult
    def get_application_published_app_ids_output(opts: Optional[InvokeOptions] = None) -> Output[GetApplicationPublishedAppIdsResult]
    func GetApplicationPublishedAppIds(ctx *Context, opts ...InvokeOption) (*GetApplicationPublishedAppIdsResult, error)
    func GetApplicationPublishedAppIdsOutput(ctx *Context, opts ...InvokeOption) GetApplicationPublishedAppIdsResultOutput

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

    public static class GetApplicationPublishedAppIds 
    {
        public static Task<GetApplicationPublishedAppIdsResult> InvokeAsync(InvokeOptions? opts = null)
        public static Output<GetApplicationPublishedAppIdsResult> Invoke(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.
    azuread logo
    Azure Active Directory (Azure AD) v6.0.1 published on Monday, Oct 14, 2024 by Pulumi