Unattended installation/configuration/Token Mgmt

  • 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”

}

}

Also the following does not work:

curl -X ‘POST’ \
‘https://10.0.22.24/api/cluster/v2/environments/66bf6127-7a37-40d9-b687-183cba58c020/tokenManagementToken’ \
-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)”
}
}

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.