iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
🦔

Centralizing Datadog Access Management with Okta

に公開

Introduction

This article explains how to centrally manage access to Datadog using Okta Single Sign-On (SSO).

https://www.okta.com/jp/
https://www.datadoghq.com/ja/

Objective

Implementing a mechanism to assign specific Datadog roles to users belonging to specific Okta groups.

In this article, I will explain the steps to automatically assign the Datadog SRE role to users belonging to the Okta SRE group via Single Sign-On.

Prerequisites

It is assumed that you have administrator privileges for both Datadog and Okta.
It is assumed that an SRE group has been created in Okta beforehand and users have already been assigned to it.
Datadog is using the ap1 server region.

Steps

Check SAML settings on the Datadog side

Enable the SAML Configure settings from the following screen.
https://ap1.datadoghq.com/organization-settings/login-methods

You will use the Datadog Service Provider details in a later step.

Create a SAML application in Okta

From the Okta admin screen, select Applications / Applications and choose Create App Integration.

Select SAML 2.0.

Enter the App name and select Next.

Fill in the following settings.
Single sign-on URL: Datadog's SAML Assertion Consumer Service URL
Audience URI (SP Entity ID): Datadog's SAML Service Provider Entity ID
Name ID format: EmailAddress
For Attribute Statements, set NameFormat / sn / givenName according to the following documentation.

https://docs.datadoghq.com/account_management/saml/okta/

Also, to sync Okta group information with Datadog, in the Group Attribute Statements, set memberOf with the Unspecified format and set the Filter to Matches regex with .*.
This ensures that information for all groups the Okta user belongs to is passed to Datadog as SAML authentication information.

By checking Preview the SAML Assertion at the bottom of the screen, you can verify the SAML information that will actually be used.
You can confirm that the information for the Okta group SRE is also being propagated.

<?xml version="1.0" encoding="UTF-8"?>
<saml2:Assertion ID="***" IssueInstant="2023-12-11T00:51:31.152Z" Version="2.0"
    xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
    <saml2:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://www.okta.com/***</saml2:Issuer>
    <saml2:Subject>
        <saml2:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">***</saml2:NameID>
        <saml2:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
            <saml2:SubjectConfirmationData NotOnOrAfter="2023-12-11T00:56:31.152Z" Recipient="***"/>
        </saml2:SubjectConfirmation>
    </saml2:Subject>
    <saml2:Conditions NotBefore="2023-12-11T00:46:31.152Z" NotOnOrAfter="2023-12-11T00:56:31.152Z">
        <saml2:AudienceRestriction>
            <saml2:Audience>https://ap1.datadoghq.com/account/saml/metadata.xml</saml2:Audience>
        </saml2:AudienceRestriction>
    </saml2:Conditions>
    <saml2:AuthnStatement AuthnInstant="2023-12-11T00:51:15.640Z" SessionIndex="***">
        <saml2:AuthnContext>
            <saml2:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml2:AuthnContextClassRef>
        </saml2:AuthnContext>
    </saml2:AuthnStatement>
    <saml2:AttributeStatement>
        <saml2:Attribute Name="NameFormat" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
            <saml2:AttributeValue
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">urn:oasis:names:tc:SAML:2.0:attrname-format:uri
            </saml2:AttributeValue>
        </saml2:Attribute>
        <saml2:Attribute Name="sn" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
            <saml2:AttributeValue
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">***
            </saml2:AttributeValue>
        </saml2:Attribute>
        <saml2:Attribute Name="givenName" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
            <saml2:AttributeValue
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">***
            </saml2:AttributeValue>
        </saml2:Attribute>
        <saml2:Attribute Name="memberOf" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
            <saml2:AttributeValue
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">Everyone
            </saml2:AttributeValue>
            <saml2:AttributeValue
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">SRE
            </saml2:AttributeValue>
        </saml2:Attribute>
    </saml2:AttributeStatement>
</saml2:Assertion>

Specify the following settings for Feedback.

Click Finish with these settings.

From the Assignments tab on the details screen of the created application, link the SRE group created in the first step via Assign to Groups.

At this stage, users in the SRE group will see the application in their My Apps.

Add Okta settings to Datadog

From the Sign On tab of the application details screen in Okta, copy the Metadata URL listed under Metadata details.

Access the Metadata URL and save the content as a .xml file.

Upload the file in the Datadog SAML Configure section and click the Upload and Enable button.

It is successful if Valid IdP metadata installed. is displayed.

Next, check the box for Identity Provider (IdP) Initiated Login under Additional Features.

Click the Save Changes button again. When you return to the details screen, an address with an /id/xxxx suffix will have been added to the second line of the Assertion Consumer Service URL in the Datadog Service Provider details.
Copy this address.

Update Okta settings

Return to the Okta application details screen and Edit the SAML Settings in the General tab.

Proceed to the Configure SAML tab and change the Single sign-on URL to the address you just copied.

Enable automatic user provisioning in Datadog

With the current settings, new users would still need to be created manually in Datadog each time they log in.

If a user has not been created, an error screen like the one below will be displayed:

To address this, we will add a setting to automatically create a Datadog user when a new user logs in.

In the Just-in-Time Provisioning section under Additional Features in Datadog's SAML Configure, add the domains for which you want to allow automatic user creation.

In the configuration below, when a user from the tetsuya28.com domain logs in, a user with Datadog Read Only Role permissions will be automatically created.

*Note: You can also use the same procedure to map to the newly implemented Teams in Datadog.

Link Okta groups to Datadog roles on the following page:
https://ap1.datadoghq.com/organization-settings/mappings/role-mappings

First, enable the Role Mappings feature.

Next, use New Mapping to link the SRE group to the pre-created Datadog SRE role, using memberOf (specified in Okta's Group Attribute Statements) as the key.

Verification

Once the above settings are complete, you can access Datadog via SAML by clicking the added application from the Okta application dashboard.

Discussion