<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nicolas Hooge on Medium]]></title>
        <description><![CDATA[Stories by Nicolas Hooge on Medium]]></description>
        <link>https://medium.com/@nicolas.hooge?source=rss-42db4e64b29------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Nicolas Hooge on Medium</title>
            <link>https://medium.com/@nicolas.hooge?source=rss-42db4e64b29------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 21:19:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nicolas.hooge/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Alias synchronization from Azure Active Directory and Google Cloud Identity — Part 3…]]></title>
            <link>https://medium.com/@nicolas.hooge/alias-synchronization-from-azure-active-directory-and-google-cloud-identity-part-3-a8172e0d3e48?source=rss-42db4e64b29------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8172e0d3e48</guid>
            <category><![CDATA[azure-active-directory]]></category>
            <category><![CDATA[eventarc]]></category>
            <category><![CDATA[gcp-workflows]]></category>
            <category><![CDATA[google-cloud-identity]]></category>
            <dc:creator><![CDATA[Nicolas Hooge]]></dc:creator>
            <pubDate>Tue, 17 Jan 2023 17:48:49 GMT</pubDate>
            <atom:updated>2023-01-17T17:48:49.682Z</atom:updated>
            <content:encoded><![CDATA[<h3>Alias synchronization from Azure Active Directory and Google Cloud Identity — Part 3: Synchronization workflows</h3><h4>Event-driven solution to synchronize identities with aliases</h4><h3>TL;DR</h3><p>This series of 3 articles focuses the identity sync challenge between AAD and Cloud Identity when a user has<strong> a UPN not matching her primary email address, </strong>and covers in depth a proposed solution to mitigate it:</p><ol><li><a href="https://medium.com/@nicolas.hooge/alias-synchronization-from-azure-active-directory-to-google-cloud-identity-part-1-7b9059e35405">Setting the context</a></li><li><a href="https://medium.com/@nicolas.hooge/alias-synchronization-from-azure-active-directory-and-google-cloud-identity-part-2-ingestion-8d6043c299e4">Ingestion Process</a></li><li>Synchronization workflows (this article)</li></ol><blockquote>The companion source code is available in my github <a href="https://github.com/nihooge/alias_sync_aad_to_ci">repository</a>. <br><strong>Disclaimer: </strong>Please note that the proposed solution, the associated architecture and application code (Terraform/Workflow) are provided solely as an example and are not supported by Google in any way. It is not recommended to use this code as is in a production environment, as it has not been written or tested for this purpose. It is provided as a demonstration of a technical solution only. Its use or modification, in whole or in part, is your responsibility.”</blockquote><h3>Reminder of the objective</h3><p>Our goal is to offer a technical solution to synchronize email adresses associated with a UPN from Azure Active Directory to Cloud Identity alternate/alias emails.</p><p>A simplified schema could be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YNB2v88mXEMvsAG6clz-hg.png" /><figcaption>Updated architecture schema with dedicated steps</figcaption></figure><h3>Step-by-step</h3><p>All right, let’s continue the implementation.</p><h4>EventArc as glue !</h4><p>Eventarc lets you asynchronously deliver events from Google services using loosely coupled services that respond to state changes. In our context, we will receive Pub/Sub messages for any following events:</p><ul><li>The creation of a new user</li><li>A change on anyexternalIdsfield</li></ul><p>Eventarc triggers will “run” <strong>Workflows</strong> (target) for every messages received on dedicated <strong>Pub/Sub topics </strong>(source)<strong> </strong>acting as a serverless glue !</p><p>The EventArc triggers definition in terraform code is quite obvious.</p><pre># Eventarc<br>resource &quot;google_eventarc_trigger&quot; &quot;trigger&quot; {<br>  project  = var.project_id<br>  name     = &quot;${var.resource_name}-trigger&quot;<br>  location = var.region<br>  matching_criteria {<br>    attribute = &quot;type&quot;<br>    value     = &quot;google.cloud.pubsub.topic.v1.messagePublished&quot;<br>  }<br>  destination {<br>    workflow = google_workflows_workflow.worflow.id<br>  }<br>  transport {<br>    pubsub {<br>      topic = var.topic_id<br>    }<br>  }<br>  service_account = google_service_account.eventarc_trigger_sa.id<br><br>  depends_on = [<br>    google_workflows_workflow.worflow<br>  ]<br>}</pre><blockquote>There are two points to consider when using a service account to use EventArc:<br>- The service account must have the role of <em>roles/eventarc.eventReceiver</em>in order to receive events from EventArc sources.<br>- In addition, Google Cloud Workflows will be used as Eventarcs target, so the service account should have the role of <em>roles/workflows.invoker</em>in order to invoke Workflows.</blockquote><blockquote>Please note that these roles are applied at the project level.</blockquote><h4>Why Google Cloud Workflows ?</h4><p>There are several target options supported by Eventarc , such as Cloud Run and GKE. The choice to use Google Cloud Workflows is a personal preference, but it aligns well with our goal of having a fully serverless and event-driven architecture.</p><p>Additionally, the workflow definition in our context is fairly simple and only involves calling the Directory API to retrieve and update metadata, which is a sweet spot for Workflows.</p><p>Last point, it is also possible with Terraform to deploy the worflow definition directly in the terraform code using the source_contents attribute(<a href="https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/workflows_workflow">google_workflows_workflow resource</a>).</p><h4>Workflows / Directory API permissions</h4><p>We will have 2 different workflows :</p><ul><li>User creation</li><li>ExternalId modification</li></ul><p>These two workflows will only interact with their respective trigger sources (Pub/Sub event) and the Directory API.</p><p>The Directory API enables us to interact with Cloud Identity, and in our context, we will be manipulating <a href="https://developers.google.com/admin-sdk/directory/reference/rest/v1/users">users</a> and <a href="https://developers.google.com/admin-sdk/directory/reference/rest/v1/users.aliases">users.aliases</a> resources.</p><p>To follow the principle of least privilege, I recommend creating a dedicated service account and a dedicated role. Why ?</p><p>Manipulating User resources is a powerful privilege, and accessing the Directory API is one of the most security-sensitive topic. It would therefore be inappropriate to grant an Admin User role to a default service account.</p><p>In the Admin console, you can create a custom role that meets our needs<br>To do this, go to https://admin.google.com→ Account→ Admin roles→ create new role. From there, you can select the specific privileges to grant to this role. It is possible to differentiate between console permissions and <strong>API permissions</strong> which is a good security measure.</p><p>In our context, we only need to read User resource, and to add / remove aliases (alternate emails), that’s all !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*Re8KVyBxdR2T_a0WSkHthg.png" /><figcaption>Custom Role for Directory API</figcaption></figure><p>Although it is possible to perform all of these steps using Terraform (<a href="https://registry.terraform.io/providers/hashicorp/googleworkspace/latest/docs/resources/role">Workspace role</a>, <a href="https://registry.terraform.io/providers/hashicorp/googleworkspace/latest/docs/resources/role_assignment">Workspace role assignment</a>) , it would require to execute the terraform code by a super admin user, which is not recommended.</p><p>Please note, that the role assignment to our service account should be postponed until we have created the service account that will be executing the workflows !</p><h4>Additional Google Cloud Workflows notes</h4><p><strong>Make authenticated requests to Directory API</strong></p><p>While our workflows are executed by a service account with the required permissions to access the Directory API, you need to authenticate the HTTP requests.</p><p><strong>By default</strong>, HTTP requests do not contain identity or access tokens for security reasons.</p><p>However a workflow’s service account can generate OAuth 2.0 tokens that the workflow can use to authenticate to any <strong>Google Cloud APIs</strong>.</p><p>To make an HTTP request using the OAuth 2.0 protocol, add an auth section to the args section of your workflow&#39;s definition, after you specify the URL.</p><pre>url: ${&quot;https://admin.googleapis.com/admin/directory/v1/users/&quot;+userUPN}<br>  auth:<br>    type: OAuth2<br>    scopes: https://www.googleapis.com/auth/admin.directory.user</pre><p>For the Directory API, you need to set the scope field to https://www.googleapis.com/auth/admin.directory.user</p><p><strong>Runtime arguments<br></strong>In our context, both workflows will be triggered by Pub/Sub events initiated by a Cloud Logging sink. These events will be passed as runtime arguments in the workflow execution request if theparams: [event]field is included in themain block of your workflow.</p><p>Pub/Sub messages are base64-encoded, so to retrieve the message in JSON format, we will need first to decode the base64 encoded input and then decode the JSON using some <a href="https://cloud.google.com/workflows/docs/reference/stdlib/overview">standard library functions</a>.</p><pre>pubsubMessage: ${base64.decode(event.data.message.data)}<br>jsonMessage: ${ json.decode(pubsubMessage)}</pre><p><strong>Logging<br></strong>In addition to the custom role required for our use case, it is recommended also to grant the roles/logging.logWriter role to the Workflows service account to enable the worflows to write logs to Cloud Logging.</p><p>Follow this example to log within a worflow:</p><pre>- log_tmp:<br>    call: sys.log<br>    args:<br>        text: &quot;this is a log&quot;<br>        severity: DEBUG</pre><h4>Workflow : user-creation</h4><p>This workflow will be executed in the case of user creation.</p><p>The associated log event (<a href="https://developers.google.com/admin-sdk/reports/v1/appendix/activity/admin-user-settings#CREATE_USER">create_user</a> event) is fairly brief and only includes the user’s primary email as useful information.</p><p>Please see a log’s extract:</p><pre>{<br>  &quot;protoPayload&quot;: {<br>    &quot;@type&quot;: &quot;type.googleapis.com/google.cloud.audit.AuditLog&quot;,<br>    &quot;serviceName&quot;: &quot;admin.googleapis.com&quot;,<br>    &quot;methodName&quot;: &quot;google.admin.AdminService.createUser&quot;,<br>    &quot;resourceName&quot;: &quot;organizations/{ORGANIZATION_ID}/userSettings&quot;,<br>    &quot;metadata&quot;: {<br>      &quot;event&quot;: [<br>        {<br>          &quot;parameter&quot;: [<br>            {<br>              &quot;name&quot;: &quot;USER_EMAIL&quot;,<br>              &quot;label&quot;: &quot;LABEL_OPTIONAL&quot;,<br>              &quot;value&quot;: &quot;{PRIMARY_USER_EMAIL}&quot;,<br>              &quot;type&quot;: &quot;TYPE_STRING&quot;<br>            }<br>          ],<br>          &quot;eventType&quot;: &quot;USER_SETTINGS&quot;,<br>          &quot;eventName&quot;: &quot;CREATE_USER&quot;<br>        }<br>      ],<br>      &quot;@type&quot;: &quot;type.googleapis.com/ccc_hosted_reporting.ActivityProto&quot;<br>    }<br>  },<br>  &quot;resource&quot;: {<br>    &quot;type&quot;: &quot;audited_resource&quot;,<br>    &quot;labels&quot;: {<br>      &quot;method&quot;: &quot;google.admin.AdminService.createUser&quot;,<br>      &quot;service&quot;: &quot;admin.googleapis.com&quot;<br>    }<br>  },<br>  &quot;logName&quot;: &quot;organizations/{ORGANIZATION_ID}/logs/cloudaudit.googleapis.com%2Factivity&quot;,<br>}</pre><p>Therefore the workflow schema will be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*dVn3-olomKXw5TdNc38LNQ.png" /><figcaption>user-creation workflow schema</figcaption></figure><p>To begin, we extract the user identifier (USER_EMAIL) from the event. Then we query the Directory API to get user metadata, and specifically look for any externalIds that are associated with the user.</p><p>The externalIds field is a list of struct with a “type” and a “value” attributes (see <a href="https://developers.google.com/admin-sdk/directory/reference/rest/v1/users">user resource</a> definition).</p><p>As described in the previous article, we use the externalIds[type = &quot;login_id&quot;] field to store the user mail from AAD.</p><p>To make it easier to extract this information, we use a subworkflow that loops through the list , and extracts the alternate email value when type = &quot;login_id&quot;.</p><blockquote>It is a best practice to use a subworkflow to improve the readability of the workflow definition by grouping a series of steps in one logical unit.</blockquote><blockquote>I recommend to read the following articles from <a href="https://medium.com/u/6444b44155fa">Mete Atamel</a> and <a href="https://medium.com/u/431147437aeb">Guillaume Laforge</a> to learn more on best practices associated with Google Cloud Worfkows:<br>- <a href="https://cloud.google.com/blog/topics/developers-practitioners/workflows-patterns-and-best-practices-part-1">Workflows patterns and best practices — Part 1</a><strong><br>- </strong><a href="https://cloud.google.com/blog/topics/developers-practitioners/workflows-patterns-and-best-practices-part-2">Workflows patterns and best practices — Part 2</a><br>- <a href="https://cloud.google.com/blog/topics/developers-practitioners/workflows-patterns-and-best-practices-part-3">Workflows patterns and best practices — Part 3</a></blockquote><p>Finally we save this alternate email as an alias for the user by calling the dedicated <a href="https://developers.google.com/admin-sdk/directory/reference/rest/v1/users.aliases/insert">aliases insert method</a>.</p><p>Please find the definition of the user-creation workflow:</p><pre>main:<br>  params: [event]<br>  steps:<br>      - decode_pubsub_message:<br>          assign:<br>          - base64: ${base64.decode(event.data.message.data)}<br>          - jsonMessage: ${json.decode(text.decode(base64))}<br>          - eventName: ${jsonMessage.protoPayload.metadata.event[0].eventName}<br>          - userUPN: ${jsonMessage.protoPayload.metadata.event[0].parameter[0].value}<br>      - get_user_metadata:<br>          call: http.get<br>          args:<br>            url: ${&quot;https://admin.googleapis.com/admin/directory/v1/users/&quot;+userUPN}<br>            auth:<br>              type: OAuth2<br>              scopes: https://www.googleapis.com/auth/admin.directory.user<br>          result: userMetadata<br>      - extract_alternative_email:<br>          assign: <br>            - altEmail: ${subworkflow_extract_alternative_email(userMetadata.body.externalIds)}<br>      - checkAltEmail:<br>          switch:<br>            - condition: ${altEmail == null}  <br>              return: &quot;No alternate email found&quot;<br>      - checkCurrentUserAlias:<br>          switch:<br>            - condition: ${&quot;aliases&quot; in userMetadata.body and altEmail in userMetadata.body.aliases}  <br>              return: &quot;No change required&quot;<br>      - setUserAlias:<br>          call: http.post<br>          args:<br>              url: ${&quot;https://admin.googleapis.com/admin/directory/v1/users/&quot;+userUPN+&quot;/aliases&quot;}<br>              body: <br>                &quot;alias&quot;: ${altEmail}<br>              auth:<br>                type: OAuth2<br>                scopes:  https://www.googleapis.com/auth/admin.directory.user<br>          result: setUserAliasResponse<br>      - return_output:<br>          return: &#39;${&quot;Add &quot;+altEmail+&quot; as alias email for &quot;+userUPN}&#39;<br>subworkflow_extract_alternative_email:<br>    params: [externalIds]<br>    steps:<br>        - initVariable:<br>            assign:<br>            - tempAltEmail: null<br>        - loopExternalIds:<br>            for:<br>              value: externalId<br>              in: ${externalIds}<br>              steps:<br>                  - checkType:<br>                      switch:<br>                        - condition: ${externalId.type != &quot;login_id&quot;}<br>                          next: continue<br>                      next: define<br>                  - define:<br>                      assign:<br>                      - tempAltEmail: ${externalId.value}<br>                  - exit:<br>                      next: break              <br>        - prepareMessage:<br>            return: ${tempAltEmail}</pre><h4>Workflow : <strong>externalid-modification</strong></h4><p>The second workflow will be triggered when there is a change in any externalIds[type = “login_id”] field.</p><p>Whereas we have to handle different use cases (Alias creation, update, deletion), the associated log event (<a href="https://developers.google.com/admin-sdk/reports/v1/appendix/activity/admin-user-settings#CHANGE_USER_EXTERNAL_ID">change_user_external_id</a> event) is very detailed, and includes the primary user email as well as the previous and new values for externalIds.</p><p>The only challenge is to extract the correct value for type=&quot;login_id&quot; from the externalIds fields. A simple regex will make the job !</p><p>Please see a log’s extract:</p><pre>{<br>  &quot;protoPayload&quot;: {<br>    &quot;@type&quot;: &quot;type.googleapis.com/google.cloud.audit.AuditLog&quot;,<br>    &quot;serviceName&quot;: &quot;admin.googleapis.com&quot;,<br>    &quot;methodName&quot;: &quot;google.admin.AdminService.changeUserExternalId&quot;,<br>    &quot;resourceName&quot;: &quot;organizations/{ORGANIZATION_ID}/userSettings&quot;,<br>    &quot;metadata&quot;: {<br>      &quot;@type&quot;: &quot;type.googleapis.com/ccc_hosted_reporting.ActivityProto&quot;,<br>      &quot;event&quot;: [<br>        {<br>          &quot;parameter&quot;: [<br>            {<br>              &quot;label&quot;: &quot;LABEL_OPTIONAL&quot;,<br>              &quot;name&quot;: &quot;USER_EMAIL&quot;,<br>              &quot;type&quot;: &quot;TYPE_STRING&quot;,<br>              &quot;value&quot;: &quot;{PRIMARY_USER_EMAIL}&quot;<br>            },<br>            {<br>              &quot;type&quot;: &quot;TYPE_STRING&quot;,<br>              &quot;label&quot;: &quot;LABEL_OPTIONAL&quot;,<br>              &quot;value&quot;: &quot;\&quot;:{ANY-VALUE}\&quot;&quot;,<br>              &quot;name&quot;: &quot;OLD_VALUE&quot;<br>            },<br>            {<br>              &quot;value&quot;: &quot;\&quot;:{ANY-VALUE}\&quot; \&quot;LOGIN_ID:{ALTERNATE_EMAIL}\&quot;&quot;,<br>              &quot;type&quot;: &quot;TYPE_STRING&quot;,<br>              &quot;label&quot;: &quot;LABEL_OPTIONAL&quot;,<br>              &quot;name&quot;: &quot;NEW_VALUE&quot;<br>            }<br>          ],<br>          &quot;eventName&quot;: &quot;CHANGE_USER_EXTERNAL_ID&quot;,<br>          &quot;eventType&quot;: &quot;USER_SETTINGS&quot;<br>        }<br>      ]<br>    }<br>  },<br>  &quot;resource&quot;: {<br>    &quot;type&quot;: &quot;audited_resource&quot;,<br>    &quot;labels&quot;: {<br>      &quot;service&quot;: &quot;admin.googleapis.com&quot;,<br>      &quot;method&quot;: &quot;google.admin.AdminService.changeUserExternalId&quot;<br>    }<br>  },<br>  &quot;logName&quot;: &quot;organizations/{ORGANIZATION_ID}/logs/cloudaudit.googleapis.com%2Factivity&quot;,<br>}</pre><p>Unlike the first workflow, we need to retrieve a possible value for the user’s current alias.</p><p>With all this variables in hand, our workflow logic can be described in terms of 3 use cases:</p><ul><li>Creation: if the current alias is empty, and NEW_VALUE is set, we need to create a new alias</li><li>Modification : if both OLD_VALUE and NEW_VALUE is set, we need to create a new alias and delete the old one.</li><li>Deletion: if OLD_VALUE is set, but NEW_VALUE is empty, we need to delete the previous alias.</li></ul><p>Therefore the workflow schema will include 2 tasks that may be run in parallel (a creation step and/or deletion step):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*WmmloPV-IPZ-HoB-oJvIvQ.png" /><figcaption>externalid-modification workflow schema</figcaption></figure><p>Please find the definition of the externalid-modification workflow:</p><pre>main:<br>  # Pub/Sub message/event<br>  params: [event]<br>  steps:<br>      # Pub/Sub message as base64 encoded strings<br>      # Fully decode JSON Payload message<br>      - decode_pubsub_message:<br>          assign:<br>          - pubsubMessage: ${base64.decode(event.data.message.data)}<br>          - jsonMessage: ${json.decode((pubsubMessage)}<br>          - eventName: ${jsonMessage.protoPayload.metadata.event[0].eventName}<br>      # Extract from JSON Payload the userUPN, oldAlternateEmail, newAlternateEmail<br>      - extract_event_data:<br>          assign: <br>            - eventData: ${subworkflow_extract_event_data(jsonMessage.protoPayload.metadata.event[0].parameter)}<br>            - userUPN: ${eventData.UserUPN}<br>            - oldAlternateEmail: ${eventData.OldAlternateEmail}<br>            - newAlternateEmail: ${eventData.NewAlternateEmail}<br>            - output: [&#39;${&quot;Update on &quot;+userUPN+&quot; aliases&quot;}&#39;]<br>      # Retrieve metadata for the user identified by its userUPN<br>      - get_user_metadata:<br>          call: http.get<br>          args:<br>            url: ${&quot;https://admin.googleapis.com/admin/directory/v1/users/&quot;+userUPN}<br>            auth:<br>              type: OAuth2<br>              scopes: https://www.googleapis.com/auth/admin.directory.user<br>          result: userMetadata<br>      - log_tmp:<br>            call: sys.log<br>            args:<br>                text: ${userMetadata.body}<br>                severity: DEBUG<br>      # OldAlternateEmail should be deleted on user&#39;s aliases<br>      # NewAlternateEmail should be added on user&#39;s aliases<br>      - parallelStep:<br>            parallel:<br>                shared: [output]<br>                branches:<br>                - aliasDeletion:<br>                    steps:<br>                        - checkNeedDeletion:<br>                            switch:<br>                                - condition: ${oldAlternateEmail!=&quot;&quot; and &quot;aliases&quot; in userMetadata.body and oldAlternateEmail in userMetadata.body.aliases}<br>                                  steps:<br>                                  - deletion:<br>                                        call: http.delete<br>                                        args:<br>                                            url: ${&quot;https://admin.googleapis.com/admin/directory/v1/users/&quot;+userUPN+&quot;/aliases/&quot;+oldAlternateEmail}<br>                                            auth:<br>                                                type: OAuth2<br>                                                scopes:  https://www.googleapis.com/auth/admin.directory.user<br>                                        result: deleteUserAliasResponse<br>                                  - deletionOuput:<br>                                        assign:<br>                                        - output: &#39;${list.concat(output, oldAlternateEmail+&quot; removed&quot;)}&#39;<br>                                  - log_deleteUserAliasResponse:<br>                                        call: sys.log<br>                                        args:<br>                                            text: ${deleteUserAliasResponse}<br>                                            severity: DEBUG<br>                - aliasCreation:<br>                    steps:<br>                        - checkNeedCreation:<br>                            switch:<br>                                - condition: ${newAlternateEmail!=&quot;&quot; and(not(&quot;aliases&quot; in userMetadata.body) or not(newAlternateEmail in userMetadata.body.aliases))}<br>                                  steps:<br>                                  - creation:<br>                                        call: http.post<br>                                        args:<br>                                            url: ${&quot;https://admin.googleapis.com/admin/directory/v1/users/&quot;+userUPN+&quot;/aliases&quot;}<br>                                            body: <br>                                                &quot;alias&quot;: ${newAlternateEmail}<br>                                            auth:<br>                                                type: OAuth2<br>                                                scopes:  https://www.googleapis.com/auth/admin.directory.user<br>                                        result: createUserAliasResponse<br>                                  - creationOuput:<br>                                        assign:<br>                                        - output: &#39;${list.concat(output, newAlternateEmail+&quot; added&quot;)}&#39;<br>                                  - log_createUserAliasResponse:<br>                                        call: sys.log<br>                                        args:<br>                                            text: ${createUserAliasResponse}<br>                                            severity: DEBUG<br>      - return_output:<br>          return: ${output}<br># Sub Workflow to extract event data from decoded json associated with an externalids change event<br>subworkflow_extract_event_data:<br>    params: [event]<br>    steps:<br>        - initVariable:<br>            assign:<br>            - userUPN: null<br>            - oldAlternateEmail: null<br>            - newAlternateEmail: null<br>        - extractLoop:<br>            for:<br>              value: parameter<br>              in: ${event}<br>              steps:<br>                  - checkType:<br>                      switch:<br>                        - condition: ${parameter.name == &quot;USER_EMAIL&quot;}<br>                          assign:<br>                          - userUPN: ${parameter.value}<br>                        - condition: ${parameter.name == &quot;OLD_VALUE&quot;}<br>                          assign:<br>                          - oldAlternateEmail: ${subworkflow_extract_login_id(parameter.value)}<br>                        - condition: ${parameter.name == &quot;NEW_VALUE&quot;}<br>                          assign:<br>                          - newAlternateEmail: ${subworkflow_extract_login_id(parameter.value)}<br>                      next: continue<br>        - prepareMessage:<br>            assign:<br>            - eventData:<br>                UserUPN: ${userUPN}<br>                OldAlternateEmail: ${oldAlternateEmail}<br>                NewAlternateEmail: ${newAlternateEmail}<br>        - outputMessage:<br>            return: ${eventData}<br># Sub Workflow to extract a login_id from decoded json associated with an externalids change event<br>subworkflow_extract_login_id:<br>    params: [input]<br>    steps:<br>    - extract:<br>        assign:<br>            - temp: ${text.find_all_regex(input,&quot;LOGIN_ID:.*\&quot;&quot;)}<br>            - output: ${text.substring(temp[0].match,9,len(temp[0].match)-1)}<br>    - returnOutput:<br>            return: ${output}</pre><p>A last note regarding the parallel tasks created previously, it is possible to use two sequential steps instead.</p><h3>How to use the companion code</h3><p>“Bravo”, if you have made it to this point! <br>It is now time to play with the companion code. I have tried to be as detailed as possible in the README.md, but for clarity, please refer to the following steps.</p><h4>Pre-requirements</h4><ul><li>An Azure Active Directory instance</li><li>A Google Cloud Identity instance</li><li>A fully operationnal Google Cloud/G Suite Connector app that synchronize users to Cloud Identity with a primary mapping between UPN and primary email</li></ul><h4>Installation</h4><ul><li><a href="https://support.google.com/a/answer/9320190">Share Workspace Logs/data with Google Cloud services</a></li><li>Create a custom Admin Role (Admin Console)</li><li>Create a “terraform.tfvars” file and assign a value to these variables (organization_id , folder_id, project_id, billing_account_id)</li><li>Execute the Terraform code. <br>It will create a dedicated GCP Project and all the GCP resources . At the end, it will output worfkow’s service account email</li><li>Grant this service account the custom role created in the Admin Console at the second step.</li></ul><p>You are ready to test.</p><h4>End-To-End Testing</h4><p>Scenarios should be taken in order.</p><p><strong>User Creation Scenario</strong></p><ul><li>In Azure Active Directory, create a new user with a UPN and a mail attribute</li><li>Force synchronisation for this new user on the Google Cloud/G Suite Connector app</li><li>Wait a few seconds</li><li>A log entry should be created in Cloud Logging for theCREATE_USER event</li><li>A worflow execution should be visible in the GCP Console</li><li>Finally, you can verify in the Admin Console that the alternate/alias email for this user is correctly set to the email previously specified in Azure Active Directory.</li></ul><p><strong>Mail Deletion Scenario</strong></p><ul><li>In Azure Active Directory, using the same user, remove the mail value.</li><li>Force synchronisation for this user on the Google Cloud/G Suite Connector app</li><li>Wait a few seconds</li><li>A log entry should be created in Cloud Logging for theCHANGE_USER_EXTERNAL_ID event</li><li>A worflow execution should be visible in the GCP Console</li><li>Finally, you can verify in the Admin Console that there is no aliases set for the user.</li></ul><p><strong>Mail Creation Scenario</strong></p><ul><li>In Azure Active Directory, using the same user, add a mail value.</li><li>Force synchronisation for this user on the Google Cloud/G Suite Connector app</li><li>Wait a few seconds</li><li>A log entry should be created in Cloud Logging for theCHANGE_USER_EXTERNAL_ID event</li><li>A worflow execution should be visible in the GCP Console</li><li>Finally, you can verify in the Admin Console that the alternate/alias email for this user is correctly set to the email previously specified in Azure Active Directory.</li></ul><p><strong>Mail Modification Scenario</strong></p><ul><li>In Azure Active Directory, using the same user, change the mail value.</li><li>Force synchronisation for this user on the Google Cloud/G Suite Connector app</li><li>Wait a few seconds</li><li>A log entry should be created in Cloud Logging for theCHANGE_USER_EXTERNAL_ID event</li><li>A worflow execution should be visible in the GCP Console</li><li>Finally, you can verify in the Admin Console that the new alternate / alias email is set for this user.</li></ul><h3>Final Note</h3><p>It was a long journey for such a small task, but it represents a nice illustration of the power of serverless services such as Pub/Sub, Eventarc and Workflows.</p><p>Furthermore, we now have a solution to synchronize both UserPrincipalName and mail identities between AAD and Google Cloud Identity.</p><p>Please find the complete architecture schema:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LXhUK-HhEAUQtsSRjGt1WQ.png" /><figcaption>Complete Solution Architecture</figcaption></figure><h3>References</h3><p>Please find some helpful references on the topics covered in the article.</p><h4>Workflows</h4><ul><li><a href="https://cloud.google.com/workflows/docs/passing-runtime-arguments">Pass runtime arguments in an execution request</a></li><li><a href="https://cloud.google.com/workflows/docs/reference/syntax/subworkflows">Subworkflows</a></li><li><a href="https://cloud.google.com/workflows/docs/reference/syntax/parallel-steps">Parallel steps</a></li><li><a href="https://cloud.google.com/workflows/docs/reference/syntax/syntax-cheat-sheet">Syntax cheat sheet</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8172e0d3e48" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Alias synchronization from Azure Active Directory and Google Cloud Identity — Part 2: Ingestion…]]></title>
            <link>https://medium.com/@nicolas.hooge/alias-synchronization-from-azure-active-directory-and-google-cloud-identity-part-2-ingestion-8d6043c299e4?source=rss-42db4e64b29------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d6043c299e4</guid>
            <category><![CDATA[google-cloud-logging]]></category>
            <category><![CDATA[azure-active-directory]]></category>
            <category><![CDATA[eventarc]]></category>
            <category><![CDATA[pub-sub]]></category>
            <category><![CDATA[google-cloud-identity]]></category>
            <dc:creator><![CDATA[Nicolas Hooge]]></dc:creator>
            <pubDate>Tue, 17 Jan 2023 17:47:26 GMT</pubDate>
            <atom:updated>2023-01-17T17:49:11.381Z</atom:updated>
            <content:encoded><![CDATA[<h3>Alias synchronization from Azure Active Directory and Google Cloud Identity — Part 2: Ingestion process</h3><h4><em>How to use Cloud Identity CRUD events to build a synchronization solution</em></h4><h3>TL;DR</h3><p>This series of 3 articles focuses the identity sync challenge between AAD and Cloud Identity when a user has<strong> a UPN not matching her primary email address, </strong>and covers in depth a proposed solution to mitigate it:</p><ol><li><a href="https://medium.com/@nicolas.hooge/alias-synchronization-from-azure-active-directory-to-google-cloud-identity-part-1-7b9059e35405">Setting the context</a></li><li>Ingestion Process (this article)</li><li><a href="https://medium.com/@nicolas.hooge/alias-synchronization-from-azure-active-directory-and-google-cloud-identity-part-3-a8172e0d3e48">Synchronization workflows</a></li></ol><blockquote>The companion source code is available in my github <a href="https://github.com/nihooge/alias_sync_aad_to_ci">repository</a>. <br><strong>Disclaimer: </strong>Please note that the proposed solution, the associated architecture and application code (Terraform/Workflow) are provided solely as an example and are not supported by Google in any way. It is not recommended to use this code as is in a production environment, as it has not been written or tested for this purpose. It is provided as a demonstration of a technical solution only. Its use or modification, in whole or in part, is your responsibility.”</blockquote><h3>Reminder of the objective</h3><p>Our goal is to offer a technical solution to synchronize email adresses associated with a UPN from Azure Active Directory to Cloud Identity alternate/alias emails.</p><p>A simplified schema could be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*WH-KJn6CmZJr5-IWQMb0eQ.png" /><figcaption>High-level technical solution</figcaption></figure><h3>Ingestion process</h3><p>Cloud Identity’s Admin console and Directory API generate events called <a href="https://cloud.google.com/logging/docs/audit/gsuite-audit-logging">Admin Audit Activity Events</a>. The Google Cloud/G Suite Connector app uses the Directory API to sync identities from Azure Active Directory to Google Cloud Directory, and these syncs will generate Admin Audit Activity Events.</p><p>Performing CRUD actions on a user generates different types of events (<a href="https://developers.google.com/admin-sdk/reports/v1/appendix/activity/admin-user-settings">Admin Audit Activity Events — User Settings</a>), and in particular, two of these events are relevant to our use case:</p><ul><li><a href="https://developers.google.com/admin-sdk/reports/v1/appendix/activity/admin-user-settings#CREATE_USER">User creation</a></li><li><a href="https://developers.google.com/admin-sdk/reports/v1/appendix/activity/admin-user-settings#CHANGE_USER_EXTERNAL_ID">Change external ID</a></li></ul><p>The first event is self-explanatory.</p><p>The second event requires further explanation: our goal is to sync the email address from Azure Active Directory to Cloud Identity. In order to do this, we need a field in Cloud Identity to store the email address and to enable synchronization with AAD. This field should also generate a specific event when it is changed.</p><p>After reviewing the <a href="https://developers.google.com/admin-sdk/directory/reference/rest/v1/users">user resource structure</a>, it seems that the most logical field to use would be the field emails[].address. <br>However, modifying this attribute <strong>does not generate any event or log</strong>.<br>Therefore, I recommend using the field <a href="https://developers.google.com/admin-sdk/directory/reference/rest/v1/users#:~:text=home%2C%20other%2C%20work.-,externalids,-value%20(Value%20format">externalIds[type=login_id]</a>. This field is available in the default mapping of the <a href="https://azuremarketplace.microsoft.com/en-us/marketplace/apps/aad.googleapps">Google Cloud/G Suite Connector app</a> and generates a “<a href="https://developers.google.com/admin-sdk/reports/v1/appendix/activity/admin-user-settings#CHANGE_USER_EXTERNAL_ID">Change User External Id</a>” event when modified.</p><p>With these two events, we will be able to handle all create, read, update, and delete actions on a user, including creating a user with a specific email address and modifying the users’s email address.</p><blockquote>If you delve deeper into the <a href="https://developers.google.com/admin-sdk/directory/reference/rest/v1/users#:~:text=home%2C%20other%2C%20work.-,externalids,-value%20(Value%20format">externalIds</a> field, you may wonder why we chose the predefined <a href="https://developers.google.com/admin-sdk/directory/reference/rest/v1/users#:~:text=home%2C%20other%2C%20work.-,externalids,-value%20(Value%20format">externalIds[type=login_id]</a>instead of using a custom external ID.</blockquote><blockquote>The reason is that the Google Cloud/G Suite Connector app has a default set of mappings and does not have the ability to extend them.</blockquote><blockquote>While there is a mapping for externalIds[type=custom], it is not implemented on the Microsoft’s AAD app as defined in the Google documentation. If the external ID type is custom, the customerType property contains the custom type value and must be set, but the Microsoft app does not allow this.</blockquote><blockquote>Therefore, I prefer to use a predefined custom type that makes the most sense in our context.</blockquote><h3>Step-by-step</h3><p>Alright, let’s begin the implementation.</p><h4><strong>Mapping of email identity — synchronization between Azure Active Directory and Cloud Identity</strong></h4><p>First, I assume that you have already set up the Google Cloud/G Suite Connector app. If not, please follow this guide: <a href="https://cloud.google.com/architecture/identity/federating-gcp-with-azure-ad-configuring-provisioning-and-single-sign-on">Azure AD user provisioning and single sign-on</a></p><p>The default configuration of the AAD/CI sync app does not map the target attribute externalIds.[type eq &quot;login_id&quot;].value. To fix this, you need to create a mapping mail → externalIds.[type eq &quot;login_id&quot;].value on the synchronization AAD application.</p><p>To do this, go to the provisioning page of the Google Cloud/G Suite Connector app and click on the user mapping section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*P-2ZPdJX7AsY6xTlO0kvgA.png" /><figcaption>Mapping selection from Google Cloud/G Suite Connector app</figcaption></figure><p>Then, click on ‘Add New Mapping’ and edit it as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*VMTPO39PZD9rPJQSsFfeww.png" /><figcaption>Attribute mapping edition from Google Cloud/G Suite Connector app</figcaption></figure><p>This setting will tell the app to sync the ‘mail’ attribute from Azure Active Directory to the externalIds[type=login_id]field in Cloud Identity.</p><p>After completing this step, you should have a similar setup as shown. Please note the different mappings for userPrincipalNameand mail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*4Gq7KF8qIc821oPVnODl-g.png" /><figcaption>Attribute mapping from Google Cloud/G Suite Connector app</figcaption></figure><p>With this configuration in place, the user’s mailvalue in Azure Active Directory is now synchronized and stored in the externalIds[type eq &quot;login_id&quot;]user’s field in Cloud Identity.</p><h4><strong>Enabling Admin logs in Google Cloud Platform</strong></h4><p>By default, Admin logs from Cloud Identity/Workspace are not accessible within Google Cloud Platform. In order to react to the arrival of a Admin Log , it is necessary to make them available within Google Cloud Platform.</p><p>To do this, follow this guide: <a href="https://support.google.com/a/answer/9320190">Share data with Google Cloud services — Google Workspace Admin Help</a></p><p>In detail, on the Admin console, navigate to Menu → Account→ Account settings → Legal and compliance and enable the Sharing options</p><p>The logs will then be accessible at the <strong>organization level</strong> in Cloud Logging: organizations/{OrganizationId}/logs/cloudaudit.googleapis.com%2Factivity</p><p>To get the audit log entries for your Google Cloud organization using the Logs Explorer in the Google Cloud console, do the following:</p><ol><li>Go to the <strong>Logs Explorer</strong> page: <a href="https://console.cloud.google.com/logs/query">Go to Logs Explorer</a></li><li>From the <strong>Project selector</strong> menu, select an organization.</li><li>From the <strong>Resource</strong> drop-down menu, select the Audited Resource type and then select the Google Workspace Admin Eventsservice</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*lARW7vn38eDEKdfeyKXezQ.png" /><figcaption>Cloud Logging capture to view Admin Logs/Events</figcaption></figure><p>In our scenario, we will use two types of logs. You can use the following queries to retrieve specific logs on the Cloud Logging query interface.</p><p><strong>CreateUser events query</strong></p><pre>resource.type=”audited_resource”<br>resource.labels.service=”admin.googleapis.com”<br>resource.labels.method=”google.admin.AdminService.createUser”</pre><p><strong>ChangeUserExternalId events query</strong></p><pre>resource.type=”audited_resource”<br>resource.labels.service=”admin.googleapis.com”<br>resource.labels.method=”google.admin.AdminService.changeUserExternalId”</pre><h4><strong>Transferring Admin logs to Pub/Sub</strong></h4><p>To simplify understanding and adhere to the principle of “separation of concerns,” we will create two separate processes for each type of event, but they will be based on the same pattern.</p><p>In Google Cloud, the recommended solution for reacting to log events is to use the <a href="https://cloud.google.com/eventarc/docs">EventArc</a> service, which allows you to trigger a process when an event arrives.</p><p>Unfortunately, the logs are received at the organization level (rather than a specific region), and as of now, EventArc does not have the ability to interface with a global level and requires that the source be in a GCP project. Therefore, it is necessary to create a transfer (<a href="https://cloud.google.com/logging/docs/export/configure_export_v2">Sink</a>) through a data source that is supported by EventArc.</p><p>To maintain this event mechanism, I suggest using <a href="https://cloud.google.com/pubsub">Pub/Sub</a> as the sink target. Therefore, the companion source code includes the definition of a Cloud Logging sink to Pub/Sub for each desired type of log, as well as the addition of the roles/pubsub.publisher role to the service account executing the sink.</p><p>Please note that Cloud Logging creates a service account for an organization when a log sink is created. The same service account is used for all sinks in one organization.</p><p>To obtain the sink’s writer identity (Service Account email), you could use</p><pre>gcloud logging sinks describe {YOUR_SINK_NAME}</pre><p>To limit the logs to only those that are useful for our scenario, it is recommended to set up restrictive filters:</p><p><strong>Inclusion Filter for user-creation-sink</strong></p><pre>protoPayload.serviceName=”admin.googleapis.com” AND <br>protoPayload.methodName=”google.admin.AdminService.createUser”</pre><p><strong>Inclusion Filter for externalid-modification-sink</strong></p><pre>protoPayload.serviceName=”admin.googleapis.com” AND <br>protoPayload.methodName=”google.admin.AdminService.changeUserExternalId” AND <br>protoPayload.metadata.event.parameter.value=~”LOGIN_ID:”</pre><p>This last line indicates that only changes to the login_id field are of interest to us.</p><blockquote>To go further on how to manage organization-level logs please read: <a href="https://cloud.google.com/logging/docs/export/aggregated_sinks">Collate and route organization-level logs to supported destinations</a></blockquote><p>After the last changes, the updated architecture will look like :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YNB2v88mXEMvsAG6clz-hg.png" /><figcaption>Updated architecture schema with dedicated steps</figcaption></figure><p>In the next article we will finish our journey by creating the workflows updating the alternate / alias email field in Cloud Identity.</p><p>For questions or feedback, feel free to reach out to me on Twitter @nicolashooge.</p><h3>References</h3><ul><li><a href="https://cloud.google.com/architecture/identity/federating-gcp-with-azure-ad-configuring-provisioning-and-single-sign-on">Azure AD user provisioning and single sign-on for Cloud Identity federation</a></li><li><a href="https://developers.google.com/admin-sdk/directory/reference/rest/v1/users">User resource structure</a></li><li><a href="https://developers.google.com/admin-sdk/reports/v1/appendix/activity/admin-user-settings">Admin Audit Activity Events for User resource</a></li><li><a href="https://support.google.com/a/answer/9320190">Share data with Google Cloud services — Google Workspace Admin Help</a></li><li><a href="https://cloud.google.com/logging/docs/audit/gsuite-audit-logging">Audit logs for Google Workspace</a></li><li><a href="https://cloud.google.com/logging/docs/export/aggregated_sinks">Collate and route organization-level logs to supported destinations</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d6043c299e4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Alias Synchronization from Azure Active Directory to Google Cloud Identity — Part 1]]></title>
            <link>https://medium.com/@nicolas.hooge/alias-synchronization-from-azure-active-directory-to-google-cloud-identity-part-1-7b9059e35405?source=rss-42db4e64b29------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b9059e35405</guid>
            <category><![CDATA[azure-active-directory]]></category>
            <category><![CDATA[google-cloud]]></category>
            <category><![CDATA[identity-management]]></category>
            <category><![CDATA[cloud-identity]]></category>
            <dc:creator><![CDATA[Nicolas Hooge]]></dc:creator>
            <pubDate>Tue, 17 Jan 2023 17:42:51 GMT</pubDate>
            <atom:updated>2023-01-17T17:49:39.220Z</atom:updated>
            <content:encoded><![CDATA[<h3>Alias Synchronization from Azure Active Directory to Google Cloud Identity — Part 1: Setting the Context</h3><h4>Why should you sync User Principal Name and email adresses to Cloud Identity ?</h4><h4>TD;LR</h4><p>This series of 3 articles will approach the identity sync challenge between AAD and Cloud Identity when a user has<strong> a non-matching User Principal Name</strong> (<strong>UPN) to its primary email address, </strong>and cover in depth a proposed solution to mitigate it:</p><ol><li>Setting the context (this article)</li><li><a href="https://medium.com/@nicolas.hooge/alias-synchronization-from-azure-active-directory-and-google-cloud-identity-part-2-ingestion-8d6043c299e4">Ingestion Process</a></li><li><a href="https://medium.com/@nicolas.hooge/alias-synchronization-from-azure-active-directory-and-google-cloud-identity-part-3-a8172e0d3e48">Synchronization workflows</a></li></ol><blockquote>Identity synchronization from Azure Active Directory (AAD) to Google Cloud Identity is generally straightforward, thanks to the dedicated <a href="https://azuremarketplace.microsoft.com/en-us/marketplace/apps/aad.googleapps">Google Cloud/G Suite Connector app from the Microsoft Azure marketplace</a>.</blockquote><blockquote>If you are interested in setting up this configuration, I recommend reading the following documentation:</blockquote><blockquote><a href="https://cloud.google.com/architecture/identity/federating-gcp-with-azure-active-directory">- Federating Google Cloud with Azure Active Directory</a></blockquote><blockquote>- <a href="https://cloud.google.com/architecture/identity/federating-gcp-with-azure-ad-configuring-provisioning-and-single-sign-on">Azure AD user provisioning and single sign-on</a></blockquote><h4><strong>Setting the context</strong></h4><p>Identity management is slightly different from Microsoft Azure Active Directory and Google Cloud Identity.</p><p><strong><em>Identity in Google Cloud</em></strong></p><p><em>from the </em><a href="https://cloud.google.com/architecture/identity/overview-google-authentication"><em>Overview of Google identity management</em></a><em> page:</em></p><blockquote>An identity is a name that uniquely identifies the person who is interacting with a Google service. Google uses email addresses for this purpose…</blockquote><blockquote>…The identity of a managed user account is defined by its primary email address.</blockquote><blockquote>Managed user accounts can have additional alias email addresses but these addresses are not considered identities and cannot be used for signing in.</blockquote><p><strong><em>Identity in Microsoft Azure Active Directory</em></strong></p><p>A User Principal Name (UPN) is a User ID which is unique and is needed when logging into any Office services. It is used to authenticate user accounts againstAzure AD.</p><p>Whereas Microsoft’s recommendation is to match UPN to the primary SMTP address. (ref <a href="https://learn.microsoft.com/en-us/windows-server/identity/ad-fs/operations/configuring-alternate-login-id#applications-and-user-experience-after-the-additional-configuration">Configuring Alternate Login ID</a>), some customers make the choice to offer their employees to have email and UPN.</p><p>The natural choice is to synchronize the AAD UPN to the Cloud Identity user principal email.</p><p>But there is a hidden caveat with this choice: <strong>the non-synced identity addresses (mail) can be used to create a consumer account</strong>.</p><blockquote><a href="https://cloud.google.com/architecture/identity/overview-google-authentication#consumer_account">Consumer accounts</a> are owned by the <strong>people</strong> who created them. Any email address (including corporate email addresses) can be used to create consumer account.</blockquote><blockquote>Your organization therefore <strong>has no control or rights</strong> over the configuration and lifecycle of these consumer accounts.</blockquote><p>One way to prevent new consumer account sign-ups, is to create a user account in Cloud Identity for all employees (cf <a href="https://cloud.google.com/architecture/identity/best-practices-for-federating#prevent_new_consumer_account_sign-ups">Prevent new consumer account sign-ups</a>).</p><p>However, if the AAD UPN does not match the AAD email address, you need to associate the non-synced identity addresses (mail) from AAD with the matching user account in Cloud Identity to block the creation of consumers accounts with this mail.</p><p>If you don’t do this, you may end up for one user account in Microsoft with:</p><ul><li><strong>A corporate account mapped to UPN and a consumer account using mail address.</strong></li><li><strong>Two separate managed user accounts/identities on Google Cloud Identity (one mapped to UPN, one mapped to mail).</strong></li></ul><h4><strong>Alternate email addresses to the rescue</strong></h4><p>Cloud Identity offers a solution to this issue through the use of alternate email addresses, also known as email aliases.</p><p>An email alias is a forwarding email address that an administrator adds to a user’s primary email address.</p><p>In the context of Cloud Identity (not Workspace), you can use an email alias to associate an email address with a user account created with a UPN.</p><p>One benefit of this association is that it <strong>will block the creation of a new user account with the email address</strong>, which helps to avoid creating multiple accounts for the same user.</p><p>Synchronizing the AAD UPN with the Cloud Identity (CI) primary email address and the AAD email address with a CI alternate email address can help ensure that a single user account in Microsoft Azure Active Directory is associated with a single identity in Google Cloud Identity. This avoid having to create multiple accounts for the same user and address potential issues with identity management.</p><h4><strong>Easy change, but wait, how ?</strong></h4><p>At first, one may think it is easy to configure the Google Cloud/G Suite Connector to synchronize the UPN and email in the same row.</p><p>However, this solution does not work:</p><ul><li>The connector does not allow for the mapping of alias or alternate emails to the target CI</li><li>Additionally, the user account CRUD API methods do not manage aliases; there are separate methods for this purpose</li></ul><p>Therefore, one needs to add a second step to our sync solution for alias CRUD events in order to achieve the desired result.</p><h4><strong>High Level technical solution</strong></h4><p>The proposed solution involves using logs generated by Cloud Identity when a user account is created or modified. It will respond to changes made to a specific user’s account in AAD and trigger the synchronization of aliases if necessary. Alias synchronization will be needed in the following cases:</p><ul><li>Initial creation of a user account (with UPN address), with an attribute containing the email address identity value</li><li>Change of the attribute containing the email address identity value during an AAD → CI synchronization.</li></ul><p>A simplified schema could be as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*WH-KJn6CmZJr5-IWQMb0eQ.png" /><figcaption>High-level technical solution</figcaption></figure><p>In the next two articles, I will describe, step by step, the implementation of this solution:</p><ul><li>Ingestion process</li><li>Synchronization workflows</li></ul><p>For questions or feedback, feel free to reach out to me on Twitter @nicolashooge.</p><h4>Additional Notes</h4><p>Please note that Google <a href="https://cloud.google.com/architecture/identity/best-practices-for-federating#ensure_that_identities_use_routable_email_addresses">recommends</a> to use a valid email address as the primary email for a Cloud Identity user.</p><p>Therefore, if you choose to sync the AAD UPN to the primary email, <strong>the Azure AD UPNs should be valid email addresses</strong> to ensure that any notification emails sent by Google Cloud are delivered to the user’s mailbox.</p><p>If the UPNs are not already valid email addresses, you may be able to configure alias email addresses on AAD to ensure that the user receives these emails.</p><p>You can find more information on this in the “Mapping users” section of the documentation on <a href="https://cloud.google.com/architecture/identity/federating-gcp-with-azure-active-directory#mapping_users">federating GCP with Azure Active Directory</a>.</p><p>For more information on adding email aliases for a user in Microsoft AAD/365, please see Microsoft’s documentation: <a href="https://learn.microsoft.com/en-us/microsoft-365/admin/email/add-another-email-alias-for-a-user?view=o365-worldwide">Add another email alias for a user</a></p><h3>References</h3><ul><li><a href="https://cloud.google.com/architecture/identity/overview-google-authentication">Overview of Google identity management</a></li><li><a href="https://cloud.google.com/architecture/identity/best-practices-for-federating">Best practices for federating Google Cloud with an external identity provider</a></li><li><a href="https://cloud.google.com/architecture/identity/best-practices-for-federating#prevent_new_consumer_account_sign-ups">Prevent new consumer account sign-ups</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b9059e35405" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>