wilkux
wilkux

Reputation: 125

Snowflake SCIM access token notfication

I'm integrating Snowflake with Azure AD but the Snowflake token expires in 6 months. I want to create a notification. I'm thinking to create other table that will saving the data of execution of query - so near 6 month I will send the notification. Can you help me with that?

https://learn.microsoft.com/en-us/azure/active-directory/saas-apps/snowflake-provisioning-tutorial

Upvotes: 0

Views: 1053

Answers (1)

Srinath Menon
Srinath Menon

Reputation: 1642

You may run the following command to get the start time of the token generation:

select START_TIME, QUERY_TEXT from account_usage.query_history where QUERY_TEXT like '%select system$generate_scim_access_token%' order by start_time desc;

Then store this in new table column and use it for notification purposes.

For eg:

 /* new table for storing the token start time*/                          
        create or replace table scimtoken(start_date timestamp);
    
 /* storing the value of latest token run*/
    insert into scimtoken (start_date)
                                  select max(START_TIME) from snowflake.account_usage.query_history where QUERY_TEXT like '%select system$generate_scim_access_token%' order by start_time desc;
                                  
 /* selecting the value from new table*/                              
    select * from scimtoken;

Based on this you may then build a notification mechanism.

Upvotes: 1

Related Questions