# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities

__all__ = [
    'GetApplicationPublishedAppIdsResult',
    'AwaitableGetApplicationPublishedAppIdsResult',
    'get_application_published_app_ids',
]

@pulumi.output_type
class GetApplicationPublishedAppIdsResult:
    """
    A collection of values returned by getApplicationPublishedAppIds.
    """
    def __init__(__self__, id=None, result=None):
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if result and not isinstance(result, dict):
            raise TypeError("Expected argument 'result' to be a dict")
        pulumi.set(__self__, "result", result)

    @property
    @pulumi.getter
    def id(self) -> str:
        """
        The provider-assigned unique ID for this managed resource.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter
    def result(self) -> Mapping[str, str]:
        """
        A map of application names to application IDs.
        """
        return pulumi.get(self, "result")


class AwaitableGetApplicationPublishedAppIdsResult(GetApplicationPublishedAppIdsResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetApplicationPublishedAppIdsResult(
            id=self.id,
            result=self.result)


def get_application_published_app_ids(opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetApplicationPublishedAppIdsResult:
    """
    Use this data source to discover application IDs for APIs published by Microsoft.

    This data source uses an [unofficial source of application IDs](https://github.com/manicminer/hamilton/blob/main/environments/published.go), 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*

    ```python
    import pulumi
    import pulumi_azuread as azuread

    well_known = azuread.get_application_published_app_ids()
    pulumi.export("publishedAppIds", well_known.result)
    ```

    *Granting access to an application*

    ```python
    import pulumi
    import pulumi_azuread as azuread

    well_known = azuread.get_application_published_app_ids()
    msgraph = azuread.ServicePrincipal("msgraph",
        application_id=well_known.result["MicrosoftGraph"],
        use_existing=True)
    example = azuread.Application("example",
        display_name="example",
        required_resource_accesses=[azuread.ApplicationRequiredResourceAccessArgs(
            resource_app_id=well_known.result["MicrosoftGraph"],
            resource_accesses=[
                azuread.ApplicationRequiredResourceAccessResourceAccessArgs(
                    id=msgraph.app_role_ids["User.Read.All"],
                    type="Role",
                ),
                azuread.ApplicationRequiredResourceAccessResourceAccessArgs(
                    id=msgraph.oauth2_permission_scope_ids["User.ReadWrite"],
                    type="Scope",
                ),
            ],
        )])
    ```
    """
    __args__ = dict()
    if opts is None:
        opts = pulumi.InvokeOptions()
    if opts.version is None:
        opts.version = _utilities.get_version()
    __ret__ = pulumi.runtime.invoke('azuread:index/getApplicationPublishedAppIds:getApplicationPublishedAppIds', __args__, opts=opts, typ=GetApplicationPublishedAppIdsResult).value

    return AwaitableGetApplicationPublishedAppIdsResult(
        id=__ret__.id,
        result=__ret__.result)
