Esri / arcgis-powershell-dsc

This repository contains scripts, code and samples for automating the install and configuration of ArcGIS (Enterprise and Desktop) using Microsoft Windows PowerShell DSC (Desired State Configuration).
Apache License 2.0
114 stars 62 forks source link

Invalid Token on DataStore Configuration with Server #568

Closed ae-daenchrisarmada closed 1 week ago

ae-daenchrisarmada commented 1 week ago

Community Note

Module Version

Affected Resource(s)

Configuration Files

{
  "AllNodes": [
    {
      "NodeName": "EC2AMAZ-UPRFRTV",
      "Role": [
        "Server",
        "WebAdaptor",
        "DataStore"
      ],
      "WebAdaptorConfig": [
        {
          "Role": "Server",
          "ServerContext": "server"
        }
      ],
      "DataStoreTypes": "Relational"
    }
  ],
  "ConfigData": {
    "Version": "11.1",
    "ServerRole": "GeneralPurposeServer",
    "ServerContext": "server",
    "Credentials": {
      "ServiceAccount": {
        "Password": "coigisProd2024",
        "UserName": "admin",
        "IsDomainAccount": false,
        "IsMSAAccount": false
      }
    },
    "Server": {
      "LicenseFilePath": "C:\\s3\\ArcGISGISServerAdvanced_ArcGISServer_1464359.prvc",
      "Installer": {
        "Path": "C:\\s3\\ArcGIS_Server_Windows_111_185208.exe",
        "InstallDir": "C:\\ArcGIS\\Server",
        "InstallDirPython": "C:\\Python3",
        "EnableArcMapRuntime": true,
        "EnableDotnetSupport": true
      },
      "ServerDirectoriesRootLocation": "C:\\arcgisserver\\directories",
      "ConfigStoreLocation": "C:\\arcgisserver\\config-store",
      "PrimarySiteAdmin": {
        "UserName": "SiteAdmin",
        "Password": "Password456!"
      }
    },
    "WebAdaptor": {
      "AdminAccessEnabled": true,
      "Installer": {
        "Path": "C:\\s3\\ArcGIS_Web_Adaptor_for_Microsoft_IIS_111_185222.exe",
        "DotnetHostingBundlePath": "C:\\s3\\dotnet-hosting-6.0.32-win.exe",
        "WebDeployPath": "C:\\s3\\WebDeploy_amd64_en-US.msi",
        "IsSelfExtracting": true
      }
    },
    "DataStore": {
      "ContentDirectoryLocation": "C:\\arcgisdatastore",
      "EnableFailoverOnPrimaryStop": false,
      "EnablePointInTimeRecovery": false,
      "Installer": {
        "Path": "C:\\s3\\ArcGIS_DataStore_Windows_111_185221.exe",
        "IsSelfExtracting": true,
        "InstallDir": "C:\\ArcGIS\\DataStore"
      }
    }
  }
}

Expected Behavior

Successful Configuration of DataStore with Added Relational Type Database from the Server Manager

Actual Behavior

Invalid Token. Error

10/11/2024 3:04:58 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] [WARNING]:- ERROR: failed. Attempt to configure data store failed.
Caused by: Machine 'https://EC2AMAZ-UPRFRTV:2443/arcgis/datastoreadmin/' returned an error. 'Invalid Token.'
10/11/2024 3:04:58 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] Attempt [4] Failed. Retrying after 45 seconds
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] Register DataStore Attempt 5
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] Checking if datastore is registered
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] Waiting for Url https://localhost:2443/arcgis/datastoreadmin/configure?f=json
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] Url is OK
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] POST https://localhost:2443/arcgis/datastoreadmin/configure with 330-byte payload
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] received -1-byte response of content type application/json;charset=UTF-8
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] Response:- {"currentVersion":"11.1.0","tileCache":{"isinstalled":false},"spatioTemporal":{"isinstalled":false
},"graphStore":{"isinstalled":false},"objectStore":{"isinstalled":false},"relational":{"configureRole":"STANDBY"},"defaultContentDirectory":"C:\\arcgisdatastore"}
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] Checking if Relational Datastore is registered
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] POST https://ec2amaz-uprfrtv.local:6443/arcgis/admin/data/findItems with 132-byte payload
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] received 1961-byte response of content type application/json;charset=UTF-8
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] Response:- {"items":[{"path":"/enterpriseDatabases/AGSDataStore_ds_41gkbgdk","type":"egdb","id":"b72096e0-26a
b-49ca-aa26-3704ca06bf1e","provider":"ArcGIS Data Store","totalRefCount":0,"info":{"isManaged":true,"systemManaged":true,"isManagedData":true,"factory":"egdb","category":"database","implementation":"PostgreSQL","provider":"
ArcGIS Data Store","purposes":["feature","webhooks"],"dataStoreConnectionType":"serverOnly","sslEnabled":true,"JDBCConnection":{"name":"PostgreSQLonEC2AMAZ-UPRFRTV","factory":"org.apache.tomcat.jdbc.pool.DataSourceFactory",
"driverClassName":"org.postgresql.Driver","url":"jdbc:postgresql://EC2AMAZ-UPRFRTV:9876/db_xn71u","username":"hsu_e45zn","password":"{crypt}I5PX6b5vTc9T/2xPdfG/NQ==","initialSize":0,"initSQL":"SET TIME ZONE 'UTC'","minIdle"
:0,"timeBetweenEvictionRunsMillis":10000,"minEvictableIdleTimeMillis":20000,"testOnBorrow":true,"validationQuery":"SELECT 1"},"machines":[{"name":"EC2AMAZ-UPRFRTV","adminURL":"https://EC2AMAZ-UPRFRTV:2443/arcgis/datastoread
min/","dbPort":9876,"platform":"Windows","role":"PRIMARY"}],"connectionString":"ENCRYPTED_PASSWORD_UTF8=00022e68686e2b744a335439567a486a6f757a6743497a2b384d334f47536a34464662333559793065716c4a7a31493d2a00;ENCRYPTED_PASSWORD
=00022e684d636b494737425672786f505a5778663153576f58577646746a33774f4968505839626c4e702f623446343d2a00;SERVER=EC2AMAZ-UPRFRTV;INSTANCE=sde:postgresql:EC2AMAZ-UPRFRTV,9876;DBCLIENT=postgresql;DB_CONNECTION_PROPERTIES=EC2AMAZ-
UPRFRTV,9876;DATABASE=db_xn71u;USER=hsu_e45zn;VERSION=sde.DEFAULT;AUTHENTICATION_MODE=DBMS","connectionStringHA":"ENCRYPTED_PASSWORD_UTF8=00022e68736f6b634a725478796276344f4f67342f70686357493964745a666932637353772b434d50683
0645659383d2a00;ENCRYPTED_PASSWORD=00022e687249474164774d577749505545654464315863493853757276756a4c46686a62423650644f49386d654f6f3d2a00;SERVER=ds_41gkbgdk;INSTANCE=\"sde:postgresql:DSID=ds_41gkbgdk\";DBCLIENT=postgresql;DAT
ABASE=db_xn71u;USER=hsu_e45zn;VERSION=sde.DEFAULT;AUTHENTICATION_MODE=DBMS"}}]}
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] POST https://ec2amaz-uprfrtv.local:6443/arcgis/admin/data/items/enterpriseDatabases/AGSDataStore_ds_41gkbgdk/
machines with 121-byte payload
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] received 158-byte response of content type application/json;charset=UTF-8
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] Response:- {"machines":[{"name":"EC2AMAZ-UPRFRTV","adminURL":"https://EC2AMAZ-UPRFRTV:2443/arcgis/datastoread
min/","dbPort":9876,"platform":"Windows","role":"PRIMARY"}]}
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] The machine with FQDN 'EC2AMAZ-UPRFRTV.local' does NOT participates in a registered 'Relational' data store
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] Register DataStore on Machine EC2AMAZ-UPRFRTV.local
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] POST https://localhost:2443/arcgis/datastoreadmin/configure with 227-byte payload
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] received -1-byte response of content type application/json;charset=UTF-8
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] Response:- {"error":{"code":500,"message":"Attempt to configure data store failed.\nCaused by: Machine 'https
://EC2AMAZ-UPRFRTV:2443/arcgis/datastoreadmin/' returned an error. 'Invalid Token.'","details":null}}
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] Run time was 0 hours, 0 minutes, 0 seconds
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] Error Response - {
    "code":  500,
    "message":  "Attempt to configure data store failed.\nCaused by: Machine \u0027https://EC2AMAZ-UPRFRTV:2443/arcgis/datastoreadmin/\u0027 returned an error. \u0027Invalid Token.\u0027",
    "details":  null
}
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]:                            [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV] [WARNING]:- ERROR: failed. Attempt to configure data store failed.
Caused by: Machine 'https://EC2AMAZ-UPRFRTV:2443/arcgis/datastoreadmin/' returned an error. 'Invalid Token.'
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]: LCM:  [ End    Set      ]  [[ArcGIS_DataStore]DataStoreEC2AMAZ-UPRFRTV]  in 183.6050 seconds.
10/11/2024 3:05:43 AM: [EC2AMAZ-UPRFRTV]: LCM:  [ End    Set      ]
10/11/2024 3:05:43 AM: Operation 'Invoke CimMethod' complete.
Trace-DSCJob : 10/11/2024 3:05:43 AM: PowerShell DSC resource ArcGIS_DataStore  failed to execute Set-TargetResource functionality with error message: Register Data Store Failed after multiple attempts. @{code=500;
message=Attempt to configure data store failed.
Caused by: Machine 'https://EC2AMAZ-UPRFRTV:2443/arcgis/datastoreadmin/' returned an error. 'Invalid Token.'; details=}
At C:\Program Files\WindowsPowerShell\Modules\ArcGIS\4.3.0\ArcGIS.psm1:261 char:5
+     Trace-DSCJob -Job $Job -JobName $ConfigurationName -DebugMode $De ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Trace-DSCJob

Trace-DSCJob : 10/11/2024 3:05:43 AM: The SendConfigurationApply function did not succeed.
At C:\Program Files\WindowsPowerShell\Modules\ArcGIS\4.3.0\ArcGIS.psm1:261 char:5
+     Trace-DSCJob -Job $Job -JobName $ConfigurationName -DebugMode $De ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Trace-DSCJob

Steps to Reproduce

Run Invoke-ArcGISConfiguration -ConfigurationParametersFile $jsonFilePath -Mode InstallLicenseConfigure -MappedDriveOverrideFlag $True -DebugSwitch

Important Factoids

References

cameronkroeker commented 1 week ago

Hi @ae-daenchrisarmada,

Something doesn't seem right. In the config json there is only one node specified but in the logs its showing an existing relational ds as already registered (as primary) and its attempting to register a new datastore to the existing site as a standby. Was this deployment partially manually setup previously and now trying to register a data store using the module?

Thanks, Cameron K.

ae-daenchrisarmada commented 1 week ago

It seems to be working now. Weird..