To whom it may concern,Summary: As an organization, Boston Software subscribes to Jira and Confluence On-Demand and we're looking to automate the backup process. I am able to successfully intiate backups manually, using the Web gui... I'm trying to initiate backups progammatically and have hit a roadblock. The end-result is that I'm failing to authenticate properly. We found this knowledgebase article outlining the programmatic approach using a bash scrpt: https://confluence.atlassian.com/display/ONDEMANDKB/Automatic+backups+for+JIRA+OnDemand<br< a="">> Our workstations and servers are all Windows-based, so I tried executing the bash script using CygWin. The problem was I kept getting syntax errors. Note: I'm using Powershell 4.0 and using the bash script as a pattern to follow. Since I'm much more familiar w/ Powershell and the fact I've gotten much further using this approach - I'd like to stick w/ PowerShell.More info: The bash script I'm using is shown at this url: "https://confluence.atlassian.com/display/ONDEMANDKB/Automatic+backups+for+JIRA+OnDemand". Using this, I was able to craft a powershell command that successfully copied both Jira and Confluence .zip files locally. The successful commands: <# Jira #> Invoke-WebRequest -Method Get -Uri https://bostonsoftware.atlassian.net/webdav/backupmanager/JIRA-backup-20140814.zip -Credential $cred -OutFile "\\<SERVERNAME>\DevOps\AtlassianBackups\JIRA-backup-W-20140814.zip" -PassThru <# Confluence #> Invoke-WebRequest -Method Get -Uri https://bostonsoftware.atlassian.net/webdav/backupmanager/Confluence-backup-20140815.zip -Credential $cred -OutFile "\\<SERVERNAME>\DevOps\AtlassianBackups\Confluence-backup-W-20140815.zip" -PassThru As noted in the summary, I was able to use the 'Manage Backup' web page to 'Create Backup' with no problem - I'm attempting to automate this process. Note too that the credentials I'm using succeed when downloading the zip files The big question is: If the commands to download the .zip files succeeded using my normal login credentials, why does authentication fail on the commands to initiate the backup? The account I'm using is 'spalmucci' and I've also tried 'perkincr' with the same authentication error messages. My belief is my account and the perkincr account have not been given appropriate permissions to the 'runbackup' folder. At one point, my account (spalmucci) was able to Do the 'CreateBackup' thing, but could not navigate to the webdav folder. We needed to expressly give my account access to the webdav location. I'm wondering if something similar is necessary for the 'runbackup' location. If it turns out to be an account permissions thing...we'd like to use a general-purpose account, not one tied to a specific person. The best way to reach me would probably be via email: steve@bostonsoftware.com. I can be reached via phone at: 781-449-8585 xt 224 Many thanksEven more info: These are the commands I'm executing in a powershell environment that are fialing with the folowing error message. <# Jira #> Invoke-WebRequest -Method POST -Uri https://bostonsoftware.atlassian.net/rest/obm/1.0/runbackup-ContentType "application/json" -Credential $cred -Headers $dictionary <# Confluence #> Invoke-WebRequest -Method POST -Uri https://bostonsoftware.atlassian.net/wiki/rest/obm/1.0/runbackup-ContentType "application/json" -Credential $cred -Headers $dictionary The 'ContentType' argument is expressly provided in the commnad line and the 'Headers' argument: '$dictionary' is populated this way: $dictionary.Add("X-Atlassian-Token", "no-check") $dictionary.Add("X-Requested-With", "XMLHttpRequest") Error Message: === Invoke-WebRequest : 401Client must be authenticated to access this resource. At line:1 char:1 + Invoke-WebRequest -Method POST -Uri https://bostonsoftware.atlassian.net/rest/ob... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand ===
Just were fighting today with similar issues and at least was able to reproduce bash script on powershell, you can look at it here: https://bitbucket.org/mac2000/automatic-cloud-backup/raw/95882c7565812da93d2d459145214dbba9a7e078/backup.ps1
Hope that helps
Александр, добрый день. Вам удалось победить ошибку из сабжа с помошью шел или пшел скрипта?
It looks like you're new here. Sign in or register to get started.