Azure AD Connect - DateTime Attribute Expression

AdamAshtamkar-4210 1 Reputation point
2021-05-25T01:48:52.967+00:00

Hi there,

We have a requirement of synchronizing an attribute from AD which is a DateTime attribute.

We keep receiving errors based on the transformation that is stopping the flow from the attribute to AzureAD.

If the Flow type is direct, we receive this error: Attempt to convert invalid type to String: System.Byte[]

When I tried to use this expression:

"IIF(IsPresent([customDateTimeAttribute]),CStr(FormatDateTime(DateFromNum([customDateTimeAttribute]),"yyyyMMddHHmmss.0Z")),NULL)"

We receive this error: Error in evaluation of expression

Does anyone know which function would the correct function to use to allow the sync to AzureAD?

It seems to be an issue only for an Attribute which has the type of DateTime.

Thank you very much in advance for any assistance with this.

Regards
Adam

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,377 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. James Hamil 21,391 Reputation points Microsoft Employee
    2021-06-01T22:12:00.663+00:00

    Hi @AdamAshtamkar-4210 , you're syncing from your on-premise AD to AAD, right? Have you looked through this document? It covers expressions pretty extensively.

    Here is an example dateTime expression as mentioned: FormatDateTime([extensionAttribute1], , "yyyyMMddHHmmss.fZ", "yyyy-MM-dd")

    Please let me know if you have any questions and I can help you further!

    Best,
    James

    0 comments No comments

  2. Dr. Alex 11 Reputation points
    2022-10-23T16:34:35.257+00:00

    Not sure if you are doing this for the new EmployeeHireDate attribute that's not available in AD DS.

    I'm doing this by just putting text (String) into the msDS-extAttr1 and sync it to AAD and I just keep in mind that the format should be yyyyMMddHHmmss.fZ. The ".0Z" is important at the end.

    Example: Set-ADUser SamAccountName -replace @{'msDS-cloudExtensionAttribute1' = '20501017082715.0Z' }

    Keep in mind that the time is in UTC and should be set for Morning for the On-Boarding Workflow Lifecycle to work.

    0 comments No comments