Skip to content

Commit 9cd82b3

Browse files
committed
add ms graph powershell examples
1 parent c74a00a commit 9cd82b3

File tree

1 file changed

+29
-7
lines changed

1 file changed

+29
-7
lines changed

articles/active-directory/manage-apps/howto-saml-token-encryption.md

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.service: active-directory
88
ms.subservice: app-mgmt
99
ms.workload: identity
1010
ms.topic: conceptual
11-
ms.date: 06/13/2023
11+
ms.date: 06/15/2023
1212
ms.author: jomondi
1313
ms.reviewer: alamaral
1414
ms.collection: M365-identity-device-management
@@ -22,8 +22,6 @@ ms.custom: enterprise-apps
2222
2323
SAML token encryption enables the use of encrypted SAML assertions with an application that supports it. When configured for an application, Azure AD will encrypt the SAML assertions it emits for that application using the public key obtained from a certificate stored in Azure AD. The application must use the matching private key to decrypt the token before it can be used as evidence of authentication for the signed in user.
2424

25-
This article provides instructions on how to configure token encryption for enterprise applications. It also provides instructions on how to configure SAML token encryption registered applications.
26-
2725
Encrypting the SAML assertions between Azure AD and the application provides additional assurance that the content of the token can't be intercepted, and personal or corporate data compromised.
2826

2927
Even without token encryption, Azure AD SAML tokens are never passed on the network in the clear. Azure AD requires token request/response exchanges to take place over encrypted HTTPS/TLS channels so that communications between the IDP, browser, and application take place over encrypted links. Consider the value of token encryption for your situation compared with the overhead of managing more certificates.
@@ -42,8 +40,8 @@ To configure enterprise application's SAML token encryption, follow these steps:
4240

4341
Create an asymmetric key pair to use for encryption. Or, if the application supplies a public key to use for encryption, follow the application's instructions to download the X.509 certificate.
4442

45-
The public key should be stored in an X.509 certificate file in .cer format.
46-
43+
The public key should be stored in an X.509 certificate file in .cer format. You can copy the contents of the certificate file to a text editor and save it as a .cer file. The certificate file should contain only the public key and not the private key.
44+
4745
If the application uses a key that you create for your instance, follow the instructions provided by your application for installing the private key that the application will use to decrypt tokens from your Azure AD tenant.
4846

4947
1. Add the certificate to the application configuration in Azure AD.
@@ -54,7 +52,9 @@ You can add the public cert to your application configuration within the Azure p
5452

5553
1. Go to the [Azure portal](https://portal.azure.com).
5654

57-
1. Go to the **Azure Active Directory > Enterprise applications** blade and then select the application that you wish to configure token encryption for.
55+
1. Search for and select the **Azure Active Directory**.
56+
57+
1. Select **Enterprise applications** blade and then select the application that you wish to configure token encryption for.
5858

5959
1. On the application's page, select **Token encryption**.
6060

@@ -170,7 +170,7 @@ To configure token encryption, follow these steps:
170170
}
171171
```
172172

173-
# [PowerShell](#tab/azure-powershell)
173+
# [Azure AD PowerShell](#tab/azuread-powershell)
174174

175175
1. Use the latest Azure AD PowerShell module to connect to your tenant.
176176

@@ -188,7 +188,29 @@ To configure token encryption, follow these steps:
188188
$app.TokenEncryptionKeyId
189189
```
190190

191+
# [Microsoft Graph PowerShell](#tab/msgraph-powershell)
192+
193+
1. Use the Microsoft Graph PowerShell module to connect to your tenant.
194+
195+
1. Set the token encryption settings using the **[Update-MgApplication](/powershell/module/microsoft.graph.applications/update-mgapplication?view=graph-powershell-1.0&preserve-view=true)** command.
196+
197+
```powershell
198+
199+
Update-MgApplication -ApplicationId <ApplicationObjectId> -KeyCredentials "<KeyCredentialsObject>" -TokenEncryptionKeyId <keyID>
200+
201+
```
202+
203+
1. Read the token encryption settings using the following commands.
204+
205+
```powershell
206+
207+
$app=Get-MgApplication -ApplicationId <ApplicationObjectId>
191208

209+
$app.KeyCredentials
210+
211+
$app.TokenEncryptionKeyId
212+
213+
```
192214
# [Microsoft Graph](#tab/microsoft-graph)
193215

194216
1. Update the application's `keyCredentials` with an X.509 certificate for encryption. The following example shows a Microsoft Graph JSON payload with a collection of key credentials associated with the application.

0 commit comments

Comments
 (0)