Skip to content

Commit 9f1d12b

Browse files
authored
Added info for trimming any whitespace
Per CSS feedback and contribution, added step for trimming whitespace in the manage an organization's default policy example section.
1 parent 3fde5d1 commit 9f1d12b

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

articles/active-directory/develop/active-directory-configurable-token-lifetimes.md

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.service: active-directory
1010
ms.subservice: develop
1111
ms.workload: identity
1212
ms.topic: conceptual
13-
ms.date: 02/19/2020
13+
ms.date: 04/17/2020
1414
ms.author: ryanwi
1515
ms.custom: aaddev, identityplatformtop40
1616
ms.reviewer: hirsin, jlu, annaba
@@ -240,19 +240,25 @@ In this example, you create a policy that lets your users' sign in less frequent
240240
}')
241241
```
242242
243-
2. To create the policy, run the following command:
243+
1. To create the policy, run the following command:
244244
245245
```powershell
246246
$policy = New-AzureADPolicy -Definition @('{"TokenLifetimePolicy":{"Version":1, "MaxAgeSingleFactor":"until-revoked"}}') -DisplayName "OrganizationDefaultPolicyScenario" -IsOrganizationDefault $true -Type "TokenLifetimePolicy"
247247
```
248248
249-
3. To see your new policy, and to get the policy's **ObjectId**, run the following command:
249+
1. To remove any whitespace, run the following command:
250+
251+
```powershell
252+
Get-AzureADPolicy -id | set-azureadpolicy -Definition @($((Get-AzureADPolicy -id ).Replace(" ","")))
253+
```
254+
255+
1. To see your new policy, and to get the policy's **ObjectId**, run the following command:
250256
251257
```powershell
252258
Get-AzureADPolicy -Id $policy.Id
253259
```
254260
255-
2. Update the policy.
261+
1. Update the policy.
256262
257263
You might decide that the first policy you set in this example is not as strict as your service requires. To set your Single-Factor Refresh Token to expire in two days, run the following command:
258264
@@ -274,21 +280,21 @@ In this example, you create a policy that requires users to authenticate more fr
274280
$policy = New-AzureADPolicy -Definition @('{"TokenLifetimePolicy":{"Version":1,"AccessTokenLifetime":"02:00:00","MaxAgeSessionSingleFactor":"02:00:00"}}') -DisplayName "WebPolicyScenario" -IsOrganizationDefault $false -Type "TokenLifetimePolicy"
275281
```
276282
277-
2. To see your new policy, and to get the policy **ObjectId**, run the following command:
283+
1. To see your new policy, and to get the policy **ObjectId**, run the following command:
278284
279285
```powershell
280286
Get-AzureADPolicy -Id $policy.Id
281287
```
282288
283-
2. Assign the policy to your service principal. You also need to get the **ObjectId** of your service principal.
289+
1. Assign the policy to your service principal. You also need to get the **ObjectId** of your service principal.
284290
285291
1. Use the [Get-AzureADServicePrincipal](/powershell/module/azuread/get-azureadserviceprincipal) cmdlet to see all your organization's service principals or a single service principal.
286292
```powershell
287293
# Get ID of the service principal
288294
$sp = Get-AzureADServicePrincipal -Filter "DisplayName eq '<service principal display name>'"
289295
```
290296
291-
2. When you have the service principal, run the following command:
297+
1. When you have the service principal, run the following command:
292298
```powershell
293299
# Assign policy to a service principal
294300
Add-AzureADServicePrincipalPolicy -Id $sp.ObjectId -RefObjectId $policy.Id
@@ -305,13 +311,13 @@ In this example, you create a policy that requires users to authenticate less fr
305311
$policy = New-AzureADPolicy -Definition @('{"TokenLifetimePolicy":{"Version":1,"MaxInactiveTime":"30.00:00:00","MaxAgeMultiFactor":"until-revoked","MaxAgeSingleFactor":"180.00:00:00"}}') -DisplayName "WebApiDefaultPolicyScenario" -IsOrganizationDefault $false -Type "TokenLifetimePolicy"
306312
```
307313
308-
2. To see your new policy, run the following command:
314+
1. To see your new policy, run the following command:
309315
310316
```powershell
311317
Get-AzureADPolicy -Id $policy.Id
312318
```
313319
314-
2. Assign the policy to your web API. You also need to get the **ObjectId** of your application. Use the [Get-AzureADApplication](/powershell/module/azuread/get-azureadapplication) cmdlet to find your app's **ObjectId**, or use the [Azure portal](https://portal.azure.com/).
320+
1. Assign the policy to your web API. You also need to get the **ObjectId** of your application. Use the [Get-AzureADApplication](/powershell/module/azuread/get-azureadapplication) cmdlet to find your app's **ObjectId**, or use the [Azure portal](https://portal.azure.com/).
315321
316322
Get the **ObjectId** of your app and assign the policy:
317323
@@ -334,19 +340,19 @@ In this example, you create a few policies to learn how the priority system work
334340
$policy = New-AzureADPolicy -Definition @('{"TokenLifetimePolicy":{"Version":1,"MaxAgeSingleFactor":"30.00:00:00"}}') -DisplayName "ComplexPolicyScenario" -IsOrganizationDefault $true -Type "TokenLifetimePolicy"
335341
```
336342
337-
2. To see your new policy, run the following command:
343+
1. To see your new policy, run the following command:
338344
339345
```powershell
340346
Get-AzureADPolicy -Id $policy.Id
341347
```
342348
343-
2. Assign the policy to a service principal.
349+
1. Assign the policy to a service principal.
344350
345351
Now, you have a policy that applies to the entire organization. You might want to preserve this 30-day policy for a specific service principal, but change the organization default policy to the upper limit of "until-revoked."
346352
347353
1. To see all your organization's service principals, you use the [Get-AzureADServicePrincipal](/powershell/module/azuread/get-azureadserviceprincipal) cmdlet.
348354
349-
2. When you have the service principal, run the following command:
355+
1. When you have the service principal, run the following command:
350356
351357
```powershell
352358
# Get ID of the service principal
@@ -356,13 +362,13 @@ In this example, you create a few policies to learn how the priority system work
356362
Add-AzureADServicePrincipalPolicy -Id $sp.ObjectId -RefObjectId $policy.Id
357363
```
358364
359-
3. Set the `IsOrganizationDefault` flag to false:
365+
1. Set the `IsOrganizationDefault` flag to false:
360366
361367
```powershell
362368
Set-AzureADPolicy -Id $policy.Id -DisplayName "ComplexPolicyScenario" -IsOrganizationDefault $false
363369
```
364370
365-
4. Create a new organization default policy:
371+
1. Create a new organization default policy:
366372
367373
```powershell
368374
New-AzureADPolicy -Definition @('{"TokenLifetimePolicy":{"Version":1,"MaxAgeSingleFactor":"until-revoked"}}') -DisplayName "ComplexPolicyScenarioTwo" -IsOrganizationDefault $true -Type "TokenLifetimePolicy"

0 commit comments

Comments
 (0)