Click HERE to see how Saviynt Intelligence is transforming the industry. |
04/26/2024 08:24 AM
Hi Team,
Can we fetch all user accounts and orphan accounts for a particular application using a single query. If so, please provide. thanks in advance.
regards,
mahesh
Solved! Go to Solution.
04/26/2024 08:30 AM
Orphan Accounts
SELECT a.name 'Account Name', e.displayname 'Application Name', CASE WHEN a.status = 1 THEN 'Active' ELSE a.status END AS 'AccountStatus', e.endpointKey, a.accountclass, a.ACCOUNTTYPE FROM accounts a INNER JOIN endpoints e ON a.endpointKey = e.endpointKey AND a.status IN (1 , 'Active', 'Manually Provisioned') LEFT JOIN user_accounts ua ON ua.accountkey = a.accountkey WHERE ua.USERKEY IS NULL;
User Accounts
SELECT a.name 'Account Name', e.displayname 'Application Name', CASE WHEN a.status = 1 THEN 'Active' ELSE a.status END AS 'AccountStatus', e.endpointKey, a.accountclass, a.ACCOUNTTYPE FROM accounts a INNER JOIN endpoints e ON a.endpointKey = e.endpointKey AND a.status IN (1 , 'Active', 'Manually Provisioned') LEFT JOIN user_accounts ua ON ua.accountkey = a.accountkey WHERE ua.USERKEY IS NOT NULL;
04/26/2024 08:48 AM
Can you try this?
If Username is null then its orphan and not associated with any identity.
Thanks,
Devang Gandhi
If this reply answered your question, please Accept As Solution and give Kudos to help others who may have a similar problem.
04/29/2024 03:09 AM
Hi Gandhi,
Thanks for the above query and it is working fine. please also share the query if we want to extract entitlement values for both user & orphan accounts
regards,
mahesh
04/29/2024 05:47 AM