Backup via REST API authentication failing

I have a PowerShell script which calls TeamCity's REST API to make a backup.

This script worked was working on v7.1 but when I upgraded to 8.0.5 the script stopped working.

I have attached the PS script file: TeamCityRestBackup.ps1.

This fails with the message "The Remote server returned an error: (500) Internal Server Error".

From teamcity-server.log:

[2013-12-17 17:53:12,419]  ERROR -   jetbrains.buildServer.SERVER - Error java.lang.IllegalArgumentException: Argument for @NotNull parameter 'key' of jetbrains/buildServer/controllers/interceptors/auth/impl/WaffleBasedNTLMHttpAuthenticationStrategy.getValue must not be null while processing request: POST '/runtimeError.jsp?addTimestamp=True&includeConfigs=True&includeDatabase=True&includePersonalChanges=True&includeBuildLogs=True&fileName=TeamCity_Backup_', from client 0:0:0:0:0:0:0:1:61236, no auth/user

java.lang.IllegalArgumentException: Argument for @NotNull parameter 'key' of jetbrains/buildServer/controllers/interceptors/auth/impl/WaffleBasedNTLMHttpAuthenticationStrategy.getValue must not be null

 at jetbrains.buildServer.controllers.interceptors.auth.impl.WaffleBasedNTLMHttpAuthenticationStrategy.getValue(WaffleBasedNTLMHttpAuthenticationStrategy.java)

 at jetbrains.buildServer.controllers.interceptors.auth.impl.WaffleBasedNTLMHttpAuthenticationStrategy.doProcessAuthenticationRequest(WaffleBasedNTLMHttpAuthenticationStrategy.java:57)

From teamcity-auth.log:

[2013-12-17 19:16:44,377]  DEBUG [UA: null ; http-bio-80-exec-28] - Processing request with no authorization header: POST '/app/rest/server/backup?addTimestamp=True&includeConfigs=True&includeDatabase=True&includePersonalChanges=True&includeBuildLogs=True&fileName=TeamCity_Backup_', from client 0:0:0:0:0:0:0:1:55772, no auth/user

[2013-12-17 19:16:44,377]  DEBUG [UA: null ; http-bio-80-exec-28] - No scheme was matched

[2013-12-17 19:16:44,377]  DEBUG [UA: null ; http-bio-80-exec-28] - Processing unauthenticated request

[2013-12-17 19:16:44,377]  DEBUG [UA: null ; http-bio-80-exec-28] - Responding with 401 HTTP status with message "Unauthorized", sending header in response: WWW-Authenticate: Basic realm="TeamCity", Basic realm="TeamCity", NTLM

[2013-12-17 19:16:44,377]  DEBUG [UA: null ; http-bio-80-exec-26] - Processing request with authorization header: "NTLM": POST '/app/rest/server/backup?addTimestamp=True&includeConfigs=True&includeDatabase=True&includePersonalChanges=True&includeBuildLogs=True&fileName=TeamCity_Backup_', from client 0:0:0:0:0:0:0:1:55773, no auth/user, authorization data: "#########"

I have tested the credentials the script runs under in a web browser(ntlm prompt) and the TC site loads without issue.

Any ideas what I've done wrong?



Attachment(s):
TeamCityRestBackup.ps1.zip

Please sign in to leave a comment.