Skip to content

Commit 2a78518

Browse files
authored
Merge pull request #233439 from rwike77/tokenlifetime
adding back configure token lifetimes article, removing portal reference article
2 parents 87395fa + 74b1c9c commit 2a78518

File tree

5 files changed

+85
-48
lines changed

5 files changed

+85
-48
lines changed

.openpublishing.redirection.active-directory.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"redirect_document_id": false
77
},
88
{
9-
"source_path_from_root": "/articles/active-directory/develop/configure-token-lifetimes.md",
10-
"redirect_url": "/azure/active-directory/develop/active-directory-saml-claims-customization",
9+
"source_path_from_root": "/articles/active-directory/develop/registration-config-change-token-lifetime-how-to.md",
10+
"redirect_url": "/azure/active-directory/develop/configure-token-lifetimes",
1111
"redirect_document_id": false
1212
},
1313
{

articles/active-directory/develop/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140
- name: Customize SAML claims
141141
href: active-directory-saml-claims-customization.md
142142
- name: Set an access token lifetime policy
143-
href: registration-config-change-token-lifetime-how-to.md
143+
href: configure-token-lifetimes.md
144144
- name: Directory extension attributes
145145
href: active-directory-schema-extensions.md
146146
- name: SAML app multi-instancing

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ ms.service: active-directory
99
ms.subservice: develop
1010
ms.workload: identity
1111
ms.topic: conceptual
12-
ms.date: 03/07/2023
12+
ms.date: 04/04/2023
1313
ms.author: ryanwi
1414
ms.custom: aaddev, identityplatformtop40, contperf-fy21q1
15-
ms.reviewer: ludwignick, sreyanthmora, marsma
15+
ms.reviewer: ludwignick, sreyanthmora
1616
---
1717
# Configurable token lifetimes in the Microsoft identity platform (preview)
1818

@@ -74,7 +74,7 @@ A token lifetime policy is a type of policy object that contains token lifetime
7474

7575
Reducing the Access Token Lifetime property mitigates the risk of an access token or ID token being used by a malicious actor for an extended period of time. (These tokens cannot be revoked.) The trade-off is that performance is adversely affected, because the tokens have to be replaced more often.
7676

77-
For an example, see [Create a policy for web sign-in](registration-config-change-token-lifetime-how-to.md).
77+
For an example, see [Create a policy for web sign-in](configure-token-lifetimes.md).
7878

7979
Access, ID, and SAML2 token configuration are affected by the following properties and their respectively set values:
8080

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: Set lifetimes for tokens
3+
description: Learn how to set lifetimes for access tokens issued by Microsoft identity platform.
4+
services: active-directory
5+
author: rwike77
6+
manager: CelesteDG
7+
8+
ms.service: active-directory
9+
ms.subservice: develop
10+
ms.workload: identity
11+
ms.topic: how-to
12+
ms.date: 04/04/2023
13+
ms.author: ryanwi
14+
ms.custom: identityplatformtop40, contperf-fy21q2, engagement-fy23
15+
ms.reviewer: ludwignick
16+
---
17+
# Configure token lifetime policies (preview)
18+
19+
In the following steps, you'll implement a common policy scenario that imposes new rules for token lifetime. It's possible to specify the lifetime of an access, SAML, or ID token issued by the Microsoft identity platform. This can be set for all apps in your organization or for a specific service principal. They can also be set for multi-organizations (multi-tenant application).
20+
21+
For more information, see [configurable token lifetimes](active-directory-configurable-token-lifetimes.md).
22+
23+
## Get started
24+
25+
To get started, download the latest [Microsoft Graph PowerShell SDK](/powershell/microsoftgraph/installation).
26+
27+
## Create a policy for web sign-in
28+
29+
In the following steps, you'll create a policy that requires users to authenticate less frequently in your web app. This policy sets the lifetime of the access/ID tokens for your web app.
30+
31+
```powershell
32+
Connect-MgGraph -Scopes "Policy.ReadWrite.ApplicationConfiguration"
33+
34+
# Create a token lifetime policy
35+
$params = @{
36+
Definition = @('{"TokenLifetimePolicy":{"Version":1,"AccessTokenLifetime":"4:00:00"}}')
37+
DisplayName = "WebPolicyScenario"
38+
IsOrganizationDefault = $false
39+
}
40+
$tokenLifetimePolicyId=(New-MgPolicyTokenLifetimePolicy -BodyParameter $params).Id
41+
42+
# Display the policy
43+
Get-MgPolicyTokenLifetimePolicy -TokenLifetimePolicyId $tokenLifetimePolicyId
44+
45+
# Assign the token lifetime policy to an app
46+
$params = @{
47+
"@odata.id" = "https://graph.microsoft.com/v1.0/policies/tokenLifetimePolicies/$tokenLifetimePolicyId"
48+
}
49+
50+
$applicationObjectId="11111111-1111-1111-1111-111111111111"
51+
52+
New-MgApplicationTokenLifetimePolicyByRef -ApplicationId $applicationObjectId -BodyParameter $params
53+
54+
# List the token lifetime policy on the app
55+
Get-MgApplicationTokenLifetimePolicy -ApplicationId $applicationObjectId
56+
57+
# Remove the policy from the app
58+
Remove-MgApplicationTokenLifetimePolicyByRef -ApplicationId $applicationObjectId -TokenLifetimePolicyId $tokenLifetimePolicyId
59+
60+
# Delete the policy
61+
Remove-MgPolicyTokenLifetimePolicy -TokenLifetimePolicyId $tokenLifetimePolicyId
62+
```
63+
64+
## View existing policies in a tenant
65+
66+
To see all policies that have been created in your organization, run the [Get-MgPolicyTokenLifetimePolicy](/powershell/module/microsoft.graph.identity.signins/get-mgpolicytokenlifetimepolicy) cmdlet. Any results with defined property values that differ from the defaults listed above are in scope of the retirement.
67+
68+
```powershell
69+
Get-MgPolicyTokenLifetimePolicy
70+
```
71+
72+
To see which apps are linked to a specific policy that you identified, run [List appliesTo](/graph/api/tokenlifetimepolicy-list-appliesto) with any of your policy IDs.
73+
74+
```powershell
75+
GET https://graph.microsoft.com/v1.0/policies/tokenLifetimePolicies/4d2f137b-e8a9-46da-a5c3-cc85b2b840a4/appliesTo
76+
```
77+
78+
## Next steps
79+
Learn about [authentication session management capabilities](../conditional-access/howto-conditional-access-session-lifetime.md) in Azure AD Conditional Access.

articles/active-directory/develop/registration-config-change-token-lifetime-how-to.md

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)