Skip to content

Commit 32b535c

Browse files
authored
Merge pull request #211009 from OWinfreyATL/setemployeeDate
set employee leave date time article
2 parents 5200785 + 8a87796 commit 32b535c

File tree

3 files changed

+74
-2
lines changed

3 files changed

+74
-2
lines changed

articles/active-directory/governance/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@
245245
href: workflows-faqs.md
246246
- name: Developer API reference Lifecycle Workflows- Azure Active Directory
247247
href: lifecycle-workflows-developer-reference.md
248+
- name: Set employeeLeaveDateTime for leaver workflows
249+
href: set-employee-leave-date-time.md
248250
- name: Preparing user accounts for Lifecycle workflows tutorials (Preview)
249251
href: tutorial-prepare-azure-ad-user-accounts.md
250252
- name: Configure a Logic App for Lifecycle Workflow use (Preview)

articles/active-directory/governance/how-to-lifecycle-workflow-sync-attributes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ The following table shows the scheduling (trigger) relevant attributes and the m
2323
|Attribute|Type|Supported in HR Inbound Provisioning|Support in Azure AD Connect Cloud Sync|Support in Azure AD Connect Sync|
2424
|-----|-----|-----|-----|-----|
2525
|employeeHireDate|DateTimeOffset|Yes|Yes|Yes|
26-
|employeeLeaveDateTime|DateTimeOffset|Not currently(manually setting supported)|Not currently(manually setting supported)|Not currently(manually setting supported)|
26+
|employeeLeaveDateTime|DateTimeOffset|Yes|Not currently|Not currently|
2727

2828
> [!NOTE]
29-
> Currently, automatic synchronization of the employeeLeaveDateTime attribute for HR Inbound scenarios is not available. To take advantaged of leaver scenarios, you can set the employeeLeaveDateTime manually. Manually setting the attribute can be done in the portal or with Graph. For more information see [User profile in Azure](../fundamentals/active-directory-users-profile-azure-portal.md) and [Update user](/graph/api/user-update?view=graph-rest-beta&tabs=http).
29+
> To take advantaged of leaver scenarios, you can set the employeeLeaveDateTime manually for cloud-only users. For more information, see: [Set employeeLeaveDateTime](set-employee-leave-date-time.md)
3030
3131
This document explains how to set up synchronization from on-premises Azure AD Connect cloud sync and Azure AD Connect for the required attributes.
3232

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
---
2+
title: Set employeeLeaveDateTime
3+
description: Explains how to manually set employeeLeaveDateTime.
4+
author: owinfreyATL
5+
ms.author: owinfrey
6+
ms.service: active-directory
7+
ms.topic: how-to
8+
ms.date: 09/07/2022
9+
ms.custom: template-how-to
10+
---
11+
12+
# Set employeeLeaveDateTime
13+
14+
This article describes how to manually set the employeeLeaveDateTime attribute for a user. This attribute can be set as a trigger for leaver workflows created using Lifecycle Workflows.
15+
16+
## Required permission and roles
17+
18+
To set the employeeLeaveDateTime attribute, you must make sure the correct delegated roles and application permissions are set. They are as follows:
19+
20+
### Delegated
21+
22+
In delegated scenarios, the signed-in user needs the Global Administrator role to update the employeeLeaveDateTime attribute. One of the following delegated permissions is also required:
23+
- User-LifeCycleInfo.ReadWrite.All
24+
- Directory.AccessAsUser.All
25+
26+
### Application
27+
28+
Updating the employeeLeaveDateTime requires the User-LifeCycleInfo.ReadWrite.All application permission.
29+
30+
>[!NOTE]
31+
> The User-LifeCycleInfo.ReadWrite.All permissions is currently hidden and cannot be configured in Graph Explorer or the API permission blade of app registrations.
32+
33+
## Set employeeLeaveDateTime via PowerShell
34+
To set the employeeLeaveDateTime for a user using PowerShell enter the following information:
35+
36+
```powershell
37+
Connect-MgGraph -Scopes "User-LifeCycleInfo.ReadWrite.All"
38+
Select-MgProfile -Name "beta"
39+
40+
$UserId = "<Object ID of the user>"
41+
$employeeLeaveDateTime = "<Leave date>"
42+
43+
$Body = '{"employeeLeaveDateTime": "' + $employeeLeaveDateTime + '"}'
44+
Update-MgUser -UserId $UserId -BodyParameter $Body
45+
46+
$User = Get-MgUser -UserId $UserId -Property employeeLeaveDateTime
47+
$User.AdditionalProperties
48+
```
49+
50+
This script is an example of a user who will leave on September 30, 2022 at 23:59.
51+
52+
```powershell
53+
Connect-MgGraph -Scopes "User-LifeCycleInfo.ReadWrite.All"
54+
Select-MgProfile -Name "beta"
55+
56+
$UserId = "528492ea-779a-4b59-b9a3-b3773ef6da6d"
57+
$employeeLeaveDateTime = "2022-09-30T23:59:59Z"
58+
59+
$Body = '{"employeeLeaveDateTime": "' + $employeeLeaveDateTime + '"}'
60+
Update-MgUser -UserId $UserId -BodyParameter $Body
61+
62+
$User = Get-MgUser -UserId $UserId -Property employeeLeaveDateTime
63+
$User.AdditionalProperties
64+
```
65+
66+
67+
## Next steps
68+
69+
- [How to synchronize attributes for Lifecycle workflows](how-to-lifecycle-workflow-sync-attributes.md)
70+
- [Lifecycle Workflows templates](lifecycle-workflow-templates.md)

0 commit comments

Comments
 (0)