Skip to content

Commit 96554ad

Browse files
committed
Updated Example test
1 parent 4742a02 commit 96554ad

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

apps/managedidentity/example_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
package managedidentity_test
5+
6+
import (
7+
mi "github.com/AzureAD/microsoft-authentication-library-for-go/apps/managedidentity"
8+
)
9+
10+
func ExampleNew() {
11+
// System assigned Client
12+
miSystemassignedClient, err := mi.New(mi.SystemAssigned())
13+
if err != nil {
14+
// TODO: Handle error
15+
}
16+
_ = miSystemassignedClient
17+
18+
// User assigned Client
19+
clientId := "ClientId" // TODO: replace with your Managed Identity Id
20+
21+
miClientIdAssignedClient, err := mi.New(mi.UserAssignedClientID(clientId), mi.WithClientCapabilities([]string{"cp1"}))
22+
if err != nil {
23+
// TODO: Handle error
24+
}
25+
_ = miClientIdAssignedClient
26+
}

0 commit comments

Comments
 (0)