cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unattended installation/configuration/Token Mgmt

xstreur
Participant
  • We need to do unattended installation/configuration of several Dynatrace instances (Cluster, Environment, oneAgents and activeGate).  After the installation
    of the Cluster Server, we get a API Token, which seems to be able to do things on a cluster level. We need a token here that also makes it possible to continue the install/configure on a Environment level. We seem to get stuck here.

    curl -X 'POST' \

  'https://10.0.22.24/api/cluster/v2/tokens' \

  -H 'accept: application/json; charset=utf-8' \

  -H 'Authorization: Api-Token <afterinstallation-Token> \

  -H 'Content-Type: application/json; charset=utf-8' \

  -d '{

  "expiresIn": {

    "unit": "DAYS",

    "value": 0

  },

  "name": "EnvTknMgmt",

 "scopes": [

    "EnviromentTokenManagement"

  ]

 

Results:

{

  "error": {

    "code": 400,

    "message": "Could not map JSON at 'scopes[0]' near line 8 column 5"

  }

}

 

2 REPLIES 2

xstreur
Participant

Also the following does not work:

curl -X 'POST' \
'https://10.0.22.24/api/cluster/v2/environments/66bf6127-7a37-40d9-b687-183cba58c020/tokenManagementT...' \
-H 'accept: application/json; charset=utf-8' \
-H 'Authorization: Api-Token dt0c01.NIUWRR7LOH7K4JZOX27FYYZZ.GMXDP65SGHVXOPEMDWZS2QGLDSPK6JBIPEBFGII75J7ZGMMYUG35KKBT3CN3RWMR' \
-H 'Content-Type: application/json; charset=utf-8' \
-d '{
"expiresIn": {
"unit": "SECONDS",
"value": 3600
},
"name": "Token Management"
}'

 

This comes with a 403:

{
"error": {
"code": 403,
"message": "Token is missing required scope. Use one of: EnvironmentTokenManagement (\"Token Management\" Token creation for existing environments)"
}
}

mark_bley
Dynatrace Champion
Dynatrace Champion

You have typo (EnviromentTokenManagement), it should be EnvironmentTokenManagement for the scope.

For the follow up you are using a Cluster token without the right scope.

Also even if it is just local cluster I would advise against posting tokens publicly.

https://docs.dynatrace.com/managed/shortlink/api-cluster-tokens-create-new#request-body-objects

 

Featured Posts