<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Service User for secure API automation in Dynatrace tips</title>
    <link>https://community.dynatrace.com/t5/Dynatrace-tips/Service-User-for-secure-API-automation/m-p/277471#M1645</link>
    <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Service users in Dynatrace are special types of users created to enable automated access to the Dynatrace API. Unlike regular users, service users are not associated with a person but are used by systems or applications (e.g., CI/CD tools or monitoring scripts) that need to interact with Dynatrace programmatically. These users are assigned permissions through groups and policies, and they authenticate using OAuth client credentials (client ID and secret). This setup allows secure, automated, and controlled access to Dynatrace resources.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Follow this steps to generate a user for secure automations:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;Create a service user. Through the account management page (a service user needs a name, e.g., what function they are supposed to perform).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mark_bley_0-1747646756497.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/28063i362C29E509843E62/image-size/large?v=v2&amp;amp;px=999" role="button" title="mark_bley_0-1747646756497.png" alt="mark_bley_0-1747646756497.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;After creating the service user, assign the service user to a group&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-&amp;gt; Edit service user and, as usual, assign a group that contains the necessary permissions as if it were a normal user.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mark_bley_1-1747646811382.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/28064i42D42E2465F2597A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mark_bley_1-1747646811382.png" alt="mark_bley_1-1747646811382.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(Save the service user email to clipboard)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mark_bley_2-1747646839843.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/28065i70E6182152F10329/image-size/large?v=v2&amp;amp;px=999" role="button" title="mark_bley_2-1747646839843.png" alt="mark_bley_2-1747646839843.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Create an OAuth client using the service user that we will use for environment token creation and automation&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mark_bley_3-1747646921340.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/28066i83C1AD0AD220C0B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="mark_bley_3-1747646921340.png" alt="mark_bley_3-1747646921340.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Enter the service user email as the subject user email.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mark_bley_4-1747647010247.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/28067iBE1DF26832CDBD99/image-size/large?v=v2&amp;amp;px=999" role="button" title="mark_bley_4-1747647010247.png" alt="mark_bley_4-1747647010247.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Assign at least following permissions to the OAuth client: &lt;SPAN&gt;environment-api:api-tokens:write&lt;/SPAN&gt;&amp;nbsp;,&amp;nbsp;&lt;SPAN&gt;environment-api:api-tokens:read&lt;/SPAN&gt;&amp;nbsp;,&amp;nbsp;environment-api:deployment:download&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl --location 'https://sso.dynatrace.com/sso/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=dt0s02.NEHYTCAK' \
--data-urlencode 'client_secret=dt0s02.NEHYTCAK.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--data-urlencode 'resource=urn:dtaccount:456bce5cxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--data-urlencode 'scope=environment-api:api-tokens:write environment-api:api-tokens:read'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Then generate the Environment API token using the bearer&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl --location 'https://&amp;lt;tenant_app_url&amp;gt;/platform/classic/environment-api/v2/apiTokens' \
--header 'Authorization: Bearer xxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
  "expirationDate": "now+14d",
  "name": "tokenName",
  "personalAccessToken": false,
  "scopes": [
    "metrics.read"
  ]
}'&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mark_bley_5-1747647203484.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/28068iE701F5CD7D60884E/image-size/large?v=v2&amp;amp;px=999" role="button" title="mark_bley_5-1747647203484.png" alt="mark_bley_5-1747647203484.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 May 2025 08:14:15 GMT</pubDate>
    <dc:creator>mark_bley</dc:creator>
    <dc:date>2025-05-20T08:14:15Z</dc:date>
    <item>
      <title>Service User for secure API automation</title>
      <link>https://community.dynatrace.com/t5/Dynatrace-tips/Service-User-for-secure-API-automation/m-p/277471#M1645</link>
      <description>&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;Service users in Dynatrace are special types of users created to enable automated access to the Dynatrace API. Unlike regular users, service users are not associated with a person but are used by systems or applications (e.g., CI/CD tools or monitoring scripts) that need to interact with Dynatrace programmatically. These users are assigned permissions through groups and policies, and they authenticate using OAuth client credentials (client ID and secret). This setup allows secure, automated, and controlled access to Dynatrace resources.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Follow this steps to generate a user for secure automations:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;SPAN&gt;Create a service user. Through the account management page (a service user needs a name, e.g., what function they are supposed to perform).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mark_bley_0-1747646756497.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/28063i362C29E509843E62/image-size/large?v=v2&amp;amp;px=999" role="button" title="mark_bley_0-1747646756497.png" alt="mark_bley_0-1747646756497.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;After creating the service user, assign the service user to a group&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;-&amp;gt; Edit service user and, as usual, assign a group that contains the necessary permissions as if it were a normal user.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mark_bley_1-1747646811382.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/28064i42D42E2465F2597A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mark_bley_1-1747646811382.png" alt="mark_bley_1-1747646811382.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(Save the service user email to clipboard)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mark_bley_2-1747646839843.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/28065i70E6182152F10329/image-size/large?v=v2&amp;amp;px=999" role="button" title="mark_bley_2-1747646839843.png" alt="mark_bley_2-1747646839843.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Create an OAuth client using the service user that we will use for environment token creation and automation&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mark_bley_3-1747646921340.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/28066i83C1AD0AD220C0B5/image-size/large?v=v2&amp;amp;px=999" role="button" title="mark_bley_3-1747646921340.png" alt="mark_bley_3-1747646921340.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Enter the service user email as the subject user email.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mark_bley_4-1747647010247.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/28067iBE1DF26832CDBD99/image-size/large?v=v2&amp;amp;px=999" role="button" title="mark_bley_4-1747647010247.png" alt="mark_bley_4-1747647010247.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Assign at least following permissions to the OAuth client: &lt;SPAN&gt;environment-api:api-tokens:write&lt;/SPAN&gt;&amp;nbsp;,&amp;nbsp;&lt;SPAN&gt;environment-api:api-tokens:read&lt;/SPAN&gt;&amp;nbsp;,&amp;nbsp;environment-api:deployment:download&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl --location 'https://sso.dynatrace.com/sso/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=dt0s02.NEHYTCAK' \
--data-urlencode 'client_secret=dt0s02.NEHYTCAK.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--data-urlencode 'resource=urn:dtaccount:456bce5cxxxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--data-urlencode 'scope=environment-api:api-tokens:write environment-api:api-tokens:read'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Then generate the Environment API token using the bearer&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;curl --location 'https://&amp;lt;tenant_app_url&amp;gt;/platform/classic/environment-api/v2/apiTokens' \
--header 'Authorization: Bearer xxxxxxxx' \
--header 'Content-Type: application/json' \
--data '{
  "expirationDate": "now+14d",
  "name": "tokenName",
  "personalAccessToken": false,
  "scopes": [
    "metrics.read"
  ]
}'&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mark_bley_5-1747647203484.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/28068iE701F5CD7D60884E/image-size/large?v=v2&amp;amp;px=999" role="button" title="mark_bley_5-1747647203484.png" alt="mark_bley_5-1747647203484.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 May 2025 08:14:15 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Dynatrace-tips/Service-User-for-secure-API-automation/m-p/277471#M1645</guid>
      <dc:creator>mark_bley</dc:creator>
      <dc:date>2025-05-20T08:14:15Z</dc:date>
    </item>
  </channel>
</rss>

