Skip to content

Commit 526c044

Browse files
committed
Merge branch 'main' of https://github.com/MicrosoftDocs/azure-docs-pr into mrb_04_04_2023_embeddings_updates
2 parents 1b4f78e + 4bcbb84 commit 526c044

File tree

155 files changed

+2998
-1886
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+2998
-1886
lines changed

.openpublishing.publish.config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,12 @@
884884
"branch": "main",
885885
"branch_mapping": {}
886886
},
887+
{
888+
"path_to_root": "ms-identity-python-webapp-tutorial",
889+
"url": "https://github.com/Azure-Samples/ms-identity-python-webapp",
890+
"branch": "0.5.0",
891+
"branch_mapping": {}
892+
},
887893
{
888894
"path_to_root": "ms-identity-node",
889895
"url": "https://github.com/Azure-Samples/ms-identity-node",

.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-b2c/customize-ui-with-html.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Azure AD B2C runs code in your customer's browser by using [Cross-Origin Resourc
3333

3434
### Custom HTML page content
3535

36-
Create an HTML page with your own branding to serve your custom page content. This page can be a static `*.html` page, or a dynamic page like .NET, Node.js, or PHP.
36+
Create an HTML page with your own branding to serve your custom page content. This page can be a static `*.html` page, or a dynamic page like .NET, Node.js, or PHP,however, Azure B2C does not support any view engines. Any server-side rendering of the dynamic page must be performed by a dedicated web application.
3737

3838
Your custom page content can contain any HTML elements, including CSS and JavaScript, but can't include insecure elements like iframes. The only required element is a div element with `id` set to `api`, such as this one `<div id="api"></div>` within your HTML page.
3939

Loading

articles/active-directory/conditional-access/workload-identity.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services: active-directory
66
ms.service: active-directory
77
ms.subservice: workload-identities
88
ms.topic: how-to
9-
ms.date: 01/05/2023
9+
ms.date: 04/04/2023
1010

1111
ms.author: joflore
1212
author: MicrosoftGuyJFlo
@@ -29,7 +29,7 @@ These differences make workload identities harder to manage and put them at high
2929

3030
> [!IMPORTANT]
3131
> Workload Identities Premium licenses are required to create or modify Conditional Access policies scoped to service principals.
32-
> In directories without appropriate licenses, existing Conditional Access policies for workload identities will continue to function, but can't be modified. For more information see [Microsoft Entra Workload Identities](https://www.microsoft.com/security/business/identity-access/microsoft-entra-workload-identities#office-StandaloneSKU-k3hubfz).  
32+
> In directories without appropriate licenses, existing Conditional Access policies for workload identities will continue to function, but can't be modified. For more information, see [Microsoft Entra Workload Identities](https://www.microsoft.com/security/business/identity-access/microsoft-entra-workload-identities#office-StandaloneSKU-k3hubfz).  
3333
3434
> [!NOTE]
3535
> Policy can be applied to single tenant service principals that have been registered in your tenant. Third party SaaS and multi-tenanted apps are out of scope. Managed identities are not covered by policy.
@@ -49,7 +49,7 @@ Create a location based Conditional Access policy that applies to service princi
4949
1. Under **Assignments**, select **Users or workload identities**.
5050
1. Under **What does this policy apply to?**, select **Workload identities**.
5151
1. Under **Include**, choose **Select service principals**, and select the appropriate service principals from the list.
52-
1. Under **Cloud apps or actions**, select **All cloud apps**. The policy will apply only when a service principal requests a token.
52+
1. Under **Cloud apps or actions**, select **All cloud apps**. The policy applies only when a service principal requests a token.
5353
1. Under **Conditions** > **Locations**, include **Any location** and exclude **Selected locations** where you want to allow access.
5454
1. Under **Grant**, **Block access** is the only available option. Access is blocked when a token request is made from outside the allowed range.
5555
1. Your policy can be saved in **Report-only** mode, allowing administrators to estimate the effects, or policy is enforced by turning policy **On**.
@@ -68,7 +68,7 @@ Create a risk-based Conditional Access policy that applies to service principals
6868
1. Under **Assignments**, select **Users or workload identities**.
6969
1. Under **What does this policy apply to?**, select **Workload identities**.
7070
1. Under **Include**, choose **Select service principals**, and select the appropriate service principals from the list.
71-
1. Under **Cloud apps or actions**, select **All cloud apps**. The policy will apply only when a service principal requests a token.
71+
1. Under **Cloud apps or actions**, select **All cloud apps**. The policy applies only when a service principal requests a token.
7272
1. Under **Conditions** > **Service principal risk**
7373
1. Set the **Configure** toggle to **Yes**.
7474
1. Select the levels of risk where you want this policy to trigger.

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.

articles/active-directory/develop/scenario-web-app-call-api-acquire-token.md

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -182,26 +182,34 @@ public ModelAndView getUserFromGraph(HttpServletRequest httpRequest, HttpServlet
182182

183183
# [Python](#tab/python)
184184

185-
In the Python sample, the code that calls Microsoft Graph is in [app.py#L53-L62](https://github.com/Azure-Samples/ms-identity-python-webapp/blob/48637475ed7d7733795ebeac55c5d58663714c60/app.py#L53-L62).
186-
187-
The code attempts to get a token from the token cache. Then, after setting the authorization header, it calls the web API. If it can't get a token, it signs the user in again.
188-
189-
```python
190-
@app.route("/graphcall")
191-
def graphcall():
192-
token = _get_token_from_cache(app_config.SCOPE)
193-
if not token:
194-
return redirect(url_for("login"))
195-
graph_data = requests.get( # Use token to call downstream service.
196-
app_config.ENDPOINT,
197-
headers={'Authorization': 'Bearer ' + token['access_token']},
198-
).json()
199-
return render_template('display.html', result=graph_data)
200-
```
185+
In the Python sample, the code that calls the API is in [app.py#L60-71](https://github.com/Azure-Samples/ms-identity-python-webapp/blob/0.5.0/app.py#L60-71).
186+
187+
The code attempts to get a token from the token cache. If it can't get a token, it redirects the user to the sign-in route. Otherwise, it can proceed to call the API.
188+
189+
:::code language="python" source="~/ms-identity-python-webapp-tutorial/app.py" range="60-71":::
201190

202191
---
203192

204193
## Next steps
205194

195+
# [ASP.NET Core](#tab/aspnetcore)
196+
197+
Move on to the next article in this scenario,
198+
[Call a web API](scenario-web-app-call-api-call-api.md?tabs=aspnetcore).
199+
200+
# [ASP.NET](#tab/aspnet)
201+
206202
Move on to the next article in this scenario,
207-
[Call a web API](scenario-web-app-call-api-call-api.md).
203+
[Call a web API](scenario-web-app-call-api-call-api.md?tabs=aspnet).
204+
205+
# [Java](#tab/java)
206+
207+
Move on to the next article in this scenario,
208+
[Call a web API](scenario-web-app-call-api-call-api.md?tabs=java).
209+
210+
# [Python](#tab/python)
211+
212+
Move on to the next article in this scenario,
213+
[Call a web API](scenario-web-app-call-api-call-api.md?tabs=python).
214+
215+
---

0 commit comments

Comments
 (0)