Microsoft Teams for Jira has the same OAuth key and ID after migration

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

Problem

After restoring an XML backup into a new instance, the Microsoft Teams for Jira configuration page retains the OAuth key and Jira ID from the original instance.

Diagnosis

  • After creating a new application link, the Jira ID from the original instance is provided as part of the integration:

  • Uninstalling and reinstalling the app (or recreating the application link) does not resolve the problem.

Cause

The integration data is stored within the database and is not cleared when removing the app or application link.

Resolution

Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

To clean the Jira Server database from tables generated by the app, run the following scripts:

MS SQL Server
DECLARE @cmd varchar(4000)
2DECLARE cmds CURSOR FOR
3    SELECT 'drop table [' + Table_Name + ']'
4    FROM INFORMATION_SCHEMA.TABLES
5    WHERE Table_Name LIKE 'AO%APP_KEYS' OR Table_Name LIKE 'AO%TEAMS_ATLAS_USER'
6
7OPEN cmds
8WHILE 1 = 1
9    BEGIN
10        FETCH cmds INTO @cmd
11        IF @@fetch_status != 0 BREAK
12        EXEC(@cmd)
13    END
14CLOSE cmds;
15DEALLOCATE cmds
MySQL
SET @tables := NULL;
2SELECT GROUP_CONCAT(TABLE_NAME) INTO @tables FROM information_schema.tables
3WHERE TABLE_NAME LIKE BINARY 'AO%APP_KEYS' OR TABLE_NAME LIKE BINARY 'AO%TEAMS_ATLAS_USER';
4
5SET @tables = IFNULL(CONCAT('DROP TABLE ', @tables),'SELECT NULL;');
6PREPARE stmt1 FROM @tables;
7EXECUTE stmt1;
8DEALLOCATE PREPARE stmt1;
Oracle
BEGIN
2   FOR c IN ( SELECT table_name FROM user_tables WHERE table_name LIKE 'AO%TEAMS_ATLAS_USER' OR table_name LIKE 'AO%_APP_KEYS' )
3       LOOP
4           EXECUTE IMMEDIATE 'DROP TABLE ' || c.table_name;
5       END LOOP;
6END;
Postgres
DO
2$do$
3    DECLARE
4        _tbl text;
5    BEGIN
6        FOR _tbl  IN
7            SELECT quote_ident(table_name)
8            FROM   information_schema.tables
9            WHERE table_name LIKE 'AO%APP_KEYS' OR table_name LIKE 'AO%TEAMS_ATLAS_USER'
10            LOOP
11                EXECUTE        'DROP TABLE ' || _tbl;  – see below
12            END LOOP;
13    END
14$do$;



DescriptionMicrosoft Teams for Jira has same Jira ID after migration
ProductJira, Jira Core, Jira Software, Jira Service
Last modified on Mar 27, 2021

Was this helpful?

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