getServicePrincipal

Gets information about an existing Service Principal associated with an Application within Azure Active Directory.

NOTE: If you’re authenticating using a Service Principal then it must have permissions to both Read and write all applications and Sign in and read user profile within the Windows Azure Active Directory API.

Example Usage

By Application Display Name)

using Pulumi;
using AzureAD = Pulumi.AzureAD;

class MyStack : Stack
{
    public MyStack()
    {
        var example = Output.Create(AzureAD.GetServicePrincipal.InvokeAsync(new AzureAD.GetServicePrincipalArgs
        {
            DisplayName = "my-awesome-application",
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-azuread/sdk/v4/go/azuread"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		opt0 := "my-awesome-application"
		_, err := azuread.LookupServicePrincipal(ctx, &azuread.LookupServicePrincipalArgs{
			DisplayName: &opt0,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_azuread as azuread

example = azuread.get_service_principal(display_name="my-awesome-application")
import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";

const example = pulumi.output(azuread.getServicePrincipal({
    displayName: "my-awesome-application",
}, { async: true }));

By Application ID)

using Pulumi;
using AzureAD = Pulumi.AzureAD;

class MyStack : Stack
{
    public MyStack()
    {
        var example = Output.Create(AzureAD.GetServicePrincipal.InvokeAsync(new AzureAD.GetServicePrincipalArgs
        {
            ApplicationId = "00000000-0000-0000-0000-000000000000",
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-azuread/sdk/v4/go/azuread"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		opt0 := "00000000-0000-0000-0000-000000000000"
		_, err := azuread.LookupServicePrincipal(ctx, &azuread.LookupServicePrincipalArgs{
			ApplicationId: &opt0,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_azuread as azuread

example = azuread.get_service_principal(application_id="00000000-0000-0000-0000-000000000000")
import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";

const example = pulumi.output(azuread.getServicePrincipal({
    applicationId: "00000000-0000-0000-0000-000000000000",
}, { async: true }));

By Object ID)

using Pulumi;
using AzureAD = Pulumi.AzureAD;

class MyStack : Stack
{
    public MyStack()
    {
        var example = Output.Create(AzureAD.GetServicePrincipal.InvokeAsync(new AzureAD.GetServicePrincipalArgs
        {
            ObjectId = "00000000-0000-0000-0000-000000000000",
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-azuread/sdk/v4/go/azuread"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		opt0 := "00000000-0000-0000-0000-000000000000"
		_, err := azuread.LookupServicePrincipal(ctx, &azuread.LookupServicePrincipalArgs{
			ObjectId: &opt0,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_azuread as azuread

example = azuread.get_service_principal(object_id="00000000-0000-0000-0000-000000000000")
import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";

const example = pulumi.output(azuread.getServicePrincipal({
    objectId: "00000000-0000-0000-0000-000000000000",
}, { async: true }));

Using getServicePrincipal

function getServicePrincipal(args: GetServicePrincipalArgs, opts?: InvokeOptions): Promise<GetServicePrincipalResult>
def get_service_principal(application_id: Optional[str] = None,
                          display_name: Optional[str] = None,
                          oauth2_permissions: Optional[Sequence[GetServicePrincipalOauth2Permission]] = None,
                          object_id: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetServicePrincipalResult
func LookupServicePrincipal(ctx *Context, args *LookupServicePrincipalArgs, opts ...InvokeOption) (*LookupServicePrincipalResult, error)

Note: This function is named LookupServicePrincipal in the Go SDK.

public static class GetServicePrincipal {
    public static Task<GetServicePrincipalResult> InvokeAsync(GetServicePrincipalArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

ApplicationId string
The ID of the Azure AD Application.
DisplayName string
The Display Name of the Azure AD Application associated with this Service Principal.
Oauth2Permissions List<Pulumi.AzureAD.Inputs.GetServicePrincipalOauth2Permission>
A collection of OAuth 2.0 permissions exposed by the associated application. Each permission is covered by a oauth2_permission block as documented below.
ObjectId string
The ID of the Azure AD Service Principal.
ApplicationId string
The ID of the Azure AD Application.
DisplayName string
The Display Name of the Azure AD Application associated with this Service Principal.
Oauth2Permissions []GetServicePrincipalOauth2Permission
A collection of OAuth 2.0 permissions exposed by the associated application. Each permission is covered by a oauth2_permission block as documented below.
ObjectId string
The ID of the Azure AD Service Principal.
applicationId string
The ID of the Azure AD Application.
displayName string
The Display Name of the Azure AD Application associated with this Service Principal.
oauth2Permissions GetServicePrincipalOauth2Permission[]
A collection of OAuth 2.0 permissions exposed by the associated application. Each permission is covered by a oauth2_permission block as documented below.
objectId string
The ID of the Azure AD Service Principal.
application_id str
The ID of the Azure AD Application.
display_name str
The Display Name of the Azure AD Application associated with this Service Principal.
oauth2_permissions Sequence[GetServicePrincipalOauth2Permission]
A collection of OAuth 2.0 permissions exposed by the associated application. Each permission is covered by a oauth2_permission block as documented below.
object_id str
The ID of the Azure AD Service Principal.

getServicePrincipal Result

The following output properties are available:

AppRoles List<Pulumi.AzureAD.Outputs.GetServicePrincipalAppRole>
ApplicationId string
DisplayName string
Display name for the permission that appears in the admin consent and app assignment experiences.
Id string
The provider-assigned unique ID for this managed resource.
Oauth2Permissions List<Pulumi.AzureAD.Outputs.GetServicePrincipalOauth2Permission>
ObjectId string
AppRoles []GetServicePrincipalAppRole
ApplicationId string
DisplayName string
Display name for the permission that appears in the admin consent and app assignment experiences.
Id string
The provider-assigned unique ID for this managed resource.
Oauth2Permissions []GetServicePrincipalOauth2Permission
ObjectId string
appRoles GetServicePrincipalAppRole[]
applicationId string
displayName string
Display name for the permission that appears in the admin consent and app assignment experiences.
id string
The provider-assigned unique ID for this managed resource.
oauth2Permissions GetServicePrincipalOauth2Permission[]
objectId string
app_roles Sequence[GetServicePrincipalAppRole]
application_id str
display_name str
Display name for the permission that appears in the admin consent and app assignment experiences.
id str
The provider-assigned unique ID for this managed resource.
oauth2_permissions Sequence[GetServicePrincipalOauth2Permission]
object_id str

Supporting Types

GetServicePrincipalAppRole

AllowedMemberTypes List<string>
Specifies whether this app role definition can be assigned to users and groups, or to other applications (that are accessing this application in daemon service scenarios). Possible values are: User and Application, or both.
Description string
Permission help text that appears in the admin app assignment and consent experiences.
DisplayName string
The Display Name of the Azure AD Application associated with this Service Principal.
Id string
The unique identifier for one of the OAuth2Permission
IsEnabled bool
Is this permission enabled?
Value string
The name of this permission
AllowedMemberTypes []string
Specifies whether this app role definition can be assigned to users and groups, or to other applications (that are accessing this application in daemon service scenarios). Possible values are: User and Application, or both.
Description string
Permission help text that appears in the admin app assignment and consent experiences.
DisplayName string
The Display Name of the Azure AD Application associated with this Service Principal.
Id string
The unique identifier for one of the OAuth2Permission
IsEnabled bool
Is this permission enabled?
Value string
The name of this permission
allowedMemberTypes string[]
Specifies whether this app role definition can be assigned to users and groups, or to other applications (that are accessing this application in daemon service scenarios). Possible values are: User and Application, or both.
description string
Permission help text that appears in the admin app assignment and consent experiences.
displayName string
The Display Name of the Azure AD Application associated with this Service Principal.
id string
The unique identifier for one of the OAuth2Permission
isEnabled boolean
Is this permission enabled?
value string
The name of this permission
allowed_member_types Sequence[str]
Specifies whether this app role definition can be assigned to users and groups, or to other applications (that are accessing this application in daemon service scenarios). Possible values are: User and Application, or both.
description str
Permission help text that appears in the admin app assignment and consent experiences.
display_name str
The Display Name of the Azure AD Application associated with this Service Principal.
id str
The unique identifier for one of the OAuth2Permission
is_enabled bool
Is this permission enabled?
value str
The name of this permission

GetServicePrincipalOauth2Permission

AdminConsentDescription string
The description of the admin consent
AdminConsentDisplayName string
The display name of the admin consent
Id string
The unique identifier for one of the OAuth2Permission
IsEnabled bool
Is this permission enabled?
Type string
The type of the permission
UserConsentDescription string
The description of the user consent
UserConsentDisplayName string
The display name of the user consent
Value string
The name of this permission
AdminConsentDescription string
The description of the admin consent
AdminConsentDisplayName string
The display name of the admin consent
Id string
The unique identifier for one of the OAuth2Permission
IsEnabled bool
Is this permission enabled?
Type string
The type of the permission
UserConsentDescription string
The description of the user consent
UserConsentDisplayName string
The display name of the user consent
Value string
The name of this permission
adminConsentDescription string
The description of the admin consent
adminConsentDisplayName string
The display name of the admin consent
id string
The unique identifier for one of the OAuth2Permission
isEnabled boolean
Is this permission enabled?
type string
The type of the permission
userConsentDescription string
The description of the user consent
userConsentDisplayName string
The display name of the user consent
value string
The name of this permission
admin_consent_description str
The description of the admin consent
admin_consent_display_name str
The display name of the admin consent
id str
The unique identifier for one of the OAuth2Permission
is_enabled bool
Is this permission enabled?
type str
The type of the permission
user_consent_description str
The description of the user consent
user_consent_display_name str
The display name of the user consent
value str
The name of this permission

Package Details

Repository
https://github.com/pulumi/pulumi-azuread
License
Apache-2.0
Notes
This Pulumi package is based on the azuread Terraform Provider.