Automate Jira/Confluence Cloud backups
Summary
This article provides a step-by-step guide for automating backups of Jira and Confluence Cloud through the use of global automation rules.
Background
Atlassian-generated backups are meant for Disaster recovery. We do not use these backups to reverse customer-initiated destructive changes, such as fields overwritten by scripts or deleted issues, projects, or sites. To prevent data loss, we recommend that you regularly create your own backups. These backups are essential for recovering data in the event of information loss due to user actions.
To maintain consistent backups for Jira and Confluence, it is recommended to implement a mechanism that automates or schedules backups at regular intervals, such as weekly, bi-weekly, or monthly.
- At present, we don't offer a feature to automate backups for Jira and Confluence. However, the feature request CLOUD-6498 is already being considered.
With the introduction of the new backup and restore solution (available exclusively for Enterprise customers), automating backups for Jira and Confluence is now possible through Jira cloud automation.
Environment
This is applicable to Enterprise cloud customers.
Follow steps to automate backups
Create a backup policy for your product
Follow create a backup policy for detailed instructions.
Once the backup policy is created, click on view details, which will show the details of the policy created. Note the policy ID in the HTTP request. It would be like below
https://admin.atlassian.com/o/<org id>/data-management/backup-and-restore/policy/policy-details/<policy id>/?pageSize=20&start=0&tab=backups
Create the Jira Automation rule
Navigate to [Settings > System > Global automation] For example, Go to https://<cloud instance name>.atlassian.net/jira/settings/automation to add a rule.
Create a new automation rule.
Add a Scheduled component and set the frequency of your backup. You can set the frequency of your choice. Remember, as mentioned in backup and restore limitations “You can run one backup once every 7 days”
Send web request POST API call
Add Send web request POST API call. We need to pass the below parameter values.
Parameter Value Web request URL https://api.atlassian.com/public/backup-management/v1/orgs/<org_id>/backups
replace ord_id with your organization IDHTTP Method POST Web request body Custom Body { "policyId": "xxxx-0f03-45e6-9c48-1e181b0a28ae",
"cloudId": "xxxx-2637-4d79-a9e0-xxxx"
}- Policy ID is the ID which we copied in step 2
- Cloud ID can be find using https://my-site-name.atlassian.net/_edge/tenant_info where site id will be the cloud ID .
Refer Refer how to find cloud site id
Headers Accept > application/json
Authorization : Basic <encoded64 API token>
To pass authorization token :
Issue an API token of the site-admins account at https://id.atlassian.com/manage/api-tokens
Encode your credentials “<EMAIL>:<API_TOKEN>” with base64 as (1-2) Example below. Or go with any online tool like Encode/Decode Make sure not to include a line break at the end.
You can refer below command to generate encoded 64 token$ echo -n "site-admin@example.com:123e4567-e89b-12d3-a456-426614174000" | base64 Output :c2l0ZS1hZG1pbkBleGFtcGxlLmNvbToxMjNlNDU2Ny1lODliLTEyZDMtYTQ1Ni00MjY2MTQxNzQwMDA=
Create an Email Notification for backup report
- Add an Email component to send out Notifications for backup report.
- We are sharing reference content for Email body. You can refer “Send web request component” > How do I access web request response values in subsequent rule actions” section for more details.
> Status: {{webResponse.status}} > Category: {{webResponse.statusCategory}} > Headers: {{webResponse.headers}} > Type: {{webResponse.headers.Content-Type}} > Body: {{webResponse.body}} > Body Name: {{webResponse.body.name}}
- We are sharing reference content for Email body. You can refer “Send web request component” > How do I access web request response values in subsequent rule actions” section for more details.
- Save the rule. You can test the rule using “Run rule” option available at top right corner. You can check "audit rule" section for all executions of this rule.
References
- Automation for Jira - Send web request using Jira REST API
- How to generate authorization token https://developer.atlassian.com/cloud/backup-management-apis/guides/authorization/
- Useful API calls for Backup and restore
https://developer.atlassian.com/cloud/backup-management-apis/
https://developer.stg.internal.atlassian.com/cloud/backup-management-apis/rest/api-group-public/#api-public-backup-management-v1-orgs-orgid-exports-post