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
Copy file name to clipboardExpand all lines: articles/batch/batch-aad-auth.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Azure Batch supports authentication with [Azure Active Directory](/azure/active-
12
12
13
13
This article describes two ways to use Azure AD authentication with Azure Batch:
14
14
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.
16
16
17
17
- 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.
18
18
@@ -89,7 +89,7 @@ Follow these steps to create and copy the secret key to use in your code:
89
89
1. On the **Certificates & secrets** page, select **New client secret**.
90
90
1. On the **Add a client secret** page, enter a description and select an expiration period for the secret.
91
91
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.
93
93
94
94
### Assign Azure RBAC to your application
95
95
@@ -171,7 +171,7 @@ For more information on creating a custom role, see [Azure custom roles](../role
171
171
172
172
## Code examples
173
173
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.
175
175
176
176
> [!NOTE]
177
177
> 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:
184
184
185
185
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.
186
186
187
-
1.Include the following `using` statements in your code:
187
+
1.Declare the following `using` statements in your code:
188
188
189
189
```csharp
190
190
usingMicrosoft.Azure.Batch;
@@ -222,9 +222,9 @@ To authenticate with integrated authentication from Batch .NET:
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.
226
226
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.
using (varclient=BatchClient.Open(newBatchTokenCredentials(BatchAccountUrl, tokenProvider)))
257
257
{
@@ -274,7 +274,7 @@ To authenticate with a service principal from Batch .NET:
274
274
usingMicrosoft.Identity.Client;
275
275
```
276
276
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.
0 commit comments