Skip to content

Commit 2959371

Browse files
committed
touchups
1 parent cde2265 commit 2959371

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

articles/batch/batch-aad-auth.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Azure Batch supports authentication with [Azure Active Directory](/azure/active-
1212

1313
This article describes two ways to use Azure AD authentication with Azure Batch:
1414

15-
- **Integrated authentication** authenticates a user who's interacting with an application. The application gathers a user's credentials and uses those credentials to authenticate access to Batch resources.
15+
- **Integrated authentication** authenticates a user who's interacting with an application. The application gathers a user's credentials and uses those credentials to authorize access to Batch resources.
1616

1717
- A **service principal** authenticates an unattended application. The service principal defines the policy and permissions for the application and represents the application to access Batch resources at runtime.
1818

@@ -89,7 +89,7 @@ Follow these steps to create and copy the secret key to use in your code:
8989
1. On the **Certificates & secrets** page, select **New client secret**.
9090
1. On the **Add a client secret** page, enter a description and select an expiration period for the secret.
9191
1. Select **Add** to create the secret and display it on the **Certificates & secrets** page.
92-
1. Copy the secret **Value** to a safe place, because you won't be able to access it again after you leave this page.
92+
1. Copy the secret **Value** to a safe place, because you won't be able to access it again after you leave this page. If you lose access to your key, you can generate a new one.
9393

9494
### Assign Azure RBAC to your application
9595

@@ -171,7 +171,7 @@ For more information on creating a custom role, see [Azure custom roles](../role
171171

172172
## Code examples
173173

174-
The code examples in this section show how to authenticate with Azure AD by using integrated authentication and with a service principal. The code examples use .NET and Python, but the concepts are similar for other languages.
174+
The code examples in this section show how to authenticate with Azure AD by using integrated authentication or with a service principal. The code examples use .NET and Python, but the concepts are similar for other languages.
175175

176176
> [!NOTE]
177177
> An Azure AD authentication token expires after one hour. When you use a long-lived **BatchClient** object, it's best to get a token from MSAL on every request to ensure that you always have a valid token.
@@ -184,7 +184,7 @@ To authenticate with integrated authentication from Batch .NET:
184184

185185
1. Install the [Azure Batch .NET](https://www.nuget.org/packages/Microsoft.Azure.Batch/) and the [MSAL](https://www.nuget.org/packages/Microsoft.Identity.Client/) NuGet packages.
186186

187-
1. Include the following `using` statements in your code:
187+
1. Declare the following `using` statements in your code:
188188

189189
```csharp
190190
using Microsoft.Azure.Batch;
@@ -222,9 +222,9 @@ To authenticate with integrated authentication from Batch .NET:
222222
private const string RedirectUri = "https://<redirect-uri>";
223223
```
224224

225-
1. Write a callback method to acquire the authentication token from Azure AD. The following example calls MSAL to authenticate a user who's interacting with the application. The example uses [ConfidentialClientApplicationBuilder.Create](/dotnet/api/microsoft.identity.client.confidentialclientapplicationbuilder.create) to instantiate `IConfidentialClientApplication`. The MSAL [IConfidentialClientApplication.AcquireTokenByAuthorizationCode](/dotnet/api/microsoft.identity.client.iconfidentialclientapplication.acquiretokenbyauthorizationcode) method prompts the user for their credentials. The application proceeds once the user provides credentials.
225+
1. Write a callback method to acquire the authentication token from Azure AD. The following example calls MSAL to authenticate a user who's interacting with the application. The MSAL [IConfidentialClientApplication.AcquireTokenByAuthorizationCode](/dotnet/api/microsoft.identity.client.iconfidentialclientapplication.acquiretokenbyauthorizationcode) method prompts the user for their credentials. The application proceeds once the user provides credentials.
226226

227-
`WithRedirectUri` specifies the redirect URI that the authorization server redirects the user to after authentication. The *authorizationCode* parameter is the authorization code obtained from the authorization server after the user authenticates.
227+
The *authorizationCode* parameter is the authorization code obtained from the authorization server after the user authenticates. `WithRedirectUri` specifies the redirect URI that the authorization server redirects the user to after authentication.
228228

229229
```csharp
230230
public static async Task<string> GetTokenUsingAuthorizationCode(string authorizationCode, string redirectUri, string[] scopes)
@@ -251,7 +251,7 @@ To authenticate with integrated authentication from Batch .NET:
251251
```csharp
252252
public static void PerformBatchOperations()
253253
{
254-
Func<Task<string>> tokenProvider = () => GetAccessTokenAsync();
254+
Func<Task<string>> tokenProvider = () => GetTokenUsingAuthorizationCode();
255255

256256
using (var client = BatchClient.Open(new BatchTokenCredentials(BatchAccountUrl, tokenProvider)))
257257
{
@@ -274,7 +274,7 @@ To authenticate with a service principal from Batch .NET:
274274
using Microsoft.Identity.Client;
275275
```
276276

277-
1. Reference the Azure AD endpoint in your code, including the tenant ID. When you use a service principal, you must provide a tenant-specific endpoint. You can get your tenant ID from the Azure AD **Overview** page in the Azure portal.
277+
1. Reference the Azure AD endpoint, including the tenant ID. When you use a service principal, you must provide a tenant-specific endpoint. You can get your tenant ID from the Azure AD **Overview** page in the Azure portal.
278278

279279
```csharp
280280
private const string AuthorityUri = "https://login.microsoftonline.com/<tenant-id>";

0 commit comments

Comments
 (0)