/
getServicePrincipal.go
115 lines (110 loc) · 3.71 KB
/
getServicePrincipal.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// *** 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! ***
package azuread
import (
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// 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)
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-azuread/sdk/v3/go/azuread"
// "github.com/pulumi/pulumi/sdk/v2/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
// })
// }
// ```
// ### By Application ID)
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-azuread/sdk/v3/go/azuread"
// "github.com/pulumi/pulumi/sdk/v2/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
// })
// }
// ```
// ### By Object ID)
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-azuread/sdk/v3/go/azuread"
// "github.com/pulumi/pulumi/sdk/v2/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
// })
// }
// ```
func LookupServicePrincipal(ctx *pulumi.Context, args *LookupServicePrincipalArgs, opts ...pulumi.InvokeOption) (*LookupServicePrincipalResult, error) {
var rv LookupServicePrincipalResult
err := ctx.Invoke("azuread:index/getServicePrincipal:getServicePrincipal", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getServicePrincipal.
type LookupServicePrincipalArgs struct {
// The ID of the Azure AD Application.
ApplicationId *string `pulumi:"applicationId"`
// The Display Name of the Azure AD Application associated with this Service Principal.
DisplayName *string `pulumi:"displayName"`
// A collection of OAuth 2.0 permissions exposed by the associated application. Each permission is covered by a `oauth2Permission` block as documented below.
Oauth2Permissions []GetServicePrincipalOauth2Permission `pulumi:"oauth2Permissions"`
// The ID of the Azure AD Service Principal.
ObjectId *string `pulumi:"objectId"`
}
// A collection of values returned by getServicePrincipal.
type LookupServicePrincipalResult struct {
AppRoles []GetServicePrincipalAppRole `pulumi:"appRoles"`
ApplicationId string `pulumi:"applicationId"`
// Display name for the permission that appears in the admin consent and app assignment experiences.
DisplayName string `pulumi:"displayName"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
Oauth2Permissions []GetServicePrincipalOauth2Permission `pulumi:"oauth2Permissions"`
ObjectId string `pulumi:"objectId"`
}