User accounts are not deleted after the cloud site data deletion

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

Summary

Learn how to remove user accounts from your cloud site after resetting and deleting all data from your cloud site.

Overview

When performing a migration from On-Premise to Atlassian cloud, an admin may need to perform multiple test runs and delete migrated data and/or users after each run.

The existing procedure to reset the cloud site does not include user's deletion.

The purpose of this guide is to provide the admin with an alternative method for removing users from the cloud as required.

Solution

Follow one of the methods below to remove users from the cloud site:

The two approaches require the creation of an API Token, and a CSV file with the user's account to be deleted.

Create the API Token

  1. Log in to API Tokens.

  2. Click Create API token.

  3. Type in a label for your token.

  4. Click Create.

  5. Click Copy to clipboard.

  6. Save the copied data in a safe place.

Generate the CSV file

Make sure your user account is removed from the user list, otherwise, you won't be able to access the site after the deletion.

  1. Choose your organization from admin.atlassian.com.
  2. Navigate to the Directory tab.
  3. Click ... > Export users.
  4. Select all the users to be deleted, and click Export users.

Format the CSV file

  1. Open the file in a spreadsheet app.

  2. Remove all the columns except for the User ID and User name columns.
  3. Change the User ID header name to accountId.

  4. Change the User Name header name to displayName.
  5. Save the file in CSV format.

How the file should look like
accountIddisplayName
1a22bb333c4d55d6ee777fffalice a
41546c6333b80062222bfbob b

Use the BulkOps App Free

This app requires an account creation with ELFAPP Technologies.

Install the App

  1. Navigate through Apps > Explore more Apps from your Jira Cloud instance.

  2. Search for BulkOps App Free by ELFAPP Technologies.

  3. Select the app.
  4. Click on Get app.

  5. Click on Get it now.

Set up your account

  1. Click on Sign Up.
  2. Fill in the fields for the account creation.
  3. Click Sign Up.
  4. Enter your credentials to log in.
  5. Activate the account with the link sent to your registered email.

Setup the API Token in BulkOps App Free

  1. Navigate to Apps > BulkOps App Free.
  2. Navigate to Settings.
  3. Click on Configurations.
  4. Click on Edit token.
  5. Paste the API Token created.
  6. Click on Save.

Delete the users

Review the CSV file before triggering this action as this operation will delete the users from all existing products on the Atlassian Cloud site.

  1. Navigate to Apps > BulkOps App Free.
  2. Click on Users > Bulk Delete Users.
  3. Click on Choose file and upload the formatted CSV file.
  4. Select the delimiter of your CSV file.
  5. Click on Delete Users in Bulk.

Use the Atlassian REST API

Use the Delete User endpoint of Atlassian's Developer API with your preferred language.

You must be a Site Administrator to reach this endpoint.

Call the REST API with a shell script and cURL

The below script is an example and it's not eligible for support.

Always test scripts in a staging environment first.

Review the CSV file before triggering this action as this operation will delete the users from all existing products on the Atlassian Cloud site.

Here's an example of a shell script to delete users in bulk:

#!/bin/bash

cat user_list.csv | while read line;

do
    displayName=`echo $line | cut -d ',' -f2`
    aaid=`echo $line | cut -d ',' -f1`
    echo "Deleting user $displayName - $aaid"     
    curl --request GET \
 		 --url 'https://your-domain.atlassian.net/rest/api/3/user?accountId=$aaid' \
  		 --user 'email@example.com:<api_token>' \
 		 --header 'Accept: application/json' 
done

Format the script

  1. Copy and paste the above shell script into a text editor.
  2. Replace the file name "user_list.csv" with the name of your CSV file on line three.
  3. Remove the column headers of the user_list.csv file.
  4. Replace "https://your-domain.atlassian.net" with your cloud site URL on line ten.
  5. Replace "email@example.com" with your email address on line 11.
  6. Replace "<api_token>" with your API Token on line 11.
  7. Save the script with the .sh format in the same folder where the CSV file is located.

Execute the script

  1. Open the terminal in the shell script folder.
  2. Give execution permissions to the script

    $ chmod +x script.sh
  3. Execute the script with

    $ ./script.sh

Last modified on Mar 18, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.