You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Use managed identities to call Microsoft Graph APIs in VB.Net and C#
11
11
12
-
This article explains how to use managed identities to obtain access token, and then call Microsoft Graph APIs in both VB.Net and C#.
12
+
This article explains how to use managed identities to obtain access tokens, and then call Microsoft Graph APIs in both VB.Net and C#.
13
13
14
14
## Configure permissions for managed identities
15
15
16
-
All managed identities (User Assigned or System Assigned) will have a service principal that appears in the Enterprise Apps blade. To get permissions consented for Microsoft Graph on those identities, you'll need to make an OAuth Permission Grant. To do this, run the following PowerShell script:
16
+
All managed identities (User Assigned or System Assigned) will have a service principal that appears in the Enterprise Apps blade. To get permissions for Microsoft Graph on those identities, you must make an OAuth Permission Grant. To do this, run the following PowerShell script:
17
17
18
18
```powershell
19
19
# Your tenant id (in Azure Portal, under Azure Active Directory -> Overview )
@@ -69,10 +69,10 @@ foreach($permission in $Permissions)
69
69
```
70
70
## Get access token
71
71
72
-
After the permissions are configured in the service principal, make a token request from the resource: `https://graph.microsoft.com`:
72
+
After the permissions are configured in the service principal, make a token request from the following resource: `https://graph.microsoft.com`.
73
73
74
74
> [!NOTE]
75
-
> Once you make a token request for a resource, you'll get the same token for the next 24 hours, even if you make permission changes. you'll need to wait for the current token to expire in order to get a token with any new permissions.
75
+
> After you make a token request for a resource, you'll get the same token for the next 24 hours, even if you make permissions changes. In order to get a token together with any new permissions, you must wait for the current token to expire.
This example shows how to request an access token for a resource such as Microsoft Graph. When you use the Microsoft Graph service client in your code, you don't need to specify the resource explicitly, as the Microsoft Graph service client handles that automatically. In VB.Net, you'll need to add the `Microsoft.Graph` NuGet package and then add the `Imports Microsoft.Graph` at the top of the code file.
86
+
This example shows how to request an access token for a resource such as Microsoft Graph. When you use the Microsoft Graph service client in your code, you don't have to specify the resource explicitly because the Microsoft Graph service client handles that automatically. In VB.Net, you have to add the `Microsoft.Graph` NuGet package and then add the `Imports Microsoft.Graph` at the top of the code file.
0 commit comments